Repository navigation
Expand file tree
/
Copy pathplaywright.config.base.js
More file actions
60 lines (57 loc) · 1.59 KB
/
Copy pathplaywright.config.base.js
File metadata and controls
60 lines (57 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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"] },
},
],
});