-
Notifications
You must be signed in to change notification settings - Fork 20
/
playwright.config.ts
79 lines (67 loc) · 1.79 KB
/
playwright.config.ts
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
import { PlaywrightTestConfig, defineConfig, devices } from "@playwright/test";
import path from "pathe";
import { env } from "./tests/utils/env";
const seconds = (value: number) => value * 1000;
const minutes = (value: number) => value * seconds(60);
export const testDir = path.join(__dirname, "tests");
export const testResultsDir = path.join(testDir, "results");
const outputDir = path.join(testResultsDir, "output");
const reportDir = path.join(testResultsDir, "report");
export const storagePath = path.join(testResultsDir, "storage.json");
export const sessionPath = path.join(testResultsDir, "session.json");
const useOptions: PlaywrightTestConfig["use"] = {
...devices["Desktop Chrome"],
headless: env.CI,
locale: "en-US",
actionTimeout: seconds(20),
navigationTimeout: seconds(20),
trace: "on",
viewport: {
width: 1440,
height: 900,
},
};
export default defineConfig({
globalSetup: path.join(testDir, "global-setup"),
globalTeardown: path.join(testDir, "global-teardown"),
forbidOnly: env.CI,
maxFailures: 1,
workers: 1,
preserveOutput: "always",
timeout: minutes(5),
testDir,
outputDir,
reporter: [["line"], ["html", { outputFolder: reportDir }]],
expect: {
timeout: seconds(20),
},
projects: [
{
name: "setup",
testMatch: /.*\.setup\.ts/,
use: useOptions,
},
{
name: "onboarding",
dependencies: ["setup"],
testMatch: /.*\.onboarding\.ts/,
use: useOptions,
},
{
name: "banking",
dependencies: ["setup"],
testMatch: /.*\.banking\.ts/,
use: {
...useOptions,
storageState: storagePath,
},
},
],
webServer: {
command: "pnpm dev-e2e",
url: env.BANKING_URL,
reuseExistingServer: !env.CI,
stderr: "pipe",
stdout: "ignore",
},
});