# Profile BDD E2E Tests

This directory contains BDD (Behavior-Driven Development) E2E tests for the GridPilot profile functionality.

## Test Coverage

### 1. Profile Main (`profile-main.spec.ts`)
Tests the main profile page where drivers can view and manage their profile.

**Scenarios:**
- Driver sees their profile information
- Driver can navigate to profile sub-pages
- Driver sees profile statistics and achievements
- Driver can view their avatar and personal details

### 2. Profile Leagues (`profile-leagues.spec.ts`)
Tests the profile leagues page where drivers can view their league memberships.

**Scenarios:**
- Driver sees list of leagues they are a member of
- Driver can view league details from their profile
- Driver can leave a league from their profile
- Driver sees league status and upcoming races

### 3. Profile Liveries (`profile-liveries.spec.ts`)
Tests the profile liveries page where drivers can manage their racing liveries.

**Scenarios:**
- Driver sees list of uploaded liveries
- Driver can view livery details and validation status
- Driver can navigate to livery upload page
- Driver sees livery preview and metadata

### 4. Profile Livery Upload (`profile-livery-upload.spec.ts`)
Tests the livery upload functionality for drivers.

**Scenarios:**
- Driver can upload a new livery
- Driver sees upload progress and validation
- Driver receives confirmation after successful upload
- Driver sees error messages for invalid uploads

### 5. Profile Settings (`profile-settings.spec.ts`)
Tests the profile settings page where drivers can update their personal information.

**Scenarios:**
- Driver can view their current profile settings
- Driver can update personal information
- Driver can save changes to their profile
- Driver sees validation errors for invalid input

### 6. Profile Sponsorship Requests (`profile-sponsorship-requests.spec.ts`)
Tests the sponsorship requests page where drivers can manage sponsorship opportunities.

**Scenarios:**
- Driver sees list of sponsorship requests
- Driver can accept sponsorship offers
- Driver can reject sponsorship offers
- Driver sees sponsorship details and terms

## Test Philosophy

These tests follow the BDD testing concept defined in `plans/bdd_testing_concept.md`:

1. **Focus on Outcomes**: Tests validate final user outcomes, not visual implementation.
2. **Gherkin Syntax**: Tests use Given/When/Then structure in comments.
3. **Acceptance Criteria**: Tests serve as the final source of truth for profile functionality.
4. **Playwright**: Tests use Playwright for E2E testing.

## Implementation Notes

- All test files are placeholders with TODO comments.
- Tests should be implemented using Playwright.
- Authentication setup should be shared across tests.
- Tests should validate final user outcomes, not implementation details.
- Tests should be independent and can run in any order.

## Directory Structure

```
tests/e2e/bdd/profile/
├── profile-main.spec.ts
├── profile-leagues.spec.ts
├── profile-liveries.spec.ts
├── profile-livery-upload.spec.ts
├── profile-settings.spec.ts
├── profile-sponsorship-requests.spec.ts
└── README.md
```
