# End-to-End (E2E) Test Plan

**Feature**: Anonymous Desire Aggregator
**Date**: 2025-10-09

This document outlines the manual test plan for verifying the end-to-end functionality of the application.

## Test Environment

- **Frontend**: `http://localhost:3000`
- **Backend**: `http://localhost:8000`
- **Browser**: Google Chrome (or any modern browser)
- **Tools**: Browser's Developer Tools (for inspecting Local Storage and network requests)

## Test Cases

### Test Case 1: Happy Path - Full Session Lifecycle

**Objective**: Verify a complete, successful session from creation to result display with multiple participants.

**Steps**:

1.  **Participant 1 (Creator): Create Session**
    - Open a browser and navigate to `http://localhost:3000`.
    - In the "Topic" field, enter "Team Lunch".
    - In the "Number of Participants" field, enter "3".
    - Click "Create Session".
    - **Expected**: The user is redirected to a new URL (e.g., `/session/some-uuid`). The session ID should be visible in the URL.
    - Copy the session URL.

2.  **Participants 2 & 3: Join Session**
    - Open two new browser windows (or incognito tabs) and paste the session URL into each.
    - **Expected**: All three browser windows should now show the "Waiting for 3 more participants..." message, which should update as each new participant joins.

3.  **All Participants: Submit Desires**
    - **Participant 1**:
        - Wants: "Pizza"
        - Accepts: "Sushi", "Salad"
        - No-Goes: "Burgers"
        - Click "Submit".
    - **Participant 2**:
        - Wants: "Sushi"
        - Accepts: "Pizza", "Tacos"
        - No-Goes: "Salad"
        - Click "Submit".
    - **Participant 3**:
        - Wants: "Pizza"
        - Accepts: "Tacos"
        - No-Goes: "Sushi"
        - Click "Submit".
    - **Expected**: As each participant submits, the "Waiting for..." message should update. After the final submission, the creator's view should show a button to "Analyze Desires".

4.  **Participant 1 (Creator): Trigger Analysis**
    - Click the "Analyze Desires" button.
    - **Expected**: A loading indicator should appear. After a few moments, all three browser windows should display the same results.

5.  **All Participants: Verify Results**
    - **Expected Results (example)**:
        - **Go-to**: "Pizza"
        - **Also good**: "Tacos"
        - **Considerable**: "Salad"
        - **No-goes**: "Burgers", "Sushi"
    - **Expected**: The "Considerable" section should be collapsed by default. Clicking it should expand to show the items.

### Test Case 2: Edge Case - Participant Leaves and Rejoins

**Objective**: Verify that the session state remains consistent if a participant disconnects and reconnects.

**Steps**:

1.  Follow steps 1 and 2 from Test Case 1.
2.  Close the browser window for Participant 2.
3.  Re-open the session URL in a new window for Participant 2.
4.  **Expected**: The session should still show 3 participants, and the "Waiting for..." message should be accurate. The session should proceed normally when all desires are submitted.

### Test Case 3: Error Condition - Invalid Session ID

**Objective**: Verify the application handles invalid session URLs gracefully.

**Steps**:

1.  Navigate to a non-existent session URL (e.g., `http://localhost:3000/session/invalid-uuid`).
2.  **Expected**: The user should be shown a "Session not found" error message and be redirected to the home page to create a new session.
