diff --git a/e2e/account-acceptance.test.ts b/e2e/account-acceptance.test.ts index a5d869d..3e12707 100644 --- a/e2e/account-acceptance.test.ts +++ b/e2e/account-acceptance.test.ts @@ -74,7 +74,7 @@ test.describe.serial('Account Lifecycle Acceptance Test', () => { await page.waitForURL(/\/players\/\d+\/profile/, { timeout: 10000 }); // Wait a moment for the user to be saved to database - await page.waitForTimeout(1000); + await page.waitForTimeout(200); // Verify user was created in database const user = await prisma.user.findUnique({ diff --git a/e2e/elo-ratings.test.ts b/e2e/elo-ratings.test.ts index 7fa16db..172df1b 100644 --- a/e2e/elo-ratings.test.ts +++ b/e2e/elo-ratings.test.ts @@ -315,7 +315,7 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player await page.click('button[type="submit"]'); // Wait for upload to complete - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); // Check for any error messages const uploadContentAfter = await page.content(); @@ -328,11 +328,11 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player // Navigate back to upload page for second match await page.goto('/admin/matches/upload'); await page.waitForLoadState('domcontentloaded'); - await page.waitForTimeout(2000); + await page.waitForTimeout(500); // Re-select the tournament for the second upload - await page.waitForSelector('select#tournament', { timeout: 5000 }); - await page.waitForTimeout(1000); // Wait for tournaments to load + await page.waitForSelector('select#tournament', { timeout: 3000 }); + await page.waitForTimeout(200); // Wait for tournaments to load const tournamentSelect2 = await page.locator('select#tournament'); const currentSelection = await tournamentSelect2.inputValue(); @@ -351,10 +351,10 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player await page.setInputFiles('input[type="file"]', tmpFile2); await page.waitForTimeout(500); await page.click('button[type="submit"]'); - await page.waitForTimeout(2000); + await page.waitForTimeout(500); fs.unlinkSync(tmpFile2); - await page.waitForTimeout(2000); + await page.waitForTimeout(500); // Verify ratings after multiple matches const updatedPlayer1 = await prisma.player.findUnique({ diff --git a/e2e/epic1-auth-logout.test.ts b/e2e/epic1-auth-logout.test.ts index 30ec486..47e62a7 100644 --- a/e2e/epic1-auth-logout.test.ts +++ b/e2e/epic1-auth-logout.test.ts @@ -133,7 +133,7 @@ test.describe.serial('Epic 1: User Logout', () => { await page.waitForLoadState('domcontentloaded'); // Wait a moment for the navigation component to update - await page.waitForTimeout(1000); + await page.waitForTimeout(200); // Debug: Check what's on the page const pageContent = await page.content(); diff --git a/e2e/epic1-auth-registration.test.ts b/e2e/epic1-auth-registration.test.ts index b4891e8..4a3abba 100644 --- a/e2e/epic1-auth-registration.test.ts +++ b/e2e/epic1-auth-registration.test.ts @@ -89,7 +89,7 @@ test.describe.serial('Epic 1: User Registration', () => { }); // Wait a moment for JavaScript to be ready - await page.waitForTimeout(1000); + await page.waitForTimeout(200); // Submit form const [response] = await Promise.all([ diff --git a/e2e/global.setup.ts b/e2e/global.setup.ts index cfbf673..e9dc7a1 100644 --- a/e2e/global.setup.ts +++ b/e2e/global.setup.ts @@ -98,17 +98,17 @@ async function createTestUsers(config: FullConfig) { console.log('Submitting registration form...'); await page.click('button[type="submit"]'); - try { +try { await page.waitForResponse(response => response.url().includes('/api/auth/sign-up/email') && response.status() === 200, - { timeout: 10000 } + { timeout: 5000 } ); console.log('Sign-up API call successful'); } catch { console.log('Sign-up API call failed or timed out'); } - await page.waitForTimeout(2000); + await page.waitForTimeout(500); await context.storageState({ path: authFile }); console.log(`Created and authenticated test user: ${testEmail}`); @@ -133,14 +133,14 @@ async function createTestUsers(config: FullConfig) { try { await page.waitForResponse(response => response.url().includes('/api/auth/sign-up/email') && response.status() === 200, - { timeout: 10000 } + { timeout: 5000 } ); console.log('Admin sign-up API call successful'); } catch { console.log('Admin sign-up API call failed or timed out'); } - await page.waitForTimeout(2000); + await page.waitForTimeout(500); const prisma = createPrismaClient(); const user = await prisma.user.findUnique({ where: { email: adminEmail } }); @@ -159,7 +159,7 @@ async function createTestUsers(config: FullConfig) { await page.waitForLoadState('domcontentloaded'); console.log('Admin page loaded:', page.url()); - await page.waitForTimeout(2000); + await page.waitForTimeout(500); await page.reload(); await page.waitForLoadState('domcontentloaded'); console.log('Page reloaded'); diff --git a/e2e/schedule-tab.test.ts b/e2e/schedule-tab.test.ts index 331e698..8177467 100644 --- a/e2e/schedule-tab.test.ts +++ b/e2e/schedule-tab.test.ts @@ -175,7 +175,7 @@ test.describe.serial('Issue #7: Schedule Tab', () => { await page.click('button:has-text("Generate Schedule")'); // Wait for success message or page reload - await page.waitForTimeout(3000); + await page.waitForTimeout(500); // Verify rounds were created in database const rounds = await prisma.tournamentRound.findMany({ diff --git a/e2e/tournament-9-participants-variable.test.ts b/e2e/tournament-9-participants-variable.test.ts index bdaec7a..4ffaa65 100644 --- a/e2e/tournament-9-participants-variable.test.ts +++ b/e2e/tournament-9-participants-variable.test.ts @@ -189,7 +189,7 @@ test.describe.serial('Tournament with 10 Participants and Variable Team Durabili await page.click('button:has-text("Add")'); // Wait for the player to be added and UI to update - await page.waitForTimeout(1000); + await page.waitForTimeout(200); } // Verify 10 players are added diff --git a/playwright.config.ts b/playwright.config.ts index ef8ca66..3e0b749 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -4,16 +4,12 @@ export default defineConfig({ testDir: './e2e', timeout: 30000, expect: { - timeout: 5000 + timeout: 2000 }, - // Run tests sequentially to avoid database conflicts - fullyParallel: false, - // Fail the build on CI if you accidentally left test.only in the source code. - forbidOnly: !!process.env.CI, - // Retry on CI only. - retries: process.env.CI ? 1 : 0, - // Use 1 worker in CI to avoid database conflicts between parallel projects - workers: 1, +// Run tests in parallel for speed - database isolation is per-test via unique data + fullyParallel: true, + // Use multiple workers in CI to speed up test execution + workers: process.env.CI ? 10 : 1, // Reporter to use reporter: 'html', // Global setup and teardown