-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
61 lines (57 loc) · 1.76 KB
/
playwright.config.ts
File metadata and controls
61 lines (57 loc) · 1.76 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
import { defineConfig } from '@playwright/test';
declare const process: {
cwd(): string;
env: Record<string, string | undefined>;
};
const testPath = [
`${process.cwd()}/.playwright-bin`,
process.env.PATH ?? '',
].join(':');
const skipWebServer = process.env.PLAYWRIGHT_SKIP_WEBSERVER === '1';
const backendHost = process.env.PLAYWRIGHT_BACKEND_HOST ?? '127.0.0.1';
const backendPort = process.env.PLAYWRIGHT_BACKEND_PORT ?? '4100';
const frontendHost = process.env.PLAYWRIGHT_FRONTEND_HOST ?? '127.0.0.1';
const frontendPort = process.env.PLAYWRIGHT_FRONTEND_PORT ?? '3100';
const baseURL =
process.env.PLAYWRIGHT_BASE_URL ??
`http://${frontendHost}:${frontendPort}`;
const backendBaseUrl = `http://${backendHost}:${backendPort}`;
export default defineConfig({
testDir: './tests/e2e',
timeout: 30_000,
workers: 1,
use: {
baseURL,
headless: true,
},
webServer: skipWebServer
? undefined
: [
{
command:
'pnpm --filter shared build && pnpm --filter server exec tsx watch src/index.ts',
env: {
...process.env,
PATH: testPath,
PLAYWRIGHT_USE_MOCK_COPILOT: '1',
HOST: backendHost,
PORT: backendPort,
},
url: `${backendBaseUrl}/api/health`,
reuseExistingServer: false,
timeout: 60_000,
},
{
command:
`pnpm --filter shared build && pnpm --filter web exec vite --host ${frontendHost} --port ${frontendPort}`,
env: {
...process.env,
PATH: testPath,
VITE_BACKEND_URL: backendBaseUrl,
},
url: `http://${frontendHost}:${frontendPort}`,
reuseExistingServer: false,
timeout: 60_000,
},
],
});