feat: Implement tournament schedule tab and fix E2E tests (#27)
Release / release (push) Failing after 9s
Build CI Images / build-ci-base (push) Failing after 18s

## 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>
This commit was merged in pull request #27.
This commit is contained in:
2026-04-27 01:59:16 +00:00
committed by david
parent 75358bf20d
commit bb6be245b7
97 changed files with 7950 additions and 1341 deletions
+26 -24
View File
@@ -64,17 +64,17 @@ export default async function PlayerProfilePage({ params }: PageProps) {
const recentMatches = await prisma.match.findMany({
where: {
OR: [
{ team1P1Id: playerId },
{ team1P2Id: playerId },
{ team2P1Id: playerId },
{ team2P2Id: playerId },
{ player1P1Id: playerId },
{ player1P2Id: playerId },
{ player2P1Id: playerId },
{ player2P2Id: playerId },
],
},
include: {
team1P1: true,
team1P2: true,
team2P1: true,
team2P2: true,
player1P1: true,
player1P2: true,
player2P1: true,
player2P2: true,
event: true,
},
orderBy: { playedAt: "desc" },
@@ -104,12 +104,12 @@ export default async function PlayerProfilePage({ params }: PageProps) {
<div className="px-4 py-6 sm:px-0">
{/* Player Header */}
<div className="bg-white shadow rounded-lg p-6 mb-6">
<h1 className="text-3xl font-bold text-gray-900 mb-2">Welcome, {player.name}</h1>
<div className="flex items-center">
<div className="h-20 w-20 bg-green-100 rounded-full flex items-center justify-center text-green-800 text-2xl font-bold">
{player.name.charAt(0).toUpperCase()}
</div>
<div className="ml-6">
<h1 className="text-2xl font-bold text-gray-900">{player.name}</h1>
<p className="text-gray-500">
Member since {new Date(player.createdAt).toLocaleDateString()}
</p>
@@ -247,18 +247,18 @@ export default async function PlayerProfilePage({ params }: PageProps) {
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{recentMatches.map((match) => {
const isTeam1 = match.team1P1Id === playerId || match.team1P2Id === playerId;
const isTeam1 = match.player1P1Id === playerId || match.player1P2Id === playerId;
const teamWon = isTeam1 ? match.team1Score > match.team2Score : match.team2Score > match.team1Score;
const teamScore = isTeam1 ? match.team1Score : match.team2Score;
const opponentScore = isTeam1 ? match.team2Score : match.team1Score;
const teammate = isTeam1
? (match.team1P1Id === playerId ? match.team1P2 : match.team1P1)
: (match.team2P1Id === playerId ? match.team2P2 : match.team2P1);
? (match.player1P1Id === playerId ? match.player1P2 : match.player1P1)
: (match.player2P1Id === playerId ? match.player2P2 : match.player2P1);
const opponents = isTeam1
? [match.team2P1, match.team2P2]
: [match.team1P1, match.team1P2];
? [match.player2P1, match.player2P2]
: [match.player1P1, match.player1P2];
return (
<tr key={match.id} className="hover:bg-gray-50">
@@ -276,21 +276,23 @@ export default async function PlayerProfilePage({ params }: PageProps) {
{match.event?.name || "N/A"}
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<Link
href={`/players/${teammate.id}/profile`}
className="text-green-600 hover:text-green-900"
>
{teammate.name}
</Link>
{teammate && (
<Link
href={`/players/${teammate.id}/profile`}
className="text-green-600 hover:text-green-900"
>
{teammate.name}
</Link>
)}
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{opponents.map((opponent, index) => (
<span key={opponent.id}>
{opponents.filter(o => o !== null).map((opponent, index) => (
<span key={opponent?.id}>
<Link
href={`/players/${opponent.id}/profile`}
href={`/players/${opponent?.id}/profile`}
className="text-green-600 hover:text-green-900"
>
{opponent.name}
{opponent?.name}
</Link>
{index < opponents.length - 1 ? ", " : ""}
</span>
+28 -34
View File
@@ -27,10 +27,10 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
where: { playedAt: { gte: new Date() } },
include: {
event: true,
team1P1: true,
team1P2: true,
team2P1: true,
team2P2: true,
player1P1: true,
player1P2: true,
player2P1: true,
player2P2: true,
},
orderBy: { playedAt: "asc" },
},
@@ -38,10 +38,10 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
where: { playedAt: { gte: new Date() } },
include: {
event: true,
team1P1: true,
team1P2: true,
team2P1: true,
team2P2: true,
player1P1: true,
player1P2: true,
player2P1: true,
player2P2: true,
},
orderBy: { playedAt: "asc" },
},
@@ -49,10 +49,10 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
where: { playedAt: { gte: new Date() } },
include: {
event: true,
team1P1: true,
team1P2: true,
team2P1: true,
team2P2: true,
player1P1: true,
player1P2: true,
player2P1: true,
player2P2: true,
},
orderBy: { playedAt: "asc" },
},
@@ -60,10 +60,10 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
where: { playedAt: { gte: new Date() } },
include: {
event: true,
team1P1: true,
team1P2: true,
team2P1: true,
team2P2: true,
player1P1: true,
player1P2: true,
player2P1: true,
player2P2: true,
},
orderBy: { playedAt: "asc" },
},
@@ -94,12 +94,6 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
},
include: {
participants: true,
teams: {
include: {
player1: true,
player2: true,
},
},
},
})
@@ -120,18 +114,18 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
</h2>
{upcomingMatches.length === 0 ? (
<p className="text-gray-500">No upcoming matches scheduled.</p>
<p className="text-gray-500">No upcoming matches</p>
) : (
<div className="space-y-4">
{upcomingMatches.map((match) => {
const team1Players = [
match.team1P1.name,
match.team1P2.name,
].join(" + ")
match.player1P1?.name,
match.player1P2?.name,
].filter(Boolean).join(" + ")
const team2Players = [
match.team2P1.name,
match.team2P2.name,
].join(" + ")
match.player2P1?.name,
match.player2P2?.name,
].filter(Boolean).join(" + ")
return (
<div
@@ -171,9 +165,9 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
) : (
<div className="space-y-4">
{activeTournaments.map((tournament) => {
const playerTeam = tournament.teams.find(
(team) =>
team.player1Id === playerId || team.player2Id === playerId
// Since teams are now ephemeral, just check if player is a participant
const isParticipant = tournament.participants.some(
(p) => p.playerId === playerId
)
return (
@@ -192,9 +186,9 @@ export default async function PlayerSchedulePage({ params }: PageProps) {
<p className="text-sm text-gray-500">
{tournament.format} - {tournament.status}
</p>
{playerTeam && (
{isParticipant && (
<p className="text-sm text-gray-600">
Team: {playerTeam.player1.name} + {playerTeam.player2.name}
Participant in tournament
</p>
)}
</div>