# Lifecycle Integration Test Plan

## Coverage Goals

- Exercise end-to-end creation, update, and deletion flows for projects through both API endpoints and HTML form submissions to ensure consistency across interfaces.
- Validate scenario lifecycle interactions (create, update, archive) including business rule enforcement and status transitions when performed via API and UI routes.
- Confirm that redirect chains and rendered templates match expected destinations after each lifecycle operation.
- Verify repository-backed statistics (counts, recency metadata) update appropriately after lifecycle actions to maintain dashboard accuracy.
- Guard against regressions in unit-of-work transaction handling by asserting database state after success and failure paths within integration flows.

## Happy-Path Journeys

1. **Project Management Flow**

   - Navigate to the project list UI and confirm empty-state messaging.
   - Submit the new project form with valid data and verify redirect to the list page with the project present.
   - Perform an API-based update to adjust project metadata and check the UI detail view reflects changes.
   - Delete the project through the API and ensure the list UI reverts to the empty state.

2. **Scenario Lifecycle Flow**

   - From an existing project, create a new scenario via the API and verify the project detail page renders the scenario entry.
   - Update the scenario through the UI form, ensuring redirect to the scenario detail view with updated fields.
   - Trigger a validation rule (e.g., duplicate scenario name within a project) to confirm error messaging without data loss.
   - Archive the scenario using the API and confirm status badges and scenario counts update across dashboard and project detail views.

3. **Dashboard Consistency Flow**
   - Seed multiple projects and scenarios through combined API/UI interactions.
   - Visit the dashboard and ensure metric cards reflect the latest counts, active/draft status breakdowns, and recent activity timestamps after each mutation.
   - Run the lifecycle flows sequentially to confirm cumulative effects propagate to dashboard summaries and navigation badges.
