# WP3 — Request tests/packages scenarios (R7/R8/R9/R10)

## Goal
One spec `e2e/specs/lis-request-tests.spec.ts`, 4 scenarios covering test/package variations, tagged `@lis @request @tests`.

## 📖 DOCUMENTATION STANDARD (owner mandate — every test case is a GUIDE)
Each `test(...)` MUST have: (1) a 2nd-arg `{ annotation: { type: "description", description: "..." } }` clearly stating what the scenario proves; (2) rich human-readable `test.step("...")` for EVERY meaningful step (NOT "step 1"), named so a non-dev reads the drill-down and understands the flow; (3) a JSDoc header summarising the scenario in plain words (like lis-result-review-flow.spec.ts). These render in the System Tests drill-down = the living guide. Reuse e2e/helpers (auth/lisSetup/uiSearch + fillSearchUntilVisible for flake). Write-isolated company 8. Unique ids per run. API-setup + UI-assert where the value is.

## Scenarios
- **R7 — package**: create a request with `packages[].package_id` (env `E2E_PACKAGE_ID` from WP0) → assert the package's member investigations expand onto the request AND the price reflects the package discount (package_price < sum of members). Step names spell out the expected discounted total.
- **R8 — panel (CBC-like)**: create a request with the panel investigation (`E2E_PANEL_ID`) → assert it shows as ONE test in the request/list (panel members are hidden except at result entry). Assert via UI + API.
- **R9 — outsourced**: create a request with the outsourced investigation (`E2E_OUTSOURCED_INV_ID`, is_outsourced + default_external_lab_id) → assert after collection it routes to **referrals**, NOT kanban (inspect referrals list / the request's referral state). This is the key outsourced behaviour.
- **R10 — whole-request discount**: create a request with `discount_percentage` (e.g. 10) → assert the request total = subtotal − discount, and VAT applied after discount (assert the exact computed total, UI + API). Name the step with the numbers.

## Ids from WP0
`E2E_PACKAGE_ID`, `E2E_PANEL_ID`, `E2E_OUTSOURCED_INV_ID`, base investigations. Env fallbacks.

## Acceptance
- [ ] 4 scenarios with description + named steps + JSDoc.
- [ ] R7 package expansion + discounted price; R8 panel-as-one; R9 outsourced→referrals; R10 discount total+VAT — each asserted.
- [ ] `npx playwright test --grep "@tests"` green. ng build unaffected.

## Out of scope
Client types (WP1), payment (WP2), lifecycle (WP4). No BE changes.

## Flags
R7/R10 assert money math (no logic change) → native review of the arithmetic. No migration.
