Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
76 lines (69 loc) · 2.9 KB
/
Copy pathplaywright.config.ts
File metadata and controls
76 lines (69 loc) · 2.9 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
import { defineConfig, type Project } from '@playwright/test';
import { authFile, type LabUserName, playwrightOutputDir } from './integration-tests/support/lab';
// Three lab users share one cluster and the locator ConsoleLink, so the suite runs one test at a time. The suite runs
// by hand on a lab machine through scripts/e2e/run-crc.sh (or scripts/e2e/run-dev-lane.sh), never in CI.
const USERS: LabUserName[] = ['dev-a', 'dev-b', 'os-admin'];
// The specs that run with a lab user's console session; the two optional projects run their own spec alone.
const SIGNED_IN_SPECS =
/(plugin-loaded|databases-page|details-item|open-in-studio|no-secret-reads)\.spec\.ts/;
const setupProjects: Project[] = USERS.map((user) => ({
name: `setup-${user}`,
testMatch: /auth\.setup\.ts/,
metadata: { user },
}));
const userProjects: Project[] = USERS.map((user) => ({
name: `chromium-${user}`,
testMatch: SIGNED_IN_SPECS,
// Each spec tags its tests with the user they run as.
grep: new RegExp(`@${user}\\b`),
metadata: { user },
use: { browserName: 'chromium', storageState: authFile(user) },
dependencies: [`setup-${user}`],
}));
const optionalProjects: Project[] = [];
// Runs alone after the locator ConsoleLink is deleted, and only on the Helm path: the operator recreates the link.
if (process.env.E2E_LOCATOR_REMOVED === '1') {
optionalProjects.push({
name: 'locator-removed',
testMatch: /locator-removed\.spec\.ts/,
metadata: { user: 'os-admin' },
use: { browserName: 'chromium', storageState: authFile('os-admin') },
dependencies: ['setup-os-admin'],
});
}
// The development console of scripts/e2e/run-dev-lane.sh: sign-in disabled, so no setup and no storage state.
if (process.env.E2E_DEV_LANE === '1') {
optionalProjects.push({
name: 'dev-lane',
testMatch: /dev-lane\.spec\.ts/,
use: { browserName: 'chromium' },
});
}
// A failed test's page snapshot (error-context.md) may hold a form's values, such as the OAuth login page's.
process.env.PLAYWRIGHT_NO_COPY_PROMPT = '1';
export default defineConfig({
testDir: './integration-tests/tests',
timeout: 300_000,
expect: { timeout: 30_000 },
retries: 0,
workers: 1,
fullyParallel: false,
// Playwright empties outputDir at the start of every run, so it is never the evidence folder itself.
outputDir: playwrightOutputDir(),
use: {
baseURL: process.env.BRIDGE_BASE_ADDRESS ?? 'http://localhost:9000',
viewport: { width: 1920, height: 1080 },
// Traces and videos carry session cookies, so they are never written.
screenshot: 'only-on-failure',
ignoreHTTPSErrors: true,
video: 'off',
trace: 'off',
testIdAttribute: 'data-test',
},
projects: [...setupProjects, ...userProjects, ...optionalProjects],
reporter: [
['list'],
['html', { outputFolder: 'integration-tests/results/html', open: 'never' }],
['junit', { outputFile: 'integration-tests/results/junit-results.xml' }],
],
});