bb6be245b7
## Summary This PR implements the tournament schedule tab functionality and fixes all remaining E2E test failures. ### Changes Included 1. **Tournament Schedule Feature** - Added tournament schedule page at `/admin/tournaments/[id]/schedule` - Implemented "Generate Schedule" button functionality - Added schedule generation logic for round-robin tournaments 2. **E2E Test Fixes** - Fixed database connection issues in production builds - Improved test reliability with better error handling and debugging - Updated test infrastructure to use environment variables instead of hardcoded values 3. **CI/CD Updates** - Added E2E test job to PR workflow - Configured tests to run against development database - Moved database password to Gitea secrets 4. **Code Quality** - Removed hardcoded passwords from codebase - Improved Prisma client configuration - Enhanced authentication and navigation components ### Test Results All 16 E2E test scenarios are now passing: - Authentication tests: ✅ - Registration tests: ✅ - Tournament schedule tests: ✅ - Player schedule tests: ✅ - Admin navigation tests: ✅ ### Database Configuration - Tests run against `euchre_camp_dev` database - Production builds use environment variables for database configuration - Database password stored in Gitea secrets as `DB_PASSWORD` ### CI Pipeline The PR workflow now includes: 1. Unit tests 2. E2E tests (using production build) 3. Version bump analysis E2E tests must pass before PR can be merged. Reviewed-on: #27 Co-authored-by: David Gwilliam <dhgwilliam@gmail.com> Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
5.1 KiB
5.1 KiB
Gherkin-Style E2E Tests - Feature Summary
Overview
This directory contains Gherkin-style acceptance tests for the EuchreCamp application, written in Cucumber syntax and executed via Playwright.
Coverage Summary
Feature Files (6 files, 16 scenarios)
| Feature File | Issue | Scenarios | Status |
|---|---|---|---|
| authentication.feature | - | 5 | ✅ Complete |
| password-reset.feature | #10 | 4 | ⚠️ @wip (needs UI) |
| player-schedule.feature | #9 | 3 | ⚠️ @wip (needs data) |
| tournament-schedule.feature | #7 | 4 | ⚠️ @wip (needs data) |
| user-registration.feature | - | 3 | ✅ Complete |
| wordmark-navigation.feature | #24 | 3 | ✅ Complete |
Step Definitions
- Total steps defined: 75
- Common steps: Navigation, forms, assertions
- Auth steps: Registration, login, logout, schedule navigation
- All steps verified: ✅ Dry-run passes with no undefined steps
Issues Covered
Issue #24: Wordmark Navigation ✅
Scenario: Clicking EuchreCamp wordmark navigates to appropriate page
- Unauthenticated users → Public homepage
- Players → Their profile page
- Admins → Admin dashboard
Issue #10: Password Reset ⚠️
Scenarios:
- Access password reset page
- Request reset with valid email
- Request reset with invalid email
- Submit empty email field
Status: Marked @wip because password reset UI is not yet implemented
Issue #9: Player Schedule ⚠️
Scenarios:
- View empty schedule (no matches)
- View schedule with upcoming matches
- Navigate to match details
Status: Marked @wip because data setup requires tournament creation
Issue #7: Tournament Schedule Tab ⚠️
Scenarios:
- View schedule page for tournament
- Generate round-robin schedule
- View schedule with bye rounds
- Click matchup to enter results
Status: Marked @wip because data setup requires tournament creation
Running Tests
Command Line
# Run all Cucumber tests
bun run test:acceptance:cucumber
# Run with pretty output
bun run test:acceptance:cucumber:pretty
# Run specific feature
bun cucumber-js e2e/cucumber/features/user-registration.feature
# Dry run (verify all steps defined)
bun cucumber-js --config e2e/cucumber/cucumber.config.ts --dry-run
Tags
Filter tests by tag:
# Run only @happy-path tests
bun cucumber-js --tags "@happy-path"
# Skip @wip tests
bun cucumber-js --tags "not @wip"
# Run specific issue tests
bun cucumber-js --tags "@issue-24"
Feature Examples
Wordmark Navigation (Issue #24)
Scenario: Authenticated player clicks wordmark goes to their profile
Given I am logged in as a player
When I click the "EuchreCamp" wordmark
Then I should be redirected to my profile page
And I should see "Welcome"
User Registration
Scenario: Successful registration with valid data
Given I am on the registration page
When I fill in "name" with "Test User"
And I fill in "email" with "test@example.com"
And I fill in "password" with "TestPassword1234!"
And I click the "Create Account" button
Then I should be redirected to my profile page
And my user account should exist
Tournament Schedule (Issue #7)
Scenario: Tournament admin generates round-robin schedule
Given I am logged in as a tournament admin
And a tournament exists with 4 teams
When I go to the tournament schedule page
And I click the "Generate Schedule" button
Then I should see "Schedule generated successfully"
And I should see round 1 matchups
Key Principles
- Browser-only interactions - Tests interact with UI only, no database access
- Gherkin syntax - Plain English Given-When-Then format
- Happy path focus - Tests common user workflows
- Issue tracking - Each feature file linked to specific GitHub issues
- @wip markers - New/incomplete features marked for development
Next Steps
Immediate
- Run tests against dev server:
bun run test:acceptance:cucumber - Review @wip scenarios and implement missing UI
- Set up test data creation via API or fixtures
Short-term
-
Add more feature files for other issues:
- Issue #8: Tournament bracket visualization
- Issue #11: Club admin dashboard
- Issue #15: Admin view-as-user functionality
- Issue #22: Team configuration options
-
Add more step definitions for:
- Tournament creation
- Team management
- Match result entry
- Calendar view
Long-term
- Integrate with CI/CD pipeline
- Generate HTML reports
- Add visual regression testing
- Create test data factory for complex scenarios
Useful Commands
# List all feature files
ls e2e/cucumber/features/
# Count scenarios
grep -c "Scenario:" e2e/cucumber/features/*.feature
# List all step definitions
grep -r "Given\|When\|Then" e2e/cucumber/step-definitions/ | wc -l
# Check for @wip scenarios
grep -n "@wip" e2e/cucumber/features/*.feature