Files
computer-playbook/roles/test-e2e-playwright/AGENTS.md
kevinveenbirkenbachandClaude Opus 4.7 5196283f6c refactor(test-e2e-playwright): bake @playwright/test into a shared node_modules
Per-role Playwright runs no longer call `npm install` against
registry.npmjs.org on every invocation. A new `01_setup.yml` runs once
per host/version, populates `_shared/node_modules/` inside the Playwright
container, and stamps the installed version in `.installed-version`.
Each `02_run_one.yml` mounts that tree read-only at `/e2e/node_modules`
and the container command becomes `npx --no-install playwright test`.
This eliminates the npmjs.org TLS-handshake flake that took out the
keycloak playwright in a recent variant-2 update, saves ~4 s per role,
and gives version bumps a single rebuild point.

Three retry layers cover transient registry failures: Ansible (3× with
5 s delay), npm fetch (5× with 10-60 s backoff), and image pull (3×).

Stage-base / shared-dir / stamp / node_modules paths live as SPOT
constants in `vars/main.yml` so call sites never reconstruct them.

Renames `tasks/run_one.yml` → `tasks/02_run_one.yml` (and adds
`01_setup.yml`) to make the include order visible by filename; updates
cross-references in `AGENTS.md`, the two `docs/contributing/...` pages,
`dump_disk_diagnostics.sh`, and the lint test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 11:23:24 +02:00

30 lines
1.4 KiB
Markdown

# Agent Instructions: test-e2e-playwright
This role is the **shared Playwright runner** for all end-to-end tests in the repository.
Changes here affect every application role that uses it.
## General Rules
- You MUST keep all changes to this role minimal and non-invasive.
- Before modifying any file in this role, you MUST explain to the user why the change is necessary and ask for explicit confirmation.
- You MUST NOT introduce new override mechanisms (e.g. per-role variable mappings) that bypass the existing environment-variable interface.
- Application roles MUST use the existing variables (`TEST_E2E_PLAYWRIGHT_IMAGE`, `TEST_E2E_PLAYWRIGHT_COMMAND`, etc.) for customisation instead of adding new indirection inside this role.
## File-Specific Rules
### `tasks/02_run_one.yml`
- You MUST NOT add new `set_fact` variables that shadow or wrap existing `TEST_E2E_PLAYWRIGHT_*` variables.
- You MUST NOT read from role `vars/main.yml` mappings of consuming roles (e.g. `test_e2e_playwright.*`) to override runner behaviour.
- Any change to the task flow MUST leave all existing call sites unaffected.
### `defaults/main.yml`
- New variables MUST follow the `TEST_E2E_PLAYWRIGHT_` prefix convention.
- Default values MUST be safe to use without any per-role override.
### `README.md`
- Document only variables and behaviour that are actually implemented in the role.
- Do NOT document patterns or extension points that do not exist in the code.