diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index 9a232f6b0b0d62..23545c70f512ec 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -49,7 +49,7 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 run: | - xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright -- --shard=${{ matrix.part }}/${{ matrix.totalParts }} + xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }} - name: Archive debug artifacts (screenshots, traces) uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 diff --git a/docs/contributors/code/e2e/README.md b/docs/contributors/code/e2e/README.md index 9394e3cddd5501..43443cddd6aeb6 100644 --- a/docs/contributors/code/e2e/README.md +++ b/docs/contributors/code/e2e/README.md @@ -12,29 +12,29 @@ See the dedicated guide if you're working with the previous Jest + Puppeteer fra ```bash # Run all available tests. -npm run test:e2e:playwright +npm run test:e2e # Run in headed mode. -npm run test:e2e:playwright -- --headed +npm run test:e2e -- --headed # Run tests with specific browsers (`chromium`, `firefox`, or `webkit`). -npm run test:e2e:playwright -- --project=webkit --project=firefox +npm run test:e2e -- --project=webkit --project=firefox # Run a single test file. -npm run test:e2e:playwright -- # E.g., npm run test:e2e:playwright -- site-editor/title.spec.js +npm run test:e2e -- # E.g., npm run test:e2e -- site-editor/title.spec.js # Debugging. -npm run test:e2e:playwright -- --debug +npm run test:e2e -- --debug ``` If you're developing in Linux, it currently requires testing Webkit browsers in headed mode. If you don't want to or can't run it with the GUI (e.g. if you don't have a graphic interface), prepend the command with [`xvfb-run`](https://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html) to run it in a virtual environment. ```bash # Run all available tests. -xvfb-run npm run test:e2e:playwright +xvfb-run npm run test:e2e # Only run webkit tests. -xvfb-run -- npm run test:e2e:playwright -- --project=webkit +xvfb-run -- npm run test:e2e -- --project=webkit ``` ## Best practices diff --git a/docs/contributors/code/testing-overview.md b/docs/contributors/code/testing-overview.md index 520c95bc600223..6afa5aed865b7d 100644 --- a/docs/contributors/code/testing-overview.md +++ b/docs/contributors/code/testing-overview.md @@ -327,10 +327,7 @@ However, if the change was intentional, follow these steps to update the snapsho npm run test:unit -- --updateSnapshot --testPathPattern path/to/tests # Update snapshot for e2e tests -npm run test:e2e -- --updateSnapshot --testPathPattern path/to/e2e-tests - -# Update snapshot for Playwright -npm run test:e2e:playwright -- --update-snapshots path/to/spec +npm run test:e2e -- --update-snapshots path/to/spec ``` 1. Review the diff and ensure the changes are expected and intentional. diff --git a/package.json b/package.json index fc86729654b58f..28e09f5822e688 100644 --- a/package.json +++ b/package.json @@ -319,10 +319,10 @@ "storybook:e2e:dev": "concurrently \"npm run dev:packages\" \"storybook dev -c test/storybook-playwright/storybook -p 50241\"", "test": "npm-run-all lint test:unit", "test:create-block": "bash ./bin/test-create-block.sh", - "test:e2e": "wp-scripts test-e2e --config packages/e2e-tests/jest.config.js", - "test:e2e:debug": "wp-scripts --inspect-brk test-e2e --runInBand --no-cache --verbose --config packages/e2e-tests/jest.config.js --puppeteer-devtools", - "test:e2e:playwright": "wp-scripts test-playwright --config test/e2e/playwright.config.ts", - "test:e2e:playwright:debug": "wp-scripts test-playwright --config test/e2e/playwright.config.ts --ui", + "test:e2e": "wp-scripts test-playwright --config test/e2e/playwright.config.ts", + "test:e2e:debug": "wp-scripts test-playwright --config test/e2e/playwright.config.ts --ui", + "test:e2e:playwright": "npm run test:e2e", + "test:e2e:playwright:debug": "npm run test:e2e:debug", "test:e2e:storybook": "playwright test --config test/storybook-playwright/playwright.config.ts", "test:e2e:watch": "npm run test:e2e -- --watch", "test:native": "cross-env NODE_ENV=test jest --config test/native/jest.config.js", diff --git a/test/e2e/playwright.config.ts b/test/e2e/playwright.config.ts index cbbfbac3be4159..f5410f2230372b 100644 --- a/test/e2e/playwright.config.ts +++ b/test/e2e/playwright.config.ts @@ -33,7 +33,7 @@ const config = defineConfig( { * Headless webkit won't receive dataTransfer with custom types in the * drop event on Linux. The solution is to use `xvfb-run` to run the tests. * ```sh - * xvfb-run npm run test:e2e:playwright + * xvfb-run npm run test:e2e * ``` * See `.github/workflows/end2end-test-playwright.yml` for advanced usages. */