Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,15 @@ jobs:
- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
SHARD_PART: ${{ matrix.part }}
SHARD_TOTAL: ${{ matrix.totalParts }}
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard="${SHARD_PART}/${SHARD_TOTAL}"
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run --workspace @wordpress/e2e-tests-playwright test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could continue to run npm run test:e2e, because the top-level script still exists, it just forwards the execution to the workspace script. Is that right?

I'm not suggesting that we change this back, just asking to verify my understanding.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could.


- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ !cancelled() }}
with:
name: failures-artifacts--${{ matrix.part }}
path: artifacts/test-results
path: test/e2e/artifacts/test-results

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the paths change? Running the upload-artifacts GitHub actions should have no relation to NPM workspaces.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upload-artifact action runs from the repo root, but the artifact output paths are relative to process.cwd() which changes when running via workspace.

The Playwright base config in @wordpress/scripts sets:

process.env.WP_ARTIFACTS_PATH ??= path.join( process.cwd(), 'artifacts' );
outputDir: path.join( process.env.WP_ARTIFACTS_PATH, 'test-results' ),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this path work correctly not only locally but also in CI? I might be wrong, but it seems like artifacts are not being uploaded even if the E2E tests fail. This means that even if e2e tests fail, there are no screenshots or trace files.

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change required for workspaces?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change required for workspaces?

Yes, see #74684 (comment)

if-no-files-found: ignore

- name: Archive blob reports (HTML)
Expand All @@ -81,7 +79,7 @@ jobs:
if: ${{ !cancelled() }}
with:
name: flaky-tests-report--${{ matrix.part }}
path: flaky-tests
path: test/e2e/flaky-tests
if-no-files-found: ignore

merge-artifacts:
Expand Down
67 changes: 56 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"@emotion/styled": "11.14.1",
"@inquirer/prompts": "7.2.0",
"@octokit/rest": "16.26.0",
"@playwright/test": "1.58.2",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.2",
"@testing-library/user-event": "14.6.1",
Expand All @@ -61,7 +60,6 @@
"@types/semver": "7.3.8",
"@types/sprintf-js": "1.1.2",
"@types/uuid": "8.3.1",
"@vitejs/plugin-react": "5.1.2",
"@wordpress/build": "file:./packages/wp-build",
"@wordpress/vips": "file:./packages/vips",
"ajv": "8.17.1",
Expand All @@ -88,7 +86,6 @@
"eslint-plugin-testing-library": "6.0.2",
"execa": "4.0.2",
"fast-glob": "^3.2.7",
"filenamify": "4.2.0",
"glob": "7.1.2",
"husky": "7.0.0",
"jest": "29.6.2",
Expand Down Expand Up @@ -125,7 +122,6 @@
"stylelint-plugin-logical-css": "^1.2.3",
"typescript": "5.9.3",
"uuid": "9.0.1",
"vite": "7.3.0",
"wait-on": "8.0.1"
},
"overrides": {
Expand Down Expand Up @@ -180,14 +176,14 @@
"prestorybook:build": "npm run build -- --skip-types",
"storybook:build": "npm run --workspace @wordpress/storybook storybook:build",
"storybook:dev": "concurrently \"npm run dev\" \"wait-on .dev-ready && npm run --workspace @wordpress/storybook storybook:dev\"",
"storybook:e2e:dev": "concurrently \"npm run dev\" \"wait-on .dev-ready && storybook dev -c test/storybook-playwright/storybook -p 50241\"",
"storybook:e2e:dev": "concurrently \"npm run dev\" \"wait-on .dev-ready && npm run --workspace @wordpress/storybook-playwright storybook:dev\"",
"test": "npm-run-all lint test:unit",
"test:create-block": "bash ./bin/test-create-block.sh",
"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": "npm run --workspace @wordpress/e2e-tests-playwright test:e2e",
"test:e2e:debug": "npm run --workspace @wordpress/e2e-tests-playwright test:e2e:debug",
"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:storybook": "npm run --workspace @wordpress/storybook-playwright test:e2e",
"test:e2e:watch": "npm run test:e2e -- --watch",
"test:native": "cross-env NODE_ENV=test jest --config test/native/jest.config.js",
"test:native:watch": "npm run test:native -- --watch",
Expand All @@ -196,8 +192,8 @@
"test:native:perf": "cross-env TEST_RUNNER_ARGS='--runInBand --config test/native/jest.config.js --testMatch \"**/performance/*.native.[jt]s?(x)\"' reassure",
"test:native:perf:baseline": "cross-env TEST_RUNNER_ARGS='--runInBand --config test/native/jest.config.js --testMatch \"**/performance/*.native.[jt]s?(x)\"' reassure --baseline",
"test:native:update": "npm run test:native -- --updateSnapshot",
"test:performance": "wp-scripts test-playwright --config test/performance/playwright.config.ts",
"test:performance:debug": "wp-scripts test-playwright --config test/performance/playwright.config.ts --debug",
"test:performance": "npm run --workspace @wordpress/performance-tests test:performance",
"test:performance:debug": "npm run --workspace @wordpress/performance-tests test:performance:debug",
"test:php": "npm-run-all lint:php test:unit:php",
"test:php:watch": "wp-env --config .wp-env.test.json run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script test:watch",
"test:unit": "wp-scripts test-unit-js --config test/unit/jest.config.js",
Expand Down Expand Up @@ -253,6 +249,9 @@
"workspaces": [
"packages/*",
"routes/*",
"storybook"
"storybook",
"test/e2e",
"test/performance",
"test/storybook-playwright"
]
}
3 changes: 2 additions & 1 deletion storybook/components/component-status-indicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function ComponentStatusIndicator() {
return null;
}

const statusInfo = statuses[ componentStatus.status ];
const statusInfo =
statuses[ componentStatus.status as keyof typeof statuses ];

if ( ! statusInfo ) {
return null;
Expand Down
4 changes: 3 additions & 1 deletion storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
"@storybook/addon-docs": "^10.2.8",
"@storybook/icons": "^2.0.1",
"@storybook/react-vite": "^10.2.8",
"@vitejs/plugin-react": "^5.1.2",
"@wordpress/theme": "file:../packages/theme",
"storybook": "^10.2.8",
"storybook-addon-tag-badges": "^3.0.4",
"terser": "^5.37.0"
"terser": "^5.37.0",
"vite": "^7.3.0"
},
"publishConfig": {
"access": "public"
Expand Down
36 changes: 36 additions & 0 deletions test/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@wordpress/e2e-tests-playwright",
"version": "0.0.0",
"description": "End-to-end tests for WordPress Gutenberg.",
"private": true,
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"gutenberg",
"e2e",
"playwright"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/test/e2e/README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/WordPress/gutenberg.git",
"directory": "test/e2e"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"devDependencies": {
"@playwright/test": "^1.58.2",
"@wordpress/e2e-test-utils-playwright": "file:../../packages/e2e-test-utils-playwright",
"@wordpress/scripts": "file:../../packages/scripts",
"filenamify": "^4.2.0"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"test:e2e": "wp-scripts test-playwright --config playwright.config.ts",
"test:e2e:debug": "wp-scripts test-playwright --config playwright.config.ts --ui"
}
}
4 changes: 2 additions & 2 deletions test/e2e/specs/admin/font-library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ test.describe( 'Font Library', () => {
const fileChooser = await fileChooserPromise;
// Provides coverage for https://github.com/WordPress/gutenberg/issues/59023.
await fileChooser.setFiles( [
'./test/e2e/assets/Exo2-Regular.woff',
'./test/e2e/assets/Exo2-SemiBoldItalic.woff2',
'./assets/Exo2-Regular.woff',
'./assets/Exo2-SemiBoldItalic.woff2',
] );

// Check fonts were installed.
Expand Down
9 changes: 1 addition & 8 deletions test/e2e/specs/editor/blocks/classic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,7 @@ class MediaUtils {
constructor( { page } ) {
this.page = page;

this.TEST_IMAGE_FILE_PATH = path.join(
__dirname,
'..',
'..',
'..',
'assets',
'10x10_e2e_test_image_z9T8jK.png'
);
this.TEST_IMAGE_FILE_PATH = './assets/10x10_e2e_test_image_z9T8jK.png';
}

async upload( inputElement ) {
Expand Down
18 changes: 2 additions & 16 deletions test/e2e/specs/editor/blocks/cover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,23 +567,9 @@ class CoverBlockUtils {
/** @type {Page} */
this.page = page;

this.TEST_IMAGE_FILE_PATH = path.join(
__dirname,
'..',
'..',
'..',
'assets',
'10x10_e2e_test_image_z9T8jK.png'
);
this.TEST_IMAGE_FILE_PATH = './assets/10x10_e2e_test_image_z9T8jK.png';

this.GREEN_IMAGE_FILE_PATH = path.join(
__dirname,
'..',
'..',
'..',
'assets',
'10x10_e2e_test_image_green.png'
);
this.GREEN_IMAGE_FILE_PATH = './assets/10x10_e2e_test_image_green.png';
}

async upload( locator, imagePath ) {
Expand Down
Loading
Loading