Skip to content

Playwright test example#463

Merged
tormi merged 41 commits into
mainfrom
feature/WQS-115-playwright-tests
Jun 11, 2026
Merged

Playwright test example#463
tormi merged 41 commits into
mainfrom
feature/WQS-115-playwright-tests

Conversation

@mgalang

@mgalang mgalang commented May 20, 2026

Copy link
Copy Markdown
Contributor

Ticket WQS-115

Changes

This pull request introduces Playwright for end-to-end (E2E) browser testing, including all necessary configuration and documentation updates. It adds Playwright test dependencies, a reusable Drupal test base, an example E2E test, and a GitHub Actions workflow for running Playwright tests in CI. It also updates DDEV configuration for local Playwright support and documents the new testing workflow.

Playwright E2E Testing Integration

  • Added Playwright configuration (playwright.config.ts) for multi-browser testing, parallelization, and CI compatibility.
  • Added a custom test base (tests/helpers/drupal-test.ts) using @drupal/playwright to provide Drupal-specific test helpers.
  • Added an example Playwright test (tests/example.spec.ts) demonstrating basic Drupal page creation.

Dependency and Environment Setup

  • Updated package.json to add Playwright, TypeScript, Faker, and @drupal/playwright as dependencies, and set "type": "module". [1] [2] [3]
  • Updated .ddev/config.yaml to install Playwright browsers and set environment variables for Playwright tests. [1] [2]

Continuous Integration

  • Added a GitHub Actions workflow (.github/workflows/playwright.yml) to run Playwright tests on pushes and pull requests, including playwright report upload.

Documentation

  • Updated README.md with clear instructions for running PHPUnit and Playwright tests, including setup, commands, and test structure.

Testing

  1. Clone the repository
  2. Start the ddev environment: ddev start
  3. Install drupal: ddev drush si standard
  4. Run the example playwright test: ddev npx playwright test
  5. See the report and confirm the tests passes: npx playwright show-report

Additionally, check that the tests are running and passing in the CI (github actions): https://github.com/wunderio/drupal-project/actions/runs/26224491021/job/77167782032

@mgalang mgalang force-pushed the feature/WQS-115-playwright-tests branch from 0c9a3d2 to 314dbba Compare May 20, 2026 14:10
@mgalang mgalang marked this pull request as draft May 21, 2026 06:51
@mgalang mgalang marked this pull request as ready for review May 21, 2026 12:14
@mgalang mgalang marked this pull request as draft May 21, 2026 12:14
@mgalang mgalang marked this pull request as ready for review May 21, 2026 13:12
@mgalang mgalang requested a review from tormi May 27, 2026 06:20
@mgalang mgalang changed the title Playwright test example [WIP] Playwright test example May 27, 2026
@tormi tormi force-pushed the feature/WQS-115-playwright-tests branch from b4084e6 to 410bec8 Compare June 1, 2026 14:02

@tormi tormi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Marc, nice Playwright CI setup!

I recommend trying this workflow with DDEV and CircleCI as well. I created another experimental PR using yours as a base to try out: #467

Why consider this approach?

  1. The project already uses DDEV and CircleCI.
  2. Your workflow uses pure PHP/Node + MariaDB services, which is different from a local developer workflow.
  3. Matching local and CI reduces potential "works locally, fails in CI" issues.

tormi
tormi previously approved these changes Jun 1, 2026

@tormi tormi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @mgalang! I added some suggestions for further discussions.

Comment thread tests/example.spec.ts
Comment thread tests/example.spec.ts
@mgalang

mgalang commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Updates:

  • Added tags
  • Added authentication with stored state
  • Added ddev containers to github workflow

@mgalang mgalang requested a review from tormi June 9, 2026 09:39
tormi
tormi previously approved these changes Jun 10, 2026

@tormi tormi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, RTBC!

@tormi tormi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:

Warning: Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/checkout@v4, actions/upload-artifact@v4. Actions will be forced to run with Node.js 24 by default starting June 16th, 2026. Node.js 20 will be removed from the runner on September 16th, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

Comment thread .ddev/config.yaml
@mgalang mgalang force-pushed the feature/WQS-115-playwright-tests branch from 0d35ce6 to dc2c3fb Compare June 10, 2026 09:28
@mgalang

mgalang commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Minor:

Warning: Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/checkout@v4, actions/upload-artifact@v4. Actions will be forced to run with Node.js 24 by default starting June 16th, 2026. Node.js 20 will be removed from the runner on September 16th, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

Seems like this is an issue with github actions itself, I have updated the action version to the latest and it still gets the error.

Comment thread .github/workflows/playwright.yml Outdated
@tormi tormi self-requested a review June 11, 2026 10:05

@tormi tormi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, Node.js 20 actions are deprecated warning is gone. RTBC.

@tormi tormi merged commit a5a091a into main Jun 11, 2026
2 of 3 checks passed
@tormi tormi deleted the feature/WQS-115-playwright-tests branch June 11, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants