---
created_date:
updated_date:
executor:
status: Draft            # Draft | Ready | Implemented | Verified — execution lifecycle
artifact-status: draft   # draft | approved
feature_ids: # comma-separated list of Features chained in this scenario, or "XSTACK" for cross-stack
scenario_type: # single-stack | cross-stack
platform: # mobile | web | both
---

# E2E Scenario: {Scenario Name}

**Features**: [{Feature_ID_1}]({link1}) {{#if cross-stack}} + [{Feature_ID_2}]({link2}) {{/if}}
**Scenario Type**: {{scenario_type}} (single-stack | cross-stack)
**Platform**: {{platform}}
**Author**: @[executor]
**Created**: [created_date]
**Status**: [status] (Draft | Ready | Implemented | Verified)

---

## Scenario Naming Convention

### Single-Stack E2E
```
{PROJECT}_E2E_{NUMBER}_{MODIFIER}
```
Example: `AL_E2E_001_H` — full auth flow happy path (all Features in `web` stack)

### Cross-Stack E2E
```
{PROJECT}_XSTACK_E2E_{NUMBER}_{MODIFIER}
```
Example: `AL_XSTACK_E2E_001_H` — registration (web) → KYC service → first scan (app)

---

## Flow Overview

> Narrative description of the end-to-end user journey.
> This scenario tests {what} by simulating {user type} performing {complete flow}.

**User Persona**: {persona / role}
**Starting Point**: {Screen/Page where flow begins}
**End Point**: {Screen/Page where flow ends}
**Estimated Duration**: {X minutes}

---

## Scenario Steps

| Step | Screen/Page | Action | Expected Result | Builds on FT IDs | Priority |
|------|-------------|--------|-----------------|-------------------|----------|
| 1 | {Start Screen} | {User action} | {Expected outcome} | {PROJECT}_F{FEATURE}_AC1_FT_001_H | P0 |
| 2 | {Next Screen} | {User action} | {Expected outcome} | {PROJECT}_F{FEATURE}_AC1_FT_002_H | P0 |
| 3 | {Next Screen} | {User action} | {Expected outcome} | {PROJECT}_F{FEATURE}_AC2_FT_001_H | P0 |
| 4 | {Next Screen} | {User action} | {Expected outcome} | - (new step, no FT reference) | P1 |
| 5 | {End Screen} | {Verify final state} | {Final expected state} | {PROJECT}_F{FEATURE}_AC2_FT_003_H | P0 |

### Step Details

#### Step 1: {Action Title}
- **Screen**: {Screen name}
- **Preconditions**: {What must be true before this step}
- **Action**: {Detailed user action}
- **Expected Result**: {What should happen}
- **FT Reference**: Reuses logic from `{FT_ID}` in `features/{feature-slug}/helpers.ts`
- **Timeout**: {Expected max time for this step}

#### Step 2: {Action Title}
- **Screen**: {Screen name}
- **Preconditions**: Step 1 completed successfully
- **Action**: {Detailed user action}
- **Expected Result**: {What should happen}
- **FT Reference**: Reuses logic from `{FT_ID}`

_(Continue for each step)_

---

## Alternate Flows

### Alternate Flow 1: {Description}
> What happens when {condition} differs from the main flow

| Step | Diverges At | Action | Expected Result |
|------|-------------|--------|-----------------|
| 1a | Step {N} | {Alternative action} | {Different outcome} |
| 1b | Step {N+1} | {Continue} | {Rejoins main flow or ends} |

### Error Flow 1: {Description}
> What happens when {error condition}

| Step | Diverges At | Error Condition | Expected Recovery |
|------|-------------|-----------------|-------------------|
| E1 | Step {N} | {Error trigger} | {Error message + recovery} |

---

## Test Data (per Environment)

| Data Item | Dev | Staging | Prod (Smoke) | Notes |
|-----------|-----|---------|--------------|-------|
| User Email | {dev-email} | {stag-email} | {prod-email} | From test-data.{env}.json |
| User Password | (from .env) | (from .env) | (from .env) | NEVER hardcode |
| {Entity} ID | {dev-id} | {stag-id} | {prod-id} | Pre-seeded data |
| Base URL | {dev-url} | {stag-url} | {prod-url} | From test-data.{env}.json |

### Data Files
- `apps/{platform}/e2e/data/test-data.dev.json`
- `apps/{platform}/e2e/data/test-data.staging.json`
- `apps/{platform}/e2e/data/test-data.prod.json`

---

## Prerequisites

- [ ] User account exists in target environment
- [ ] Required test data seeded
- [ ] Backend services running and accessible
- [ ] External service stubs/mocks configured (if applicable)
- [ ] Device/browser configured and ready
- [ ] Environment variables set (.env)

---

## Success Criteria

- [ ] All main flow steps pass sequentially
- [ ] All alternate flows pass (if applicable)
- [ ] No screen transitions take > 3 seconds
- [ ] No crashes or unhandled exceptions
- [ ] No memory leaks detected during flow
- [ ] Flow completes within {X} minutes total
- [ ] Pass on target platforms:
  {{#if platform === "mobile"}}
  - [ ] iOS Simulator
  - [ ] Android Emulator
  {{/if}}
  {{#if platform === "web"}}
  - [ ] Chromium
  - [ ] Firefox
  - [ ] WebKit
  {{/if}}

---

## Script Generation

> This scenario will be used by `/tas-e2e-mobile` or `/tas-e2e-web` to generate executable scripts.

### Mobile Script Output
- **File**: `apps/mobile/e2e/flows/{scenario-slug}.e2e.ts`
- **Reuses**: Helper functions from `apps/mobile/e2e/features/{feature-slug}/helpers.ts`
- **Run**: `yarn e2e:flow:{scenario-slug}`

### Web Script Output
- **File**: `apps/web/e2e/flows/{scenario-slug}.spec.ts`
- **Reuses**: Page objects + helpers from `apps/web/e2e/features/{feature-slug}/`
- **Run**: `yarn e2e:flow:{scenario-slug}`

---

## FT Reuse Map

> Maps scenario steps to existing functional test helpers for code reuse

| Step | FT ID | Source File | Helper Function |
|------|-------|-------------|-----------------|
| 1 | {FT_ID_1} | `features/{feature-slug}/helpers.ts` | `{functionName}()` |
| 2 | {FT_ID_2} | `features/{feature-slug}/helpers.ts` | `{functionName}()` |
| 3 | - | (new logic) | N/A — write new code |

---

## Changelog

| Date | Changes | Author |
|------|---------|--------|
| [created_date] | Initial E2E scenario created | @[executor] |
