# RESUME — UI E2E Automation ✅ WP1 COMPLETE (awaiting /fullpush + owner enable)

**Status:** WP1 fully done (WP0+WP1a+WP1b+WP1c). Built + reviewed + verified on `hazemdev` (both repos). ⛔ NOT deployed/merged — owner runs `/fullpush`. Then owner sets `E2E_RUNNER_ENABLED=true` (dev only) to use it.
**Ledger:** [LEDGER.md](LEDGER.md) · **Briefs:** [tasks/](tasks/) · **Plan:** https://moonui.elbaset.com/his-analysis/ui-e2e-automation-plan.html

## What shipped (WP1 = the full loop MVP)
An owner-only **System Tests** screen (`/core/e2e-tests`) with a **Run** button that triggers Playwright E2E scenarios against the deployed `/app` and shows each scenario green/red + last-run time, polling live. First scenario = a real LIS flow (login → create patient → create lab request → assert it appears in the list). Safe: runs against an isolated **E2E test company** only; the runner is **owner-only + disabled by default**.

## Commits
| WP | Repo | Commit | Notes |
|----|------|--------|-------|
| WP1a | FE | `152d0bb` | Playwright harness + first LIS spec (1 passed 8.2s). Test co **id 8** `e2e@moonerp.test`/`E2e!Pass123`. Deviation: create-via-API, assert-via-UI (UI-drive → WP4). |
| WP1b | BE | `bdda8b78b` | `Modules/E2eRunner` — `e2e_runs` migration (ran on dev), `POST /api/e2e/run` (env-off default + owner + single-flight + detached spawn), `GET /api/e2e/runs/latest`, `e2e:run {id}`. Pest 4 pass. **Full e2e verified** (non-blocking, queued→running→passed). Injection-safe. |
| WP1c | FE | `fc6e994` | Owner-only `/core/e2e-tests` screen + `e2e-runner.service.ts` + nav + i18n. ng build green. |
| — | BE | `9a49fd7d4` | CHANGELOG bilingual note. |

## Review / test evidence
- Codex was BLOCKED (bwrap ENOSPC sandbox limit [[codex-blocked-on-server]]) on all 3 WPs → **native reviews** (documented per-WP in LEDGER): gates, injection-safety, write-isolation, build-safety, i18n, cleanup all verified. Fable NOT used (owner: emergency-only).
- BE Pest 4 pass/18 assert on sqlite; no regressions (RoleApi 20, AuthorityLimit 16). FE `ng build` green. WP1b verified end-to-end with a real run (then flag OFF + test rows cleaned).

## Safety state at handoff
- `E2E_RUNNER_ENABLED` NOT in live `.env` → **default OFF** (client installs unaffected).
- `e2e_runs` table exists on dev, **0 rows** (verification rows cleaned).
- Test company **id 8 `E2E Test Lab`** isolated (its own company_id scope).

## How to use (after /fullpush)
1. Owner runs `/fullpush` (syncs both repos to main + deploys /app + runs the migration on dev).
2. On the dev BE, set `E2E_RUNNER_ENABLED=true` in `.env` (dev only — leave OFF on client servers).
3. Log in as owner → **Core → System Tests** → **Run** → watch scenarios go green/red.

## Deferrals / next (WP2-4 from the plan, not built)
- **WP2** — more LIS scenarios (sample → result → validation → print, incl. histopath/culture).
- **WP3** — selective run + run history + screenshots-on-fail.
- **WP4** — drive the create dialogs through the UI (needs `data-testid` hooks deployed) + expand to other modules.
- Known infra notes: uses system Chromium `/usr/bin/chromium-browser` (Playwright browsers are root-owned); child process needs explicit PATH under PHP-FPM (`E2E_RUNNER_CHILD_PATH`); no queue worker on box → detached process model.
