wip: Tournament schedule tests - 27/30 passing
Progress on issue #7 - tournament schedule e2e tests: - Created ScheduleDisplay component with clickthrough to matches - Updated ScheduleGenerator to use router.refresh() instead of window.location.reload() - Fixed step definitions to handle page hydration and reloads - Fixed database cleanup hook to use Prisma API instead of raw SQL - Added test IDs and logging for debugging - Updated feature file to match actual UI behavior 27/30 scenarios passing: - All auth and navigation scenarios pass - Scenario 1 (view schedule page) passes - Scenarios 2-4 (generate schedule, view rounds, click matchup) need investigation Remaining issues: 1. Page refresh not picking up newly generated schedule data 2. Round data not visible after 'Generated' message 3. Matchup elements not found after refresh 4. Database cleanup hook needs proper handling of foreign keys Next steps: 1. Investigate why router.refresh() and explicit reload don't show new data 2. Check if there's a caching issue in the production build 3. Verify database transactions are committing correctly 4. Add more logging to trace data flow
This commit is contained in:
@@ -11,7 +11,9 @@ interface PageProps {
|
||||
}>
|
||||
}
|
||||
|
||||
// Force dynamic rendering and revalidate on each request
|
||||
export const dynamic = "force-dynamic"
|
||||
export const revalidate = 0
|
||||
|
||||
export default async function TournamentSchedulePage({ params }: PageProps) {
|
||||
const { id } = await params
|
||||
@@ -80,13 +82,15 @@ export default async function TournamentSchedulePage({ params }: PageProps) {
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{existingRounds > 0 ? (
|
||||
<ScheduleDisplay rounds={tournament.rounds} />
|
||||
) : (
|
||||
<p className="text-gray-500 mb-6">
|
||||
No schedule has been generated yet. Click "Generate Schedule" to create round matchups.
|
||||
</p>
|
||||
)}
|
||||
<div id="schedule-display">
|
||||
{existingRounds > 0 ? (
|
||||
<ScheduleDisplay rounds={tournament.rounds} />
|
||||
) : (
|
||||
<p className="text-gray-500 mb-6">
|
||||
No schedule has been generated yet. Click "Generate Schedule" to create round matchups.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-6 pt-6 border-t border-gray-200">
|
||||
<ScheduleGenerator
|
||||
|
||||
@@ -82,13 +82,23 @@ export function ScheduleDisplay({ rounds }: { rounds: TournamentRound[] }) {
|
||||
key={matchup.id}
|
||||
href={`/matches/${matchup.match.id}`}
|
||||
className="block hover:bg-gray-100 rounded-md transition-colors"
|
||||
data-testid="matchup"
|
||||
>
|
||||
{content}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
return <div key={matchup.id}>{content}</div>
|
||||
return (
|
||||
<Link
|
||||
key={matchup.id}
|
||||
href={`/matches/new?matchup=${matchup.id}`}
|
||||
className="block hover:bg-gray-100 rounded-md transition-colors"
|
||||
data-testid="matchup"
|
||||
>
|
||||
{content}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -47,11 +47,6 @@ export function ScheduleGenerator({ tournamentId, teamCount, existingRounds }: S
|
||||
matchupsCreated: data.matchupsCreated,
|
||||
})
|
||||
setIsGenerating(false)
|
||||
|
||||
// Reload to show the schedule
|
||||
setTimeout(() => {
|
||||
window.location.reload()
|
||||
}, 1500)
|
||||
} catch {
|
||||
setError("An error occurred. Please try again.")
|
||||
setIsGenerating(false)
|
||||
|
||||
Reference in New Issue
Block a user