From f792e7166249d28c4daec23a49c06ba51da36066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20L=C3=B3pez?= Date: Wed, 19 Apr 2023 11:39:06 +0200 Subject: [PATCH] Fix E2E Playwright documentation as some steps to set up the local environment and run E2E tests were not accurate. --- .../woocommerce/changelog/fix-e2e-test-docs | 5 ++++ plugins/woocommerce/tests/e2e-pw/README.md | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-e2e-test-docs diff --git a/plugins/woocommerce/changelog/fix-e2e-test-docs b/plugins/woocommerce/changelog/fix-e2e-test-docs new file mode 100644 index 00000000000..1dc4cf39363 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-e2e-test-docs @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Small documentation change + + diff --git a/plugins/woocommerce/tests/e2e-pw/README.md b/plugins/woocommerce/tests/e2e-pw/README.md index 5df175f010b..d53649f6c34 100644 --- a/plugins/woocommerce/tests/e2e-pw/README.md +++ b/plugins/woocommerce/tests/e2e-pw/README.md @@ -34,24 +34,27 @@ End-to-end tests are powered by Playwright. The test site is spinned up using `w **Running tests for the first time:** -- `nvm use` -- `pnpm install` -- `pnpm run build --filter=woocommerce` -- `pnpm env:start` +- `nvm use` (uses the default node version you have set in NVM) +- `pnpm install` (installs dependencies) +- `pnpm run build --filter=woocommerce` (builds WooCommerce locally) +- `cd plugins/woocommerce` (heads to the WooCommerce plugin folder) +- `npx playwright install` (makes sure to use the latest Playwright version) +- `pnpm env:start` (starts the local environment) +- `pnpm test:e2e-pw` (runs tests in headless mode) To run the test again, re-create the environment to start with a fresh state: -- `pnpm restart` -- `pnpm test:e2e-pw` +- `pnpm env:restart` (restarts the local environment) +- `pnpm test:e2e-pw` (runs tests in headless mode) -Other ways of running tests: +Other ways of running tests (make sure you are in the `plugins/woocommerce` folder): -- `pnpm env:test` (headless) -- `cd plugin/woocommerce && USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js --headed` (headed) -- `cd plugins/woocommerce && USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js --debug` (debug) -- `cd plugins/woocommerce && USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js ./tests/e2e-pw/tests/activate-and-setup/basic-setup.spec.js` (running a single test) +- `pnpm test:e2e-pw` (usual, headless run) +- `pnpm test:e2e-pw --headed` (headed -- displaying browser window and test interactions) +- `pnpm test:e2e-pw --debug` (runs tests in debug mode) +- `pnpm test:e2e-pw ./tests/e2e-pw/tests/activate-and-setup/basic-setup.spec.js` (runs a single test) -To see all options, run `cd plugins/woocommerce && pnpm playwright test --help` +To see all options, make sure you are in the `plugins/woocommerce` folder and run `pnpm playwright test --help` ### About the environment