forked from xlnfinance/xln
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
82 lines (79 loc) · 2.87 KB
/
playwright.config.ts
File metadata and controls
82 lines (79 loc) · 2.87 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { defineConfig, devices } from '@playwright/test';
const PW_BASE_URL = process.env['PW_BASE_URL'] || 'https://localhost:8080';
const PW_WORKERS_RAW = Number(process.env['PW_WORKERS'] || '1');
const PW_WORKERS = Number.isFinite(PW_WORKERS_RAW) && PW_WORKERS_RAW > 0 ? Math.floor(PW_WORKERS_RAW) : 1;
const PW_SKIP_WEBSERVER = process.env['PW_SKIP_WEBSERVER'] === '1';
const PW_ONLY_CHROMIUM = process.env['PW_ONLY_CHROMIUM'] === '1';
const PW_SIMPLE_REPORTER = process.env['PW_SIMPLE_REPORTER'] === '1';
const PW_OUTPUT_DIR = process.env['PW_OUTPUT_DIR'] || './tests/test-results';
const PW_FAST = process.env['PW_FAST'] === '1';
const PW_TRACE = process.env['PW_TRACE'] || (PW_FAST ? 'off' : 'on-first-retry');
const PW_SCREENSHOT = process.env['PW_SCREENSHOT'] || (PW_FAST ? 'off' : 'only-on-failure');
const PW_VIDEO = process.env['PW_VIDEO'] || (PW_FAST ? 'off' : 'retain-on-failure');
const PW_REPORTER = process.env['PW_REPORTER'];
export default defineConfig({
// testDir is relative to this config file's directory
reporter: PW_REPORTER
? [[PW_REPORTER]]
: PW_SIMPLE_REPORTER
? [['line']]
: [
['list'],
['github'],
['html', { open: 'never' }],
['json'],
],
testDir: './tests',
testIgnore: ['**/ux-flow-verification.spec.js'],
timeout: 60000, // 60s for AHB prepopulate
workers: PW_WORKERS,
// retries: 1,
outputDir: PW_OUTPUT_DIR,
use: {
baseURL: PW_BASE_URL,
headless: process.env['HEADED'] !== 'true', // Headless by default, use HEADED=true for visual
ignoreHTTPSErrors: true, // Ignore self-signed cert errors
trace: PW_TRACE as any,
screenshot: PW_SCREENSHOT as any,
viewport: { width: 1920, height: 1080 },
video: PW_VIDEO === 'off'
? 'off'
: { mode: PW_VIDEO as 'on' | 'retain-on-failure' | 'on-first-retry', size: { width: 1920, height: 1080 } },
launchOptions: {
args: [
'--start-maximized',
'--disable-gpu',
'--use-gl=swiftshader',
'--disable-dev-shm-usage',
],
},
},
projects: PW_ONLY_CHROMIUM ? [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], channel: 'chromium' },
},
] : [
{
name: 'chromium',
// Force full Chromium instead of chromium_headless_shell (regressed WebGL in 1.58+)
use: { ...devices['Desktop Chrome'], channel: 'chromium' },
},
{
name: 'brainvault',
testDir: './frontend/tests',
use: { ...devices['Desktop Chrome'] },
},
],
// Run dev server before tests
...(PW_SKIP_WEBSERVER ? {} : {
webServer: {
// Prebuild runtime once (fresh artifact), then run dev pipeline with runtime --watch.
command: './scripts/build-runtime.sh && SKIP_TYPECHECK=1 bun run dev',
url: PW_BASE_URL,
ignoreHTTPSErrors: true, // Self-signed cert
reuseExistingServer: true,
timeout: 120 * 1000,
},
}),
});