Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ jobs:
composer-options: '--no-progress --optimize-autoloader --no-dev'

- name: Install playwright browsers
run: pnpm dlx playwright install --with-deps
# Use the locked @playwright/test, and only Chromium since that's all the config runs
run: pnpm exec playwright install --with-deps chromium
working-directory: plugins/${{ env.PLUGIN }}

- name: Start wp-env
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"reformat:md": "remark --rc-path .remarkrc.json --output --"
},
"engines": {
"node": ">=22.13.0",
"node": ">=22.19.0",
"pnpm": ">=10"
},
"keywords": [],
Expand All @@ -22,10 +22,8 @@
"description": "",
"devDependencies": {
"@playwright/test": "^1.64.1",
"@wordpress/e2e-test-utils-playwright": "^1.54.0",
"@wordpress/e2e-test-utils-playwright": "^3.1.0",
"@wordpress/env": "^12.0.0",
"@wordpress/jest-console": "^8.51.0",
"@wordpress/scripts": "30.27.0",
"js-yaml": "^4.3.2",
"remark-gfm": "^4.0.1",
"rimraf": "^5.0.5"
Expand Down
60 changes: 60 additions & 0 deletions playwright.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Shared Playwright settings for plugin E2E tests.
*
* Each plugin's tests/e2e/playwright.config.js spreads this and adds its own globalSetup.
* Relative paths (testDir) resolve against that plugin config, not this file.
*/
const path = require("path");
const { defineConfig, devices } = require("@playwright/test");

process.env.WP_ARTIFACTS_PATH ??= path.join(process.cwd(), "artifacts");
process.env.STORAGE_STATE_PATH ??= path.join(
process.env.WP_ARTIFACTS_PATH,
"storage-states/admin.json"
);

const baseUrl = new URL(process.env.WP_BASE_URL || "http://localhost:8889");

module.exports = defineConfig({
reporter: process.env.CI ? [["github"]] : [["list"]],
forbidOnly: !!process.env.CI,
workers: 1,
retries: process.env.CI ? 2 : 0,
timeout: parseInt(process.env.TIMEOUT || "", 10) || 100_000,
reportSlowTests: null,
testDir: "./specs",
outputDir: path.join(process.env.WP_ARTIFACTS_PATH, "test-results"),
snapshotPathTemplate:
"{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}",
use: {
baseURL: baseUrl.href,
headless: true,
viewport: {
width: 960,
height: 700,
},
ignoreHTTPSErrors: true,
locale: "en-US",
contextOptions: {
reducedMotion: "reduce",
strictSelectors: true,
},
storageState: process.env.STORAGE_STATE_PATH,
actionTimeout: 10_000,
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "on-first-retry",
},
webServer: {
command: "npm run wp-env start",
port: baseUrl.port,
timeout: 120_000,
reuseExistingServer: true,
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
});
2 changes: 1 addition & 1 deletion plugins/hwp-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Store versioned JSON documents for headless apps in WordPress, with writes that reject stale versions.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e": "playwright test --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
Expand Down
2 changes: 1 addition & 1 deletion plugins/hwp-documents/tests/e2e/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "@playwright/test";
import baseConfig from "@wordpress/scripts/config/playwright.config";
import baseConfig from "../../../../playwright.config.base.js";

const config = defineConfig({
...baseConfig,
Expand Down
2 changes: 1 addition & 1 deletion plugins/hwp-previews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Headless Previews solution for WordPress: fully configurable preview URLs via the settings page.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e": "playwright test --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
Expand Down
2 changes: 1 addition & 1 deletion plugins/hwp-previews/tests/e2e/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "@playwright/test";
import baseConfig from "@wordpress/scripts/config/playwright.config";
import baseConfig from "../../../../playwright.config.base.js";

const config = defineConfig({
...baseConfig,
Expand Down
6 changes: 1 addition & 5 deletions plugins/wpgraphql-debug-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"author": "wpengine",
"license": "GPL-2.0",
"devDependencies": {
"@playwright/test": "^1.64.1",
"@wordpress/e2e-test-utils-playwright": "^1.54.0",
"@wordpress/env": "^12.0.0",
"@wordpress/jest-console": "^8.51.0",
"@wordpress/scripts": "^30.27.0"
"@wordpress/env": "^12.0.0"
}
}
8 changes: 3 additions & 5 deletions plugins/wpgraphql-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "A POC plugin for logging WPGraphQL queries.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e": "playwright test --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
Expand All @@ -15,9 +15,7 @@
"license": "GPL-2.0",
"devDependencies": {
"@playwright/test": "^1.64.1",
"@wordpress/e2e-test-utils-playwright": "^1.54.0",
"@wordpress/env": "^12.0.0",
"@wordpress/jest-console": "^8.51.0",
"@wordpress/scripts": "^30.27.0"
"@wordpress/e2e-test-utils-playwright": "^3.1.0",
"@wordpress/env": "^12.0.0"
}
}
2 changes: 1 addition & 1 deletion plugins/wpgraphql-logging/tests/e2e/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "@playwright/test";
import baseConfig from "@wordpress/scripts/config/playwright.config";
import baseConfig from "../../../../playwright.config.base.js";

const config = defineConfig({
...baseConfig,
Expand Down
6 changes: 1 addition & 5 deletions plugins/wpgraphql-webhooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"author": "wpengine",
"license": "GPL-2.0",
"devDependencies": {
"@playwright/test": "^1.64.1",
"@wordpress/e2e-test-utils-playwright": "^1.54.0",
"@wordpress/env": "^12.0.0",
"@wordpress/jest-console": "^8.51.0",
"@wordpress/scripts": "^30.27.0"
"@wordpress/env": "^12.0.0"
}
}
Loading
Loading