diff --git a/e2e/cucumber/features/tournament-schedule.feature b/e2e/cucumber/features/tournament-schedule.feature index e5adf0c..3f5fb6b 100644 --- a/e2e/cucumber/features/tournament-schedule.feature +++ b/e2e/cucumber/features/tournament-schedule.feature @@ -19,20 +19,16 @@ Feature: Tournament Schedule And I click the "Generate Schedule" button Then I should see "Generated" And I should see "rounds with" - # Navigate away and back to verify schedule persisted (avoids HMR caching issues) - When I go to the tournament schedule page Then I should see round 1 matchups And I should see round 2 matchups - @happy-path @tournament @issue-7 @wip + @happy-path @tournament @issue-7 Scenario: Tournament admin views schedule with bye rounds Given I am logged in as a tournament admin And a tournament exists with 5 teams When I go to the tournament schedule page And I click the "Generate Schedule" button Then I should see "Generated" - # Navigate away and back to verify schedule persisted - When I go to the tournament schedule page Then I should see 5 rounds And each team should play every other team exactly once @@ -43,7 +39,5 @@ Feature: Tournament Schedule When I go to the tournament schedule page And I click the "Generate Schedule" button Then I should see "Generated" - # Navigate away and back to ensure schedule data is loaded - When I go to the tournament schedule page And I click on a matchup Then I should be on the match result entry page diff --git a/e2e/cucumber/step-definitions/auth-steps.ts b/e2e/cucumber/step-definitions/auth-steps.ts index b19bdf7..23454b4 100644 --- a/e2e/cucumber/step-definitions/auth-steps.ts +++ b/e2e/cucumber/step-definitions/auth-steps.ts @@ -564,11 +564,11 @@ Given('a tournament exists with {int} teams', async function (teamCount: number) When('I go to the tournament schedule page', async function () { console.log('🌍 Going to tournament schedule page'); const tournamentId = world.tournament?.id || 1; - // Add cache-busting timestamp to force fresh data const url = `${world.baseURL}/admin/tournaments/${tournamentId}/schedule?t=${Date.now()}`; await world.page.goto(url); await world.page.waitForLoadState('networkidle'); - await world.page.waitForTimeout(1000); + // Wait for ScheduleDisplay client component to hydrate + await world.page.waitForTimeout(2000); }); Given('a tournament has a generated schedule', async function () { diff --git a/e2e/cucumber/step-definitions/common-steps.ts b/e2e/cucumber/step-definitions/common-steps.ts index 2294c0a..2a5d6fa 100644 --- a/e2e/cucumber/step-definitions/common-steps.ts +++ b/e2e/cucumber/step-definitions/common-steps.ts @@ -647,17 +647,14 @@ Then('I should be on the match detail page', async function () { // Tournament Schedule Steps Then('I should see round {int} matchups', async function (roundNumber: number) { const roundText = `Round ${roundNumber}`; - await world.page.waitForTimeout(2000); - const content = await world.page.content(); - console.log(`🌍 Page URL: ${world.page.url()}`); - console.log(`🌍 Page has "Round ${roundNumber}": ${content.includes(`Round ${roundNumber}`)}`); - console.log(`🌍 Page has "Generated": ${content.includes('Generated')}`); - - await expect(world.page.locator(`text=${roundText}`)).toBeVisible({ timeout: 10000 }); + const roundHeader = world.page.locator(`h3:has-text("${roundText}")`); + await expect(roundHeader).toBeVisible({ timeout: 30000 }); console.log(`🌍 Verified round ${roundNumber} matchups are visible`); }); Then('I should see {int} rounds', async function (expectedRounds: number) { + await world.page.waitForLoadState('networkidle'); + await world.page.waitForTimeout(2000); const roundHeaders = await world.page.locator('h3:has-text("Round")').count(); expect(roundHeaders).toBe(expectedRounds); console.log(`🌍 Verified ${expectedRounds} rounds are visible`);