wip
This commit is contained in:
@@ -1243,4 +1243,46 @@ GridPilot's testing strategy ensures:
|
||||
- **Browser automation works correctly** (Docker E2E tests with real fixtures)
|
||||
- **OS-level automation works correctly** (Native macOS E2E tests with display access)
|
||||
|
||||
By following BDD principles and maintaining clear test organization, the team can confidently evolve GridPilot while preserving correctness and stability.
|
||||
### Hosted Session Automation Test Pyramid
|
||||
|
||||
For the iRacing hosted-session automation, confidence is provided by these concrete suites:
|
||||
|
||||
- **Domain/Application unit tests**
|
||||
- Entities and value objects such as [`AutomationSession`](packages/domain/entities/AutomationSession.ts:1), [`SessionState`](packages/domain/value-objects/SessionState.ts:1), [`CheckoutState`](packages/domain/value-objects/CheckoutState.ts:1), [`CheckoutConfirmation`](packages/domain/value-objects/CheckoutConfirmation.ts:1), and [`RaceCreationResult`](packages/domain/value-objects/RaceCreationResult.ts:1).
|
||||
- Use cases such as [`StartAutomationSessionUseCase`](packages/application/use-cases/StartAutomationSessionUseCase.ts:1), [`VerifyAuthenticatedPageUseCase`](packages/application/use-cases/VerifyAuthenticatedPageUseCase.ts:1), [`CompleteRaceCreationUseCase`](packages/application/use-cases/CompleteRaceCreationUseCase.ts:1), and [`ConfirmCheckoutUseCase`](packages/application/use-cases/ConfirmCheckoutUseCase.ts:1).
|
||||
|
||||
- **Infrastructure / automation integration tests**
|
||||
- Adapter wiring and fixture serving via [`FixtureServer.integration.test.ts`](tests/integration/infrastructure/FixtureServer.integration.test.ts:1).
|
||||
- Playwright lifecycle and overlay wiring such as [`BrowserModeIntegration.test.ts`](tests/integration/infrastructure/BrowserModeIntegration.test.ts:1) and automation-flow tests like [`CarsFlow.integration.test.ts`](tests/integration/infrastructure/automation/CarsFlow.integration.test.ts:1).
|
||||
- UI/overlay integration via [`renderer-overlay.integration.test.ts`](tests/integration/interface/renderer/renderer-overlay.integration.test.ts:1).
|
||||
|
||||
- **Fixture-based step E2E tests (per-step behavior)**
|
||||
- One test per wizard step under [`tests/e2e/steps`](tests/e2e/steps:1), all using the shared [`StepHarness`](tests/e2e/support/StepHarness.ts:1) and [`FixtureServer`](packages/infrastructure/adapters/automation/engine/FixtureServer.ts:1).
|
||||
- These validate DOM-level selectors / flows for each step (1–18) against fixture-backed HTML, and are considered canonical for step behavior.
|
||||
|
||||
- **Fixture-based workflow E2E tests (button → auth entry → automation → confirmation boundary)**
|
||||
- Workflow-focused tests under [`tests/e2e/workflows`](tests/e2e/workflows:1) that drive the `PlaywrightAutomationAdapter` + `WizardStepOrchestrator` across multiple steps using the fixture server.
|
||||
- Example: [`steps-07-09-cars-flow.e2e.test.ts`](tests/e2e/workflows/steps-07-09-cars-flow.e2e.test.ts:1) exercises cross-step cars flow, while [`full-hosted-session.workflow.e2e.test.ts`](tests/e2e/workflows/full-hosted-session.workflow.e2e.test.ts:1) runs a full 1–18 workflow via [`MockAutomationEngineAdapter`](packages/infrastructure/adapters/automation/engine/MockAutomationEngineAdapter.ts:1) and [`StartAutomationSessionUseCase`](packages/application/use-cases/StartAutomationSessionUseCase.ts:1), asserting final `SessionState` and step position.
|
||||
- Additional workflow scenarios cover mid-flow failure using [`MockBrowserAutomationAdapter`](packages/infrastructure/adapters/automation/engine/MockBrowserAutomationAdapter.ts:1), ensuring failure states and diagnostics are surfaced without emitting false confirmations.
|
||||
|
||||
- **Opt-in real-world automation smoke tests (true iRacing / NutJs)**
|
||||
- The legacy real iRacing automation suite [`automation.e2e.test.ts`](tests/e2e/automation.e2e.test.ts:1) is treated as a smoke-only, opt-in layer.
|
||||
- It is gated by `RUN_REAL_AUTOMATION_SMOKE=1` and should not run in normal CI; it exists to validate that NutJs / template-based automation still matches the real UI for a small number of manual smoke runs on a prepared macOS environment.
|
||||
|
||||
#### Confidence expectations
|
||||
|
||||
- For **normal changes** to hosted-session automation (selectors, step logic, overlay behavior, authentication, or confirmation flows), the following suites must pass to claim "high confidence":
|
||||
- All relevant **unit tests** in `tests/unit` that touch the changed domain/use-case code.
|
||||
- All relevant **integration tests** in `tests/integration` for the affected adapters.
|
||||
- All **step E2E tests** under [`tests/e2e/steps`](tests/e2e/steps:1).
|
||||
- All **workflow E2E tests** under [`tests/e2e/workflows`](tests/e2e/workflows:1).
|
||||
|
||||
- The **real-world smoke suite** in [`tests/e2e/automation.e2e.test.ts`](tests/e2e/automation.e2e.test.ts:1) is an additional, manual confidence layer and should be run only on configured machines when validating large changes to NutJs automation, template packs, or iRacing UI assumptions.
|
||||
|
||||
- When adding new behavior:
|
||||
- Prefer **unit tests** for domain/application changes.
|
||||
- Add or extend **integration tests** when introducing new adapters or external integration.
|
||||
- Add **step E2E tests** when changing DOM/step behavior for a specific wizard step.
|
||||
- Add or extend **workflow E2E tests** when behavior spans multiple steps, touches authentication/session lifecycle, or affects confirmation/checkout behavior end-to-end.
|
||||
|
||||
By following BDD principles and maintaining clear test organization, the team can confidently evolve GridPilot while preserving correctness and stability, with a dedicated, layered confidence story for hosted-session automation.
|
||||
Reference in New Issue
Block a user