# RESUME — E2E Request Scenarios (all 12) — ✅ COMPLETE (2026-07-16)

**Status:** DONE. All 12 request scenarios (R1–R12) built, documented, and verified green together. ⛔ Not deployed/merged — owner runs `/fullpush`.
**Ledger:** [LEDGER.md](LEDGER.md) · **Briefs:** [tasks/](tasks/) · **Plan:** https://moonui.elbaset.com/his-analysis/e2e-request-scenarios-plan.html

## What shipped
12 Playwright E2E scenarios covering every lab-request flow, each a living GUIDE (JSDoc + `description` annotation + richly-named `test.step()` → renders in the System Tests drill-down on `/core/e2e-tests`, tagged `@lis @request` + sub-tag → new "request" group). All write-isolated to the E2E test company (id 8); assertions from the API money/status source-of-truth + UI where the value is surfaced.

| Group | Scenarios | Spec | Commit |
|---|---|---|---|
| seed (catalog) | E2E-GLU/K/PANEL/OUT + price-list + insurance(30/70) + external-lab + package | `e2e/setup/seed-e2e-company.php` | `e8c5af3` |
| seed (accounting) | co8 chart-of-accounts (AR/revenue/cash) + open FY + cash payment method + `lis.*` settings | (same file) | `16eb1fe` |
| `@client` | R1 normal · R2 insurance 30/70 split · R3 external-lab B2B | `lis-request-client-types.spec.ts` | `432d998` |
| `@payment` | R4 full→paid · R5 partial→partially_paid (remaining 7.000) · R6 deferred/draft | `lis-request-payment-states.spec.ts` | `446794fd` (+`16eb1fe`) |
| `@tests` | R7 package(28<35) · R8 panel-as-one(30) · R9 outsourced→referrals · R10 10% discount(→9.000) | `lis-request-tests.spec.ts` | `55edb424` |
| `@lifecycle` | R11 add/remove test (total moves) · R12 cancel (reason req'd → cancelled badge) | `lis-request-lifecycle.spec.ts` | `4401964` |

Also retagged the old `lis-request-flow.spec.ts` `@smoke`→`@request` (R1 is the new smoke anchor).

## Verification
- **`npx playwright test --grep "@request"` → 13 passed (1.5m)** — all 12 new + the retagged flow, together, no cross-spec interference.
- Each WP: native review APPROVE (arithmetic checked for R7/R10/R11; account wiring for WP0b), tsc clean per spec.
- `ng build` unaffected — the entire feature lives under `e2e/` (specs + seed), zero `src/` changes.
- Seed idempotent (ran 2× same ids); leak-check: companies 1-7 gained NOTHING.

## Key facts discovered (for future E2E / LIS work)
- Money source-of-truth = the **lab invoice** (`total`/`amount_paid`/`balance_due`), not the request. A request has `total_amount`/`net_amount`/`discount_amount`.
- Real LIS invoice status enum: `draft→posted→partially_paid→paid→cancelled` (NO `unpaid`). Request status is a `{value,label}` object; cancelled = `cancelled`.
- Payment collect: `POST /lis/payments {lab_invoice_id,amount,payment_method,receiving_account_id}`; routing via `GET /lis/payments/routing`. **Posting an invoice / recording a payment needs: `lis.receivable_account_id` + `lis.revenue_account_id` settings, Detail (non-header) accounts, AND an OPEN fiscal period (`CreateJournalEntry` throws `no_open_period`).**
- Insurance split fields on the request: `coverage_percentage` / `patient_share_total` / `insurance_share_total`.
- Package: `packages[]` (with `package.total_price`/`package_price`) + members EXPAND onto `investigations[]` at allocated prices. Panel = one `is_panel` priced line, members at 0.000.
- Outsourced routing: sample `is_external` from creation; the outbound **referral is created on `receive`** (not `collect`); never enters the section kanban.
- Add-investigation `POST /lis/requests/{id}/investigations {investigation_id,price}` (wizard sends price; **detail screen omits it → line 0.000**); remove `DELETE .../investigations/{investigation_id}` (path = catalog id, not line id). Cancel `POST .../cancel {reason}` (reason required, 422 without).

## Deferrals / open items
- **🔎 Latent finding:** FE request-DETAIL add-investigation omits price → total doesn't move (possible under-billing). Surface to owner; `problem-investigation` if unexpected. (In LEDGER.)
- WP0b (co8 accounting seed) is E2E-company-only — if the E2E company is ever re-provisioned elsewhere, re-run the seed.

## ✅ /fullpush DONE (2026-07-16)
- BE unified: `hazemdev == origin/main` @ `d4dd3e3ce` (CHANGELOG conflict resolved by union — dropped a stray `## [5.1.32]` premature cut, all unreleased bullets back under `[Unreleased]`; merged main's Clinic batch in). Dev migrated (5 migrations: clinic result-status/consult-timings + `add_freeze_to_lab_patients`) + updater seeders run.
- FE unified: `hazemdev == origin/main` @ `dab049e`. Build green; `/app` = `main-ZQLMOTJT.js` (byte-identical — session was e2e/-only, zero src/ change). config.json intact (gitignored → untouched).
- The 12 scenarios are now live under the "request" group on `/core/e2e-tests`. Screenshot config = `only-on-failure` (success captures removed — they all showed the same requests list). E2E_RUNNER_ENABLED stays OFF by default on client installs.
