forked from osbuild/image-builder-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
84 lines (78 loc) · 2.65 KB
/
Copy pathplaywright.config.ts
File metadata and controls
84 lines (78 loc) · 2.65 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
79
80
81
82
83
84
import {
defineConfig,
devices,
type ReporterDescription,
} from '@playwright/test';
import 'dotenv/config';
const reporters: ReporterDescription[] = [['html']];
if (!process.env.CI) {
reporters.push(['list']);
}
if (process.env.CI) {
reporters.push(['json', { outputFile: 'test-results.json' }]);
}
if (process.env.CURRENTS_PROJECT_ID && process.env.CURRENTS_RECORD_KEY) {
reporters.push(['@currents/playwright']);
}
export default defineConfig({
testDir: 'playwright',
fullyParallel: true,
workers: 4,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: reporters,
globalTimeout: 89.5 * 60 * 1000, // 1h29.5m, Set because of codebuild, we want PW to timeout before CB to get the results.
timeout: 3 * 60 * 1000, // 3m
// Assertions that genuinely need to wait longer say so at the call site.
// A high default hides which those are, and turns every ordinary failure
// into a slow one.
expect: { timeout: 15_000 }, // 15s
use: {
actionTimeout: 30_000, // 30s
navigationTimeout: 30_000, // 30s
headless: true,
// Specs assert on rendered dates. Without this the browser follows the
// host clock, so a date the wizard stores as UTC midnight renders as the
// previous day anywhere west of Greenwich - passing in CI and failing on
// a developer's machine.
timezoneId: 'UTC',
baseURL: process.env.BASE_URL
? process.env.BASE_URL
: 'http://127.0.0.1:9090',
video: 'retain-on-failure',
// 'on' kept a trace for every passing test too, which is hundreds of
// megabytes of artifacts nobody opens. 'on-first-retry' would record
// nothing locally, where retries are 0, so match the video setting and
// keep a trace whenever there is a failure to look at.
trace: 'retain-on-failure',
ignoreHTTPSErrors: true,
},
projects: [
{ name: 'Setup', testMatch: /.*\.setup\.ts/ },
{
name: 'UI tests',
// The slowest attempt observed is under 3m. This is only a ceiling on
// how long a hung test can burn before it is killed, and at 29.5m one
// could take a third of globalTimeout with it.
timeout: 5 * 60 * 1000, // 5m
use: {
...devices['Desktop Chrome'],
storageState: '.auth/user.json',
},
dependencies: ['Setup'],
},
{
name: 'Boot tests',
testMatch: /.*\.boot\.ts/,
// Retry 2 times because it's still cheaper than
// rerunning the whole job
retries: process.env.CI ? 2 : 0,
timeout: 89.5 * 60 * 1000, // 1h29.5m
use: {
...devices['Desktop Chrome'],
storageState: '.auth/user.json',
},
dependencies: ['Setup'],
},
],
});