Files
gridpilot.gg/tests/e2e/sponsor

Sponsor BDD E2E Tests

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

Test Coverage

The sponsor functionality includes the following user journeys:

1. Sponsor Onboarding

  • sponsor-signup.spec.ts: Tests sponsor account creation and login
    • Landing page navigation
    • Account registration with company details
    • Login functionality
    • Form validation

2. Sponsor Dashboard

  • sponsor-dashboard.spec.ts: Tests the sponsor dashboard view
    • Dashboard overview and statistics
    • Navigation to different sponsor sections
    • Quick actions and metrics display

3. Sponsorship Campaigns

  • sponsor-campaigns.spec.ts: Tests sponsorship campaign management
    • Viewing active/pending/approved/rejected sponsorships
    • Filtering sponsorships by type
    • Searching sponsorships
    • Campaign statistics display

4. Billing & Payments

  • sponsor-billing.spec.ts: Tests billing and payment management
    • Viewing billing statistics
    • Managing payment methods
    • Downloading invoices
    • Viewing transaction history

5. Sponsor Settings

  • sponsor-settings.spec.ts: Tests sponsor account settings
    • Profile management (company info, contact details)
    • Notification preferences
    • Privacy settings
    • Account deletion

6. League Sponsorship Discovery

  • sponsor-leagues.spec.ts: Tests browsing and discovering leagues
    • Viewing available leagues for sponsorship
    • League statistics and metrics
    • Filtering and searching leagues
    • Viewing sponsorship opportunities

7. League Detail & Sponsorship

  • sponsor-league-detail.spec.ts: Tests detailed league view and sponsorship
    • Viewing league details
    • Understanding sponsorship slots
    • Sponsorship pricing information
    • League statistics

Testing Philosophy

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

  • Focus on outcomes: Tests validate final user outcomes, not visual implementation
  • Gherkin syntax: Use Given/When/Then comments to describe scenarios
  • User-centric: Tests describe what users can see and do
  • Placeholder structure: Each test file contains TODO comments indicating what needs to be implemented

Test Structure

Each test file follows this pattern:

import { test, expect } from '@playwright/test';

test.describe('Feature Name', () => {
  test.beforeEach(async ({ page }) => {
    // TODO: Implement authentication and navigation setup
  });

  test('User can perform action X', async ({ page }) => {
    // TODO: Implement test
    // Scenario: User performs action X
    // Given I am a registered sponsor
    // And I am on the "Page Name" page
    // When I perform action X
    // Then I should see outcome Y
  });
});

Running Tests

Run sponsor BDD tests:

npx playwright test tests/e2e/bdd/sponsor/

Run specific test file:

npx playwright test tests/e2e/bdd/sponsor/sponsor-signup.spec.ts