-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
67 lines (63 loc) · 2.41 KB
/
Copy pathplaywright.config.ts
File metadata and controls
67 lines (63 loc) · 2.41 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
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright config for the browser-level accessibility suite.
*
* These specs exist because jsdom cannot see the bugs they guard. jsdom
* implements no sequential focus navigation, so no jsdom test can observe
* `Tab` escaping (or failing to escape) the table — a live keyboard trap was
* shown to pass all ~3,650 vitest tests. Real layout also matters: axe's
* colour-contrast and scrollable-region rules need paint, and the tab-stop
* census depends on `getClientRects()`.
*
* The specs are named `*.spec.ts` on purpose. `vitest.config.ts` includes
* `tests/**\/*.test.ts`, so this directory is invisible to vitest and to the
* global coverage thresholds it enforces.
*/
/** Fixed port so the `webServer` URL below is deterministic. */
const PORT = 5199;
/**
* The demo's Vite `base` — `index.html` is served from this sub-path.
*
* `localhost` rather than `127.0.0.1`: Vite binds to whatever `localhost`
* resolves to, which is IPv6-only on some machines, and a hard-coded IPv4
* literal then never connects.
*/
const BASE_URL = `http://localhost:${PORT}/data-table/`;
export default defineConfig({
testDir: './tests/browser',
// Loading a 266-column CSV means booting DuckDB WASM, parsing, and
// rendering ~1,300 controls. Individual assertions are fast; the setup
// is not.
timeout: 120_000,
expect: { timeout: 15_000 },
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
// Serial on CI. Each spec boots DuckDB WASM and parses a 266-column CSV in
// its own browser context; two of those at once on a shared runner pushes
// the load past its timeout, and a flaky accessibility gate gets ignored.
// Locally, parallel — the whole suite is a couple of minutes.
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? [['github'], ['list']] : [['list']],
use: {
baseURL: BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
// `--strictPort` so a busy 5199 fails loudly instead of silently moving
// the server somewhere `baseURL` does not point.
command: `npm run dev -- --port ${PORT} --strictPort`,
url: BASE_URL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
stdout: 'ignore',
stderr: 'pipe',
},
});