Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
78 lines (69 loc) · 3.02 KB
/
Copy pathplaywright.config.ts
File metadata and controls
78 lines (69 loc) · 3.02 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";
import { getUserAgent } from "./tests/ui/fixture/user-agent"; // for process.env types
dotenv.config({ path: path.resolve(__dirname, "env/.env.test.local") });
dotenv.config({ path: path.resolve(__dirname, "env/.env.test") });
const slowMo = Number(process.env.PW_SLOW_MO) || 0;
/** Capture a high-quality, Mac-sized video of the run. Opt-in via PW_RECORD=1, or implied when slow-mo is on. */
const isRecording = process.env.PW_RECORD === "1" || slowMo > 0;
/** ~16" MacBook Pro logical viewport (16:10). Use { width: 1512, height: 945 } for a 14"/15" feel. */
const RECORDING_VIEWPORT = { width: 1728, height: 1080 };
/** The organizations release checklist takes about 30 minutes on beta, so deploy gates skip it and `test:e2e:orgs-release` runs it on demand. */
const isOrganizationsReleaseRun = process.env.PW_ORGS_RELEASE === "1";
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests/ui",
/* Vitest owns *.unit.spec.ts files colocated in tests/ui (see vitest.config.ts "unit-e2e-helpers" project). */
testIgnore: isOrganizationsReleaseRun ? "**/*.unit.spec.ts" : ["**/*.unit.spec.ts", "**/organizations-release/**"],
globalTeardown: "./tests/ui/fixture/global-teardown.ts",
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
timeout: 60 * 1000,
globalTimeout: process.env.CI ? 60 * 60 * 1000 : undefined,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "retain-on-failure",
video: slowMo > 0 ? "on" : "retain-on-failure",
actionTimeout: 15_000,
permissions: ["clipboard-read", "clipboard-write"],
launchOptions: { slowMo }
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
channel: "chromium", // https://github.com/microsoft/playwright/issues/33566
userAgent: getUserAgent(),
...(isRecording ? { viewport: RECORDING_VIEWPORT, deviceScaleFactor: 2, video: { mode: "on" as const, size: RECORDING_VIEWPORT } } : {})
}
}
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
/* Test against branded browsers. */
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
]
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});