Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
78 lines (74 loc) · 2.99 KB
/
Copy pathplaywright.config.ts
File metadata and controls
78 lines (74 loc) · 2.99 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, type ReporterDescription } from '@playwright/test';
import * as settings from './config/settings';
/**
* Environment (stage1/stage2/stage3/stage4/test/test2/test3/test4/uat1/prod) is selected via the
* TEST_ENV env var and resolved in config/settings.ts. Browser is selected via the
* `--project` CLI flag (chromium | firefox | edge | webkit), e.g.:
*
* TEST_ENV=test4 npx playwright test --project=firefox
*/
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 2,
workers: process.env.CI ? 1 : 1,
// 'github' prints failures as inline GitHub Actions annotations (file/line + error)
// directly in the run log/checks UI. 'json' feeds scripts/write-failure-summary.js,
// which turns that into a markdown table in the job's Summary page - both let you see
// what failed and why without downloading the (often huge) html report/trace artifacts.
// 'blob' is only added when BLOB_REPORT_NAME is set (the sharded weekly regression
// workflow sets it per shard); its merge_reports job combines the shards' blob files
// into one HTML report. The name keeps blob files from different browsers/shards
// from overwriting each other when they're downloaded into one folder.
reporter: process.env.CI
? [
['list'],
['html', { open: 'never' }],
['github'],
['json', { outputFile: 'test-results/results.json' }],
...(process.env.BLOB_REPORT_NAME
? [['blob', { fileName: `report-${process.env.BLOB_REPORT_NAME}.zip` }] as ReporterDescription]
: []),
]
: [['list'], ['html', { open: 'never' }]],
// Must stay comfortably above the largest individual wait below (navigationTimeout,
// LONG_TIMEOUT_MS) - otherwise a single slow-but-legitimate navigation/assertion can
// exhaust the whole test budget before its own, more specific timeout gets a chance to
// fire, so failures surface as an opaque global timeout (plus a cascading
// "Target page, context or browser has been closed" from the mid-flight kill)
// instead of a clear "element X never appeared" error.
timeout: settings.VERY_LONG_TIMEOUT_MS,
expect: {
timeout: settings.TIMEOUT_MS,
},
use: {
baseURL: settings.OSF_HOME,
headless: settings.HEADLESS,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: settings.TIMEOUT_MS,
navigationTimeout: settings.LONG_TIMEOUT_MS,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
// Playwright's WebKit engine - the closest thing to Safari available
// cross-platform (real Safari automation only runs on macOS).
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
});