Files
playkit/docs/SELFTEST.md
T
ilia 68b04bd826
CI / release (pull_request) Has been skipped
CI / skip-ci-check (pull_request) Successful in 5s
CI / secret-scan (pull_request) Successful in 5s
CI / build-and-test (pull_request) Successful in 18s
CI / selftest (pull_request) Successful in 39s
fix(ci): pin selftest Playwright image to v1.61.1 matching lockfile
npm ci was resolving @playwright/test@1.61.1 against a v1.52.0 container,
so Chromium binary paths mismatched and browser specs failed.
2026-07-15 09:00:31 -04:00

45 lines
1.3 KiB
Markdown

# Kit CI self-test (fake site)
Unit tests in `src/**/*.test.ts` mock HTTP/mail. They do **not** prove that
`BasePage`, `ApiClient`, or network helpers work against a real browser + HTTP
server. The **selftest** suite fills that gap without depending on punimtag DEV.
## Layout
```
selftest/
demo-site/server.mjs # tiny Node HTTP app (:4173)
playwright.config.ts # starts webServer, runs Chromium
tests/
browser.spec.ts # BasePage, host guards, intercept, error monitor
api.spec.ts # ApiClient + Zod schema
```
Mail stays unit-tested only (Mailpit/Mailtrap need live SMTP traps). Selftest
does not start Mailpit.
## Local
```bash
npx playwright install chromium # once
npm run selftest
```
Env (optional):
| Var | Default |
|-----|---------|
| `PLAYKIT_SELFTEST_PORT` | `4173` |
| `PLAYKIT_BASE_URL` | `http://127.0.0.1:4173` |
Selftest sets `assertPublicHost(..., false)` when touching `127.0.0.1` — consumer
public e2e must keep the default forbid-private behavior.
## CI
`.gitea/workflows/ci.yml` job `selftest` runs in
`mcr.microsoft.com/playwright:v1.61.1-jammy` (must match the pinned
`@playwright/test` version) and executes `npm run selftest` after unit tests.
Failures there mean a regression in kit browser/API helpers *before* a consumer
pins a broken tag.