The Test Team helps manage testing and triage across the WordPress ecosystem. They focus on user testing of the editing experience and WordPress dashboard, replicating and documenting bug reports, and supporting a culture of review and triage across the project.
End-to-end (E2E) tests allow simulating user flows for an application, a site and validating them. They allow for automated testing of user interactions while providing a safety net for continuous development.
Over the past two years, the groundwork for implementing e2e tests in WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. has been laid. However, there hasn’t been much communication about the technical stack that is used for these tests or the next steps for adding more tests in WordPress.
The purpose of this post is to inform contributors about the current status of e2e testing in WordPress Core, the technologies being used, and what is currently being done to implement these tests.
What stack are we using for WordPress Core e2e tests?
E2e testing in WordPress Core is implemented with Jest as the testing framework and Puppeteer for browser interactions. This stack is relevant for Core use case because it is present in other parts of the CMS codebase.
On the other hand, it is used by GutenbergGutenberg 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/ for its tests. So we are not starting from scratch for the implementation in Core, as there is already some preliminary work done with the @wordpress/e2e-tests package and the @wordpress-e2e-utils utility package, which includes several basic flows that can be reused in tests.
What tests are currently implemented in Core?
Currently, only the setup for testing and a basic test of the WordPress Dashboard homepage are implemented in Core here. The @wordpress/e2e-tests-utils utility package (in the Gutenberg repository) contains various tests for installing, disabling, activating themes and plugins, navigating the different admin pages, etc.
What is the Test Team working on?
There are currently efforts being made to implement more e2e tests in WordPress Core. Starting with this ticket, opened by @isabel_brison that presents an overview of the different tests that will be implemented.
There are also pull requests, and branches from contributors who have already implemented tests for some parts of WordPress:
- PR for add/edit posts tests: https://github.com/WordPress/wordpress-develop/pull/1089
- Branch for Core categories tests: https://github.com/JustinyAhin/wordpress-develop/blob/try/add-new-category-tests/tests/e2e/specs/add-edit-category.test.js
- Branch for Core users tests: https://github.com/JustinyAhin/wordpress-develop/blob/add/users-tests/tests/e2e/specs/users.test.js
The next step is to start on the overview of the e2e tests to be implemented by creating smaller tickets for each of the tests, and then write the tests.
Any interested contributor is invited to comment on the ticket to propose other test scenarios, learn, and/or help build tests. All are welcomed.