Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
59 lines (57 loc) · 1.83 KB
/
Copy pathplaywright.config.ts
File metadata and controls
59 lines (57 loc) · 1.83 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
import 'dotenv/config';
import { defineConfig, devices } from '@playwright/test';
const frontendPort = Number(process.env.E2E_FRONTEND_PORT ?? 3100);
const backendPort = Number(process.env.E2E_BACKEND_PORT ?? 3101);
const frontendUrl = `http://127.0.0.1:${frontendPort}`;
const apiBaseUrl = process.env.E2E_API_BASE_URL ?? `http://127.0.0.1:${backendPort}/api/v1`;
const databaseUrl =
process.env.DATABASE_URL ?? 'postgresql://postgres:postgres@localhost:5432/diffusion?schema=public';
export default defineConfig({
expect: {
timeout: 10_000,
},
fullyParallel: false,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
reporter: process.env.CI
? [['github'], ['html', { open: 'never' }]]
: [['list'], ['html', { open: 'never' }]],
testDir: './tests/e2e',
timeout: 45_000,
use: {
baseURL: frontendUrl,
trace: 'on-first-retry',
},
webServer: [
{
command: 'npx ts-node src/server.ts',
env: {
...process.env,
CORS_ORIGIN: frontendUrl,
DATABASE_URL: databaseUrl,
JWT_REFRESH_SECRET: process.env.JWT_REFRESH_SECRET ?? 'e2e-refresh-secret',
JWT_SECRET: process.env.JWT_SECRET ?? 'e2e-access-secret',
PORT: String(backendPort),
RATE_LIMIT_MAX: process.env.RATE_LIMIT_MAX ?? '1000',
RATE_LIMIT_WINDOW_MS: process.env.RATE_LIMIT_WINDOW_MS ?? '60000',
},
reuseExistingServer: !process.env.CI,
timeout: 120_000,
url: `http://127.0.0.1:${backendPort}/health`,
},
{
command: `npm run build -w frontend && npm run start -w frontend -- --hostname 127.0.0.1 --port ${frontendPort}`,
env: {
...process.env,
NEXT_PUBLIC_API_BASE_URL: apiBaseUrl,
},
reuseExistingServer: !process.env.CI,
timeout: 180_000,
url: frontendUrl,
},
],
});