-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
74 lines (72 loc) · 2.95 KB
/
Copy pathplaywright.config.ts
File metadata and controls
74 lines (72 loc) · 2.95 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
import { defineConfig, devices } from '@playwright/test';
// By default the suite spins up its own `ng serve` on :4200. Set E2E_BASE_URL to
// run against something already running instead -- another local port, or a
// deployed environment:
//
// E2E_BASE_URL=http://localhost:4310 npm run e2e
// E2E_BASE_URL=https://beta.reactome.org npm run e2e
//
// Backend calls are host-relative (environment.ts derives them from
// window.location.origin), so a local server needs the /ContentService,
// /AnalysisService and /GSAServer entries in proxy.conf.json to reach a real
// backend. A deployed environment already routes those itself.
const externalBaseURL = process.env['E2E_BASE_URL'];
const baseURL = externalBaseURL || 'http://localhost:4200';
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env['CI'],
retries: process.env['CI'] ? 2 : 0,
workers: process.env['CI'] ? 1 : undefined,
reporter: 'html',
use: {
baseURL,
trace: 'on-first-retry',
},
// Two suites, because they answer different questions.
//
// code is the code right? Runs on every push and while developing. It
// must not depend on freshly generated release data, and anything
// that needs a backend feature the target may not have asks first
// and skips with a reason.
//
// release is the release right? Run after the release process has generated
// the database and published the files: every top-level pathway
// draws, every download link resolves, the version and the news and
// the statistics all say the release we are actually serving.
//
// The split is the directory: e2e/release/** is the second suite. It exists
// because the whole of one day's CI trouble was release checks failing in a
// code-verification context -- endpoints the target lacked, data it did not
// have, and 29 diagram loads on a two-core runner.
projects: [
{
name: 'code',
use: { ...devices['Desktop Chrome'] },
testIgnore: '**/release/**',
},
{
name: 'release',
use: { ...devices['Desktop Chrome'] },
testMatch: '**/release/**',
// One retry, not the suite's two. These are sweeps against a published
// site -- twenty-one diagram loads in one case -- so a second attempt is
// worth having for a dropped connection, and a third only costs another
// twelve minutes to reach the same answer. Retrying was a large part of
// why the release job never finished inside its budget.
retries: process.env['CI'] ? 1 : 0,
},
],
// Only manage a server when we're the ones who started it.
...(externalBaseURL
? {}
: {
webServer: {
command: 'npm run start:simple',
url: baseURL,
reuseExistingServer: !process.env['CI'],
// A cold Angular build well exceeds playwright's 60s default.
timeout: 180_000,
},
}),
});