diff --git a/AGENTS.md b/AGENTS.md index f2f51cf..dd7fa86 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,3 +5,8 @@ 2. **Changelog entry** — every such change is listed in `CHANGELOG.md` with date, time and version (format: `## v — YYYY-MM-DD HH:MM`, then bullet points of what changed). 3. **Version bump** — the version is updated in `package.json`. 4. **Commit + tag** — a commit is created for each change, tagged with the version (e.g. `v0.1.0`). + +## E2E tests (mandatory) +1. **Compose instance is the app under test** — e2e always runs against the docker-compose build behind Traefik (`https://flight.dev.kkhost.pl`), never a local `next dev` on :3000 (dev builds don't render for non-loopback clients, and a second instance splits state). +2. **Update before testing** — deploy current code first: `docker compose up -d --build`. +3. **Remote browsers** — tests run through the shared Playwright server at `192.168.1.4:3000` (Docker image tag must match this repo's @playwright/test version); plain `npx playwright test` handles deploy + readiness + remote connect (see `playwright.config.ts`). diff --git a/CHANGELOG.md b/CHANGELOG.md index e5940a1..1b7663c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.2.5 — 2026-09-16 21:22 +- `AGENTS.md`: new "E2E tests (mandatory)" section codifies the e2e workflow — the compose instance behind Traefik (`https://flight.dev.kkhost.pl`) is always the app under test, never a local `next dev` on :3000; deploy current code first with `docker compose up -d --build`; browsers run through the shared remote Playwright server at `192.168.1.4:3000`, and plain `npx playwright test` handles deploy + readiness + remote connect +- `playwright.config.ts`: dropped the `E2E_LOCAL=1` local-dev path accordingly — no more local :3000 dev instance for e2e; the default (and only) mode is browsers on the shared remote Playwright server against the prod build behind Traefik, with `webServer` running `docker compose up -d --build`; `E2E_REMOTE=1` and explicit `PW_TEST_CONNECT_WS_ENDPOINT`/`E2E_BASE_URL` overrides are unchanged + ## v0.2.4 — 2026-09-16 21:06 - `playwright.config.ts`: default e2e mode now targets the prod build behind Traefik (`https://flight.dev.kkhost.pl`) — `baseURL` defaults to that URL and `webServer` runs `docker compose up -d --build` (300 s timeout) instead of `npm run dev`, because `next dev` does not render for non-loopback clients: Turbopack's HMR WebSocket fails from the remote browsers, so the page loads blank - `E2E_LOCAL=1` keeps the local iteration path (browsers on this box, `webServer` auto-starts `npm run dev`, baseURL `localhost:3000`) as a fallback when the proxy or compose stack is down; `E2E_REMOTE=1` and explicit `PW_TEST_CONNECT_WS_ENDPOINT`/`E2E_BASE_URL` overrides are unchanged diff --git a/package.json b/package.json index 2ec4b5e..26fec62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flight-ops", - "version": "0.2.4", + "version": "0.2.5", "private": true, "scripts": { "dev": "next dev -p 3000", diff --git a/playwright.config.ts b/playwright.config.ts index 465b81b..8272bc4 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,17 +1,12 @@ import { defineConfig } from '@playwright/test'; -// Where browsers run and how the app is addressed: -// (default) browsers on the shared remote Playwright server (Docker, 192.168.1.4:3000); -// app = prod build behind Traefik at https://flight.dev.kkhost.pl (docker compose). -// NOTE: don't point this at `next dev` over the LAN — Turbopack's HMR WS fails for -// non-loopback clients and the page renders blank. -// E2E_LOCAL=1 everything local — browsers here, `npm run dev` on localhost:3000 -// (fast iteration; fallback when remote server or proxy is down). -// E2E_REMOTE=1 runner not on this box: skip webServer; pair with E2E_BASE_URL if needed. -const local = process.env.E2E_LOCAL === '1'; +// Browsers run on the shared remote Playwright server (Docker, 192.168.1.4:3000); +// the app under test is always the prod build behind Traefik (docker compose). +// NOTE: never point this at a local `next dev` — Turbopack's HMR WS fails for +// non-loopback clients and the page renders blank; a second instance also splits state. const remoteRunner = process.env.E2E_REMOTE === '1'; -if (!local && !process.env.PW_TEST_CONNECT_WS_ENDPOINT) { +if (!process.env.PW_TEST_CONNECT_WS_ENDPOINT) { process.env.PW_TEST_CONNECT_WS_ENDPOINT = 'ws://192.168.1.4:3000/'; } @@ -20,22 +15,15 @@ export default defineConfig({ timeout: 30_000, retries: 1, use: { - baseURL: process.env.E2E_BASE_URL ?? (local ? 'http://localhost:3000' : 'https://flight.dev.kkhost.pl'), + baseURL: process.env.E2E_BASE_URL ?? 'https://flight.dev.kkhost.pl', trace: 'on-first-retry', }, webServer: remoteRunner ? undefined - : local - ? { - command: 'npm run dev', - url: 'http://localhost:3000/api/airports', - reuseExistingServer: true, - timeout: 120_000, - } - : { - command: 'docker compose up -d --build', - url: 'https://flight.dev.kkhost.pl/api/airports', - reuseExistingServer: true, - timeout: 300_000, - }, + : { + command: 'docker compose up -d --build', + url: 'https://flight.dev.kkhost.pl/api/airports', + reuseExistingServer: true, + timeout: 300_000, + }, });