A step-by-step guide to setting up Playwright for WordPress E2E testing. Covers installing wp-env and Playwright, configuring the test environment, and writing practical tests for a WordPress child theme. Examples include testing block variations (Book Author), block patterns (Book Review Card) using aria snapshot testing, and verifying front-end rendering of post meta values via the REST API. Also covers running tests in UI Mode and using WordPress-specific test utilities from the @wordpress/e2e-test-utils-playwright package.
Table of contents
What is E2E testing?Before you beginLocal environment setup with wp-envPlaywright setupYour first testTesting the Book Reviews projectTesting the Book Author blockTesting the Book Review Card patternTesting the front-end and meta valuesFurther readingSort: