-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
76 lines (66 loc) · 2.25 KB
/
playwright.config.ts
File metadata and controls
76 lines (66 loc) · 2.25 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
import { defineConfig } from '@playwright/test';
/**
* Playwright E2E configuration for Q².
*
* Serves the built application via a lightweight static server and runs real
* browser tests against it — no mocks, no fakes, no fake DOM.
*/
/**
* Chromium launch args for WebGPU support.
*
* Local Docker runs (e2e/run-local.sh):
* /dev/dri is passed to the container for Intel/AMD GPU access. The run
* script sets E2E_GPU_AVAILABLE=1 automatically when /dev/dri is present,
* which drops --use-gl=swiftshader and lets Chromium use hardware Vulkan
* (Intel ANV / AMD RADV).
*
* Without GPU (lavapipe fallback):
* --use-gl=swiftshader forces the Mesa software Vulkan rasterizer.
* WebGPU still works; inference falls back to WASM.
*/
const gpuArgs = [
'--enable-gpu',
'--ignore-gpu-blocklist',
'--enable-unsafe-webgpu',
'--disable-gpu-sandbox',
// Use SwiftShader (software GL) when no GPU is available.
// Dropped when E2E_GPU_AVAILABLE=1 (set by run-local.sh on /dev/dri systems).
...( process.env.E2E_GPU_AVAILABLE ? [] : ['--use-gl=swiftshader'] ),
];
export default defineConfig({
testDir: './e2e',
outputDir: './e2e-results',
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(process.env.CI),
/* Retry once on CI to absorb network flakiness during model download. */
retries: process.env.CI ? 1 : 0,
/* Run tests sequentially — model loading is heavy. */
workers: 1,
reporter: process.env.CI ? 'github' : 'list',
use: {
baseURL: 'http://localhost:4173',
/* Take a screenshot on every test so the issue reporter can see proof. */
screenshot: 'on',
trace: 'retain-on-failure',
headless: true,
/* Enable WebGPU and hardware-acceleration hints.
* On systems with Intel/AMD GPU: hardware Vulkan via /dev/dri passthrough.
* Without GPU: Mesa lavapipe (software Vulkan) via SwiftShader flag. */
launchOptions: {
args: gpuArgs,
},
},
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
},
],
/* Start a static file server before running tests. */
webServer: {
command: 'node e2e/serve.mjs',
port: 4173,
reuseExistingServer: !process.env.CI,
timeout: 10_000,
},
});