-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.docker.js
More file actions
56 lines (50 loc) · 2.13 KB
/
Copy pathplaywright.config.docker.js
File metadata and controls
56 lines (50 loc) · 2.13 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
// playwright.config.docker.js
//
// Container integration layer — drives the real production image (nginx serving
// dist/) instead of the Express mirror the other two suites use.
//
// Run with:
// npm run build:headless
// npx playwright test --config=playwright.config.docker.js
//
// The other suites run against tests/fragment-server.mjs, a hand-written mirror
// of the nginx rewrites. A mirror is only as faithful as the last person to
// update both sides: #45 (locations silently dropping inherited headers) and #60
// (a 308 where nginx does an internal rewrite) both survived because nothing
// ever exercised nginx.conf itself. This suite closes that gap.
//
// NOT hermetic — it needs Docker and `docker build` pulls the base image, so it
// is deliberately excluded from `npm test`. In CI it runs inside the job that
// already builds the image, reusing it via KB_SKIP_BUILD.
//
// Scope note: this verifies nginx faithfully. It does not cover the
// web-fragments gateway that sits in front of it in production — that is what
// the embedded harness in playwright.config.js is for.
import { defineConfig, devices } from '@playwright/test';
const PORT = process.env.KB_CONTAINER_PORT || '8099';
export default defineConfig({
testDir: './tests',
testMatch: '**/container.spec.js',
fullyParallel: true,
retries: process.env.CI ? 1 : 0,
reporter: [['list'], ['html', { open: 'never' }]],
timeout: 20_000,
use: {
baseURL: `http://localhost:${PORT}`,
},
webServer: {
command: 'node tests/container/serve.mjs',
// /healthz is the container's own health endpoint — the same one the
// Dockerfile HEALTHCHECK uses.
url: `http://localhost:${PORT}/healthz`,
reuseExistingServer: !process.env.CI,
// A cold `docker build` pulls the base image; give it room.
timeout: 300_000,
stdout: 'pipe',
stderr: 'pipe',
},
// Most assertions are plain HTTP requests against nginx, but the CSP ones need
// a real browser: a policy that blocks something the page needs fails
// silently, and only a browser reports the violation.
projects: [{ name: 'nginx', use: { ...devices['Desktop Chrome'] } }],
});