woocommerce/plugins/woocommerce-blocks/tests/e2e-pw
Niels Lange e7f8a8cb6e WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034)
* Set up Playwright

* Use caching in GitHub Actions

* Update tests/e2e-pw/README.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Rename “{blockName}” to “{blockName} block”

* Disable “no-console” for setup and teardown files

* Remove obsolete log and adjusted disabled ESLint definition

* Remove conditional logic from actions/upload-artifact

---------

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-04-17 19:01:41 +07:00
..
bin WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
test-data/data WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
tests WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
README.md WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
global-setup.ts WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
global-teardown.ts WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00
playwright.config.ts WIP: Add Playwright setup (https://github.com/woocommerce/woocommerce-blocks/pull/9034) 2023-04-17 19:01:41 +07:00

README.md

WooCommerce Blocks Playwright End to End Tests

This is the documentation for the new E2E testing setup based on Playwright and wp-env. Over time, these playwright E2E tests should replace the current Puppeteer E2E tests.

Table of contents

Pre-requisites

Note, that if you are on Mac and you install docker through other methods such as homebrew, for example, your steps to set it up might be different. The commands listed in steps below may also vary.

If you are using Windows, we recommend using Windows Subsystem for Linux (WSL) for running E2E tests. Follow the WSL Setup Instructions first before proceeding with the steps below.

Introduction

End-to-end tests are powered by Playwright. The test site is spun up using wp-env (recommended), but we will continue to support e2e-environment in the meantime.

Running tests for the first time

nvm use
npm install
npm run env:start
npm run test:e2e-pw

To run the test again, re-create the environment to start with a fresh state

npm run env:restart
npm run test:e2e-pw

Other ways of running tests

Headless mode:

npm run test:e2e-pw

Interactive UI mode:

npm run test:e2e-pw -- --ui

Headed mode:

npm run test:e2e-pw -- --headed

Debug mode:

npm run test:e2e-pw -- --debug

Running a single test:

npm run test:e2e-pw ./tests/e2e-pw/tests/example.spec.ts

To see all options, run the following command:

npx playwright test --help