-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
60 lines (52 loc) · 1.92 KB
/
Copy pathplaywright.config.js
File metadata and controls
60 lines (52 loc) · 1.92 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
// @ts-check
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for the prado-websocket browser-client tests.
*
* These specs drive a real browser `WebSocket` against the standalone
* {@link ./tests/playwright/ws-server.php TWebSocketServer echo server}, so the
* RFC 6455 handshake and framing are exercised end to end against Chromium,
* Firefox, and WebKit — the runtime coverage the PHP unit and Autobahn suites
* cannot give.
*
* A small PHP built-in server serves a static page (port 8377) only so the
* browser opens `ws://` from a real HTTP origin; the WebSocket servers
* themselves are spawned per-spec by ./tests/playwright/ws-helpers.js.
*
* Run (Node not required; this repo drives Playwright with bun):
* bun run playwright # or: bunx playwright test
* bunx playwright test --project=chromium
* HEADLESS=false bunx playwright test # watch it run
*/
const PAGE_PORT = 8377;
export default defineConfig({
testDir: './tests/playwright',
testMatch: '**/*.spec.js',
timeout: 30_000,
forbidOnly: !!process.env.CI,
retries: 0,
workers: 1,
reporter: [
['list'],
['html', { outputFolder: 'build/playwright-report', open: 'never' }],
],
/* A static page server so browser WebSockets originate from a real HTTP origin. */
webServer: {
command: `php -d display_errors=stderr -S 127.0.0.1:${PAGE_PORT} -t tests/playwright/public`,
url: `http://127.0.0.1:${PAGE_PORT}/status.txt`,
reuseExistingServer: !process.env.CI,
timeout: 30_000,
},
use: {
baseURL: `http://127.0.0.1:${PAGE_PORT}`,
headless: process.env.HEADLESS !== 'false',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
],
outputDir: 'build/playwright-results',
});