Repository navigation
Expand file tree
/
Copy pathplaywright.config.js
More file actions
50 lines (46 loc) · 1.91 KB
/
Copy pathplaywright.config.js
File metadata and controls
50 lines (46 loc) · 1.91 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
// GitBucket browser tests. Target and browser come from the environment, see README.md.
import { defineConfig, devices } from '@playwright/test';
import { target } from './lib/target.js';
import { newRunId } from './lib/run.js';
// one id per run, inherited by the workers (lib/run.js)
process.env.E2E_RUN ||= newRunId();
const browsers = { firefox: 'Desktop Firefox', chromium: 'Desktop Chrome' };
const browser = process.env.E2E_BROWSER || 'firefox';
if (!browsers[browser]) {
throw new Error(`Unknown E2E_BROWSER '${browser}' (one of: ${Object.keys(browsers).join(', ')})`);
}
// a stage's specs in every scope: core/<stage>/ and plugins/<pluginId>/<stage>/
const stage = (name) => [`core/${name}/**/*.spec.js`, `plugins/*/${name}/**/*.spec.js`];
export default defineConfig({
testDir: '.',
outputDir: 'results/artifacts',
reporter: [
['list'],
['html', { outputFolder: 'results/report', open: 'never' }],
// for the CI summary (scripts/ci-summary.js)
['json', { outputFile: 'results/results.json' }],
],
// the tests share one GitBucket instance and its data: one after the other
workers: 1,
fullyParallel: false,
timeout: 60_000,
expect: { timeout: 10_000 },
use: {
...devices[browsers[browser]],
baseURL: target.baseURL,
ignoreHTTPSErrors: target.ignoreHTTPSErrors,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
// one project per stage; the scope (core, a plugin) is the tag of each test (@core, @gist, ...)
projects: [
// accounts and data the other projects need; idempotent (skips what exists)
{ name: 'setup', testMatch: stage('setup') },
// the instance is up and usable
{ name: 'smoke', testMatch: stage('smoke'), dependencies: ['setup'] },
// the test cases
{ name: 'flows', testMatch: stage('flows'), dependencies: ['setup'] },
// planned (docs/e2e-plan.md): access, release, cleanup
],
});