universo-platform-2d
79 строк · 2.1 Кб
1import { testResultDir } from '@affine-test/kit/playwright';
2import type {
3PlaywrightTestConfig,
4PlaywrightWorkerOptions,
5} from '@playwright/test';
6
7const config: PlaywrightTestConfig = {
8testDir: './e2e',
9fullyParallel: !process.env.CI,
10timeout: 120_000,
11outputDir: testResultDir,
12use: {
13baseURL: 'http://localhost:8080/',
14browserName:
15(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
16'chromium',
17permissions: ['clipboard-read', 'clipboard-write'],
18viewport: { width: 1440, height: 800 },
19actionTimeout: 10 * 1000,
20locale: 'en-US',
21trace: 'on',
22video: 'on',
23},
24forbidOnly: !!process.env.CI,
25workers: process.env.CI ? 1 : 4,
26retries: 1,
27reporter: process.env.CI ? 'github' : 'list',
28webServer: [
29{
30command: 'yarn run serve:test-static',
31port: 8081,
32timeout: 120 * 1000,
33reuseExistingServer: !process.env.CI,
34env: {
35COVERAGE: process.env.COVERAGE || 'false',
36ENABLE_DEBUG_PAGE: '1',
37},
38},
39// Intentionally not building the web, reminds you to run it by yourself.
40{
41command: 'yarn -T run start:web-static',
42port: 8080,
43timeout: 120 * 1000,
44reuseExistingServer: !process.env.CI,
45env: {
46COVERAGE: process.env.COVERAGE || 'false',
47},
48},
49{
50command: 'yarn workspace @affine/server start',
51port: 3010,
52timeout: 120 * 1000,
53reuseExistingServer: !process.env.CI,
54stdout: 'pipe',
55stderr: 'pipe',
56env: {
57DATABASE_URL:
58process.env.DATABASE_URL ??
59'postgresql://affine:affine@localhost:5432/affine',
60NODE_ENV: 'development',
61AFFINE_ENV: process.env.AFFINE_ENV ?? 'dev',
62DEBUG: 'affine:*',
63FORCE_COLOR: 'true',
64DEBUG_COLORS: 'true',
65MAILER_HOST: '0.0.0.0',
66MAILER_PORT: '1025',
67MAILER_SENDER: 'noreply@toeverything.info',
68MAILER_USER: 'noreply@toeverything.info',
69MAILER_PASSWORD: 'affine',
70},
71},
72],
73};
74
75if (process.env.CI) {
76config.retries = 3;
77}
78
79export default config;
80