diff --git a/e2e/cucumber/features/tournament-schedule.feature b/e2e/cucumber/features/tournament-schedule.feature index cefaaff..8023f2a 100644 --- a/e2e/cucumber/features/tournament-schedule.feature +++ b/e2e/cucumber/features/tournament-schedule.feature @@ -19,7 +19,8 @@ Feature: Tournament Schedule And I click the "Generate Schedule" button Then I should see "Generated" And I should see "rounds with" - When I refresh the page + # 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 @@ -30,7 +31,8 @@ Feature: Tournament Schedule When I go to the tournament schedule page And I click the "Generate Schedule" button Then I should see "Generated" - When I refresh the page + # 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 @@ -41,6 +43,7 @@ Feature: Tournament Schedule When I go to the tournament schedule page And I click the "Generate Schedule" button Then I should see "Generated" - When I refresh the page + # 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 7764c06..e9339dd 100644 --- a/e2e/cucumber/step-definitions/auth-steps.ts +++ b/e2e/cucumber/step-definitions/auth-steps.ts @@ -396,8 +396,10 @@ Given('a tournament exists with {int} teams', async function (teamCount: number) }, }); - // Create players and add them as participants - for (let i = 1; i <= teamCount; i++) { + // Euchre is 2v2, so each team has 2 players + // Create teamCount * 2 players and add them as participants + const playerCount = teamCount * 2; + for (let i = 1; i <= playerCount; i++) { const player = await prisma.player.create({ data: { name: `Tournament Player ${i} ${timestamp}`, @@ -420,7 +422,7 @@ Given('a tournament exists with {int} teams', async function (teamCount: number) world.tournament = tournament; world.tournamentTeamCount = teamCount; - console.log(`🌍 Created tournament: ${tournament.name} (ID: ${tournament.id}) with ${teamCount} teams`); + console.log(`🌍 Created tournament: ${tournament.name} (ID: ${tournament.id}) with ${playerCount} players (${teamCount} teams)`); }); When('I go to the tournament schedule page', async function () { diff --git a/e2e/cucumber/step-definitions/common-steps.ts b/e2e/cucumber/step-definitions/common-steps.ts index c10d7e9..bfcd5ad 100644 --- a/e2e/cucumber/step-definitions/common-steps.ts +++ b/e2e/cucumber/step-definitions/common-steps.ts @@ -635,12 +635,20 @@ Then('each team should play every other team exactly once', async function () { }); When('I click on a matchup', async function () { - // Wait for the matchup elements to be visible after potential page reload const matchup = world.page.locator('[data-testid="matchup"]').first(); await matchup.waitFor({ state: 'visible', timeout: 15000 }); - await matchup.click(); + + const href = await matchup.getAttribute('href'); + console.log(`🌍 Matchup link href: ${href}`); + + // Use goto instead of click for more reliable navigation in tests + if (href) { + await world.page.goto(`${world.baseURL}${href}`); + } else { + await matchup.click(); + } await world.page.waitForLoadState('domcontentloaded'); - console.log('🌍 Clicked on matchup'); + console.log(`🌍 Navigated to: ${world.page.url()}`); }); Then('I should be on the match result entry page', async function () { diff --git a/src/app/admin/tournaments/[id]/schedule/page.tsx b/src/app/admin/tournaments/[id]/schedule/page.tsx index 77482dc..2c0821b 100644 --- a/src/app/admin/tournaments/[id]/schedule/page.tsx +++ b/src/app/admin/tournaments/[id]/schedule/page.tsx @@ -89,7 +89,7 @@ export default async function TournamentSchedulePage({ params }: PageProps) {
No schedule has been generated yet. Click "Generate Schedule" to create round matchups. diff --git a/src/components/ScheduleDisplay.tsx b/src/components/ScheduleDisplay.tsx index 93f1ac2..843fd2c 100644 --- a/src/components/ScheduleDisplay.tsx +++ b/src/components/ScheduleDisplay.tsx @@ -25,74 +25,56 @@ interface TournamentRound { bracketMatchups: BracketMatchup[] } -export function ScheduleDisplay({ rounds }: { rounds: TournamentRound[] }) { +interface ScheduleDisplayProps { + rounds: TournamentRound[] + tournamentId: number +} + +export function ScheduleDisplay({ rounds, tournamentId }: ScheduleDisplayProps) { return (
+ Match {matchup.bracketPosition || matchup.id} +
++ {matchup.player1P1?.name || 'TBD'} & {matchup.player1P2?.name || 'TBD'} +
+vs
++ {matchup.player2P1?.name || 'TBD'} & {matchup.player2P2?.name || 'TBD'} +
+