-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
77 lines (75 loc) · 2.39 KB
/
Copy pathplaywright.config.ts
File metadata and controls
77 lines (75 loc) · 2.39 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
import { defineConfig } from "@playwright/test";
import {
ANSWERS_DIR,
COUNTER_FILE,
DATA_DIR,
FAKE_CLI,
LIMIT_TRIGGER,
STALL_TRIGGER,
} from "./e2e/setup";
const PORT = 3100;
const BASE_URL = `http://127.0.0.1:${PORT}`;
export default defineConfig({
testDir: "./e2e",
fullyParallel: false,
forbidOnly: true,
// No retries: a test that only passes on retry is failing.
retries: 0,
reporter: [["list"]],
globalSetup: "./e2e/setup.ts",
// The journey walks one review from an empty app to an exported report, so
// its steps are deliberately dependent and run in order.
workers: 1,
timeout: 120_000,
use: {
baseURL: BASE_URL,
trace: "retain-on-failure",
screenshot: "only-on-failure",
},
projects: [
// The journey mutates the app: it adds a project, imports rules, and runs
// a review. It runs once, and the theme passes then photograph what it
// left behind. Running it twice would fail on its own second attempt to
// add the same repository, which is correct behaviour and a useless test.
{ name: "journey", testMatch: /journey\.spec\.ts/, use: { colorScheme: "light" } },
// The endings that are not success. After the journey, because they reuse
// the project and ruleset it leaves behind; before the theme passes, so
// the screenshots are of a settled app rather than one mid-experiment.
{
name: "failure-paths",
testMatch: /failure-paths\.spec\.ts/,
dependencies: ["journey"],
use: { colorScheme: "light" },
},
{
name: "light",
testMatch: /themes\.spec\.ts/,
dependencies: ["failure-paths"],
use: { colorScheme: "light" },
},
// Both themes are first-class, so both are photographed rather than one
// being checked and the other assumed.
{
name: "dark",
testMatch: /themes\.spec\.ts/,
dependencies: ["failure-paths"],
use: { colorScheme: "dark" },
},
],
webServer: {
command: `npm run start -- --port ${PORT}`,
url: BASE_URL,
reuseExistingServer: false,
timeout: 180_000,
env: {
TRYSQUARE_DATA: DATA_DIR,
// The fake, so the whole journey spends nothing.
TRYSQUARE_CLAUDE_PATH: FAKE_CLI,
FAKE_CLAUDE_SCENARIO: "script",
FAKE_CLAUDE_DIR: ANSWERS_DIR,
FAKE_CLAUDE_COUNTER: COUNTER_FILE,
FAKE_CLAUDE_LIMIT_FILE: LIMIT_TRIGGER,
FAKE_CLAUDE_STALL_FILE: STALL_TRIGGER,
},
},
});