-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
188 lines (183 loc) · 4.48 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import { defineConfig, devices } from "@playwright/test";
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
const APPS = [
{
url: "http://localhost:3000",
command: `pnpm r:dev`,
testDir: "./apps/react/tests",
name: "React - Dev",
},
{
url: "http://localhost:4000",
command: `pnpm r:preview`,
testDir: "./apps/react/tests",
name: "React - Build",
},
{
url: "http://localhost:3001",
command: `pnpm mui:dev`,
testDir: "./apps/mui/tests",
name: "Mui - Dev",
},
{
url: "http://localhost:4001",
command: `pnpm mui:preview`,
testDir: "./apps/mui/tests",
name: "Mui - Build",
},
{
url: "http://localhost:3002",
command: `pnpm em:dev`,
testDir: "./apps/emotion/tests",
name: "Emotion - Dev",
},
{
url: "http://localhost:4002",
command: `pnpm em:preview`,
testDir: "./apps/emotion/tests",
name: "Emotion - Build",
},
{
url: "http://localhost:3003",
command: `pnpm tailwind:dev`,
testDir: "./apps/tailwind/tests",
name: "Tailwind - Dev",
},
{
url: "http://localhost:4003",
command: `pnpm tailwind:preview`,
testDir: "./apps/tailwind/tests",
name: "Tailwind - Build",
},
{
url: "http://localhost:3004",
command: `pnpm scss:dev`,
testDir: "./apps/scss/tests",
name: "Scss - Dev",
},
{
url: "http://localhost:4004",
command: `pnpm scss:preview`,
testDir: "./apps/scss/tests",
name: "Scss - Build",
},
{
url: "http://localhost:3005",
command: `pnpm less:dev`,
testDir: "./apps/less/tests",
name: "Less - Dev",
},
{
url: "http://localhost:4005",
command: `pnpm less:preview`,
testDir: "./apps/less/tests",
name: "Less - Build",
},
{
url: "http://localhost:3006",
command: `pnpm stylus:dev`,
testDir: "./apps/stylus/tests",
name: "Stylus - Dev",
},
{
url: "http://localhost:4006",
command: `pnpm stylus:preview`,
testDir: "./apps/stylus/tests",
name: "Stylus - Build",
},
{
url: "http://localhost:3007",
command: `pnpm vue:dev`,
testDir: "./apps/vue-app/tests",
name: "Vue - Dev",
},
{
url: "http://localhost:4007",
command: `pnpm vue:preview`,
testDir: "./apps/vue-app/tests",
name: "Vue - Build",
},
{
url: "http://localhost:3008",
command: `pnpm sv:dev`,
testDir: "./apps/svelte-app/tests",
name: "Svelte - Dev",
},
{
url: "http://localhost:4008",
command: `pnpm sv:preview`,
testDir: "./apps/svelte-app/tests",
name: "Svelte - Build",
},
{
url: "http://localhost:3009",
command: `pnpm pr:dev`,
testDir: "./apps/preact-app/tests",
name: "Preact - Dev",
},
{
url: "http://localhost:4009",
command: `pnpm pr:preview`,
testDir: "./apps/preact-app/tests",
name: "Preact - Build",
},
{
url: "http://localhost:3010",
command: `pnpm solid:dev`,
testDir: "./apps/solid-app/tests",
name: "Solid - Dev",
},
{
url: "http://localhost:4010",
command: `pnpm solid:preview`,
testDir: "./apps/solid-app/tests",
name: "Solid - Build",
},
];
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
name: "React Tests",
outputDir: "test-results",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},
/* Configure projects for major browsers */
projects: APPS.map((app) => {
return {
name: app.name,
use: {
...devices["Desktop Chrome"],
baseURL: app.url,
},
testDir: app.testDir,
};
}),
/* Run your local dev server before starting the tests */
webServer: APPS.map((app) => {
return {
command: app.command,
url: app.url,
timeout: 60 * 1000, // 60 seconds
reuseExistingServer: !process.env.CI,
};
}),
});