A few months ago, @bartkalisz proposed a proof of concept to migrate the Gutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ E2E test suite from Puppeteer to Playwright. This proposal was discussed several times in the above PR, during an editor chat, and during test team meetings.
WordPress test team members, Gutenberg team members, and Playwright engineers met to discuss in detail how this migration Moving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. could be done and what the possible blockers might be. You can find the minutes of that meeting here.
The infrastructure for writing Playwright tests in Gutenberg has been implemented by @kevin940726 here.
The purpose of this post is to present a migration plan to Playwright; as well as the implications this might have.
Areas in WordPress that will be affected by the migration
- @wordpress/e2e-test-utils: It is a utility package with basic tests that are reused by other E2E test packages and suites in Gutenberg, in WordPress Core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. and by third parties. This package is now deprecated and a new package
@wordpress/e2e-test-utils-playwright was introduced internally for the migration process.
@wordpress/e2e-tests: This is the E2E test suite from Gutenberg. It contains tests for different parts of WordPress and Gutenberg. The package has also been deprecated, and new E2E tests exist now in the
- WordPress Core E2E tests: This is the E2E test suite for WordPress Core. To date, it contains only a very small number of tests. It uses the
@wordpress/e2e-tests-utils package, and will need to be migrated to use Playwright.
Here is the roadmap we will follow to perform the migration
- Add Playwright test infrastructure to Gutenberg (done)
- Gradually migrate Gutenberg E2E tests to Playwright:
- Migrate tests from
test/e2e one file at a time. See overview issue here.
- Migrate test utils from
packages/e2e-test-utils-playwright as required.
- Add Playwright test infrastructure to Core and migrate Core E2E tests to Playwright: once the
e2e-test-utils used in Core are migrated, we can migrate the current suite of tests in Core to Playwright.
- Remove old packages: remove
Writing new tests during the migration
For now, developers may continue to write new E2E tests using Puppeteer. Once a significant amount of E2E tests have been migrated to Playwright, we can discuss enforcing that new E2E tests are written using Playwright. Waiting will ensure that enough test utils exist and that there are no problems with the new Playwright infrastructure. See this issue for migration progress.
How to help
Helping migrate tests to Playwright is one way you can help right now. Playwright’s syntax is similar to Puppeteer’s, so it won’t be totally unfamiliar.
Here is some useful link to get you started:
Props to @kevin940726 @noisysocks for helping put this post together, and @aristath and @sergeybiryukov for reviews.