fix: replace waitForLoadState('networkidle') with domcontentloaded in all E2E tests
Release / release (push) Failing after 10s
Release / release (push) Failing after 10s
This commit is contained in:
@@ -56,7 +56,7 @@ test.describe.serial('Account Lifecycle Acceptance Test', () => {
|
|||||||
await page.goto('/auth/register');
|
await page.goto('/auth/register');
|
||||||
|
|
||||||
// Wait for JavaScript to be ready
|
// Wait for JavaScript to be ready
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait for the form to be visible and the submit button to be enabled
|
// Wait for the form to be visible and the submit button to be enabled
|
||||||
await page.waitForSelector('form');
|
await page.waitForSelector('form');
|
||||||
@@ -105,7 +105,7 @@ test.describe.serial('Account Lifecycle Acceptance Test', () => {
|
|||||||
|
|
||||||
// Reload to ensure session is loaded from cookies
|
// Reload to ensure session is loaded from cookies
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait for logout button to appear
|
// Wait for logout button to appear
|
||||||
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ When('I register with valid credentials', async function () {
|
|||||||
world.user = credentials;
|
world.user = credentials;
|
||||||
|
|
||||||
await world.page.goto(`${world.baseURL}/auth/register`);
|
await world.page.goto(`${world.baseURL}/auth/register`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
await world.page.fill('input[name="name"]', credentials.name);
|
await world.page.fill('input[name="name"]', credentials.name);
|
||||||
await world.page.fill('input[name="email"]', credentials.email);
|
await world.page.fill('input[name="email"]', credentials.email);
|
||||||
@@ -194,7 +194,7 @@ When('I register with duplicate email', async function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await world.page.goto(`${world.baseURL}/auth/register`);
|
await world.page.goto(`${world.baseURL}/auth/register`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
await world.page.fill('input[name="name"]', world.user.name);
|
await world.page.fill('input[name="name"]', world.user.name);
|
||||||
await world.page.fill('input[name="email"]', world.user.email);
|
await world.page.fill('input[name="email"]', world.user.email);
|
||||||
@@ -220,7 +220,7 @@ When('I register with weak password', async function () {
|
|||||||
credentials.password = 'weak'; // Too short
|
credentials.password = 'weak'; // Too short
|
||||||
|
|
||||||
await world.page.goto(`${world.baseURL}/auth/register`);
|
await world.page.goto(`${world.baseURL}/auth/register`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
await world.page.fill('input[name="name"]', credentials.name);
|
await world.page.fill('input[name="name"]', credentials.name);
|
||||||
await world.page.fill('input[name="email"]', credentials.email);
|
await world.page.fill('input[name="email"]', credentials.email);
|
||||||
@@ -240,7 +240,7 @@ When('I log in with valid credentials', async function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await world.page.goto(`${world.baseURL}/auth/login`);
|
await world.page.goto(`${world.baseURL}/auth/login`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
await world.page.fill('input[name="email"]', world.user.email);
|
await world.page.fill('input[name="email"]', world.user.email);
|
||||||
await world.page.fill('input[name="password"]', world.user.password);
|
await world.page.fill('input[name="password"]', world.user.password);
|
||||||
@@ -252,7 +252,7 @@ When('I log in with valid credentials', async function () {
|
|||||||
|
|
||||||
When('I log in with invalid credentials', async function () {
|
When('I log in with invalid credentials', async function () {
|
||||||
await world.page.goto(`${world.baseURL}/auth/login`);
|
await world.page.goto(`${world.baseURL}/auth/login`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
await world.page.fill('input[name="email"]', 'nonexistent@example.com');
|
await world.page.fill('input[name="email"]', 'nonexistent@example.com');
|
||||||
await world.page.fill('input[name="password"]', 'wrongpassword');
|
await world.page.fill('input[name="password"]', 'wrongpassword');
|
||||||
@@ -384,7 +384,7 @@ When('I go to the tournament schedule page', async function () {
|
|||||||
console.log('🌍 Going to tournament schedule page');
|
console.log('🌍 Going to tournament schedule page');
|
||||||
const tournamentId = world.tournament?.id || 1;
|
const tournamentId = world.tournament?.id || 1;
|
||||||
await world.page.goto(`${world.baseURL}/admin/tournaments/${tournamentId}/schedule`);
|
await world.page.goto(`${world.baseURL}/admin/tournaments/${tournamentId}/schedule`);
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
Given('a tournament has a generated schedule', async function () {
|
Given('a tournament has a generated schedule', async function () {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ When('I click the {string} button', async function (buttonText: string) {
|
|||||||
console.log(`🌍 URL did not change immediately after click`);
|
console.log(`🌍 URL did not change immediately after click`);
|
||||||
// Wait for potential network activity to settle
|
// Wait for potential network activity to settle
|
||||||
try {
|
try {
|
||||||
await world.page.waitForLoadState('networkidle', { timeout: 3000 });
|
await world.page.waitForLoadState('domcontentloaded', { timeout: 3000 });
|
||||||
} catch {
|
} catch {
|
||||||
console.log(`🌍 Network idle not reached, continuing anyway`);
|
console.log(`🌍 Network idle not reached, continuing anyway`);
|
||||||
}
|
}
|
||||||
@@ -405,7 +405,7 @@ Then('I should see the {string} button', async function (buttonText: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Then('I should be redirected to {string}', async function (path: string) {
|
Then('I should be redirected to {string}', async function (path: string) {
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
const currentUrl = world.page.url();
|
const currentUrl = world.page.url();
|
||||||
|
|
||||||
console.log(`🌍 Checking redirect to: ${path}`);
|
console.log(`🌍 Checking redirect to: ${path}`);
|
||||||
@@ -436,7 +436,7 @@ When('I wait for {int} seconds', async function (seconds: number) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
When('I wait for the page to load', async function () {
|
When('I wait for the page to load', async function () {
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -449,7 +449,7 @@ Then('the URL should contain {string}', async function (expectedPath: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Then('I should be redirected to the login page', async function () {
|
Then('I should be redirected to the login page', async function () {
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('domcontentloaded');
|
||||||
const currentUrl = world.page.url();
|
const currentUrl = world.page.url();
|
||||||
|
|
||||||
console.log(`🌍 Checking redirect to login page. Current URL: ${currentUrl}`);
|
console.log(`🌍 Checking redirect to login page. Current URL: ${currentUrl}`);
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ test.describe('Elo Rating Updates', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await page.goto('/admin');
|
await page.goto('/admin');
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Check if we're logged in
|
// Check if we're logged in
|
||||||
const content = await page.content();
|
const content = await page.content();
|
||||||
@@ -211,19 +211,19 @@ test.describe('Elo Rating Updates', () => {
|
|||||||
console.log('Logging out and logging in as admin...');
|
console.log('Logging out and logging in as admin...');
|
||||||
await page.click('button:has-text("Sign out")');
|
await page.click('button:has-text("Sign out")');
|
||||||
await page.waitForURL('/auth/login');
|
await page.waitForURL('/auth/login');
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoggedIn || page.url().includes('/players/')) {
|
if (!isLoggedIn || page.url().includes('/players/')) {
|
||||||
// If not logged in or logged in as regular user, log in as admin
|
// If not logged in or logged in as regular user, log in as admin
|
||||||
console.log('Logging in as admin...');
|
console.log('Logging in as admin...');
|
||||||
await page.goto('/auth/login');
|
await page.goto('/auth/login');
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
await page.fill('input[name="email"]', adminEmail);
|
await page.fill('input[name="email"]', adminEmail);
|
||||||
await page.fill('input[name="password"]', adminPassword);
|
await page.fill('input[name="password"]', adminPassword);
|
||||||
await page.click('button[type="submit"]');
|
await page.click('button[type="submit"]');
|
||||||
await page.waitForURL(/\/(admin|players)/, { timeout: 10000 });
|
await page.waitForURL(/\/(admin|players)/, { timeout: 10000 });
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify tournament ownership
|
// Verify tournament ownership
|
||||||
@@ -238,7 +238,7 @@ test.describe('Elo Rating Updates', () => {
|
|||||||
await page.goto('/admin/matches/upload');
|
await page.goto('/admin/matches/upload');
|
||||||
|
|
||||||
// Wait for page to load and tournaments to be fetched
|
// Wait for page to load and tournaments to be fetched
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
// Wait for tournament dropdown to be ready
|
// Wait for tournament dropdown to be ready
|
||||||
@@ -313,7 +313,7 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player
|
|||||||
|
|
||||||
// Navigate back to upload page for second match
|
// Navigate back to upload page for second match
|
||||||
await page.goto('/admin/matches/upload');
|
await page.goto('/admin/matches/upload');
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
// Re-select the tournament for the second upload
|
// Re-select the tournament for the second upload
|
||||||
@@ -384,7 +384,7 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player
|
|||||||
await page.goto(`/players/${player.id}/profile`);
|
await page.goto(`/players/${player.id}/profile`);
|
||||||
|
|
||||||
// Wait for page to load
|
// Wait for page to load
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Verify rating is displayed (from player.currentElo)
|
// Verify rating is displayed (from player.currentElo)
|
||||||
await expect(page.locator('text=1750')).toBeVisible();
|
await expect(page.locator('text=1750')).toBeVisible();
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ test.describe.serial('Epic 1: User Logout', () => {
|
|||||||
|
|
||||||
test('Logout button appears in navigation when logged in', async ({ page }) => {
|
test('Logout button appears in navigation when logged in', async ({ page }) => {
|
||||||
// Login first
|
// Login first
|
||||||
await page.goto('http://localhost:3000/auth/login');
|
await page.goto('http://localhost:3000/auth/login');
|
||||||
|
|
||||||
// Wait for JavaScript to be ready
|
// Wait for page to load
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
await page.waitForSelector('form');
|
await page.waitForSelector('form');
|
||||||
await page.waitForSelector('button[type="submit"]:not([disabled])');
|
await page.waitForSelector('button[type="submit"]:not([disabled])');
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ test.describe.serial('Epic 1: User Logout', () => {
|
|||||||
// Navigate to home page to check navigation (session should persist)
|
// Navigate to home page to check navigation (session should persist)
|
||||||
// Use reload to ensure session is read from cookies
|
// Use reload to ensure session is read from cookies
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait a moment for the navigation component to update
|
// Wait a moment for the navigation component to update
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
@@ -166,7 +166,7 @@ test.describe.serial('Epic 1: User Logout', () => {
|
|||||||
|
|
||||||
// Navigate to home using reload to ensure session is loaded
|
// Navigate to home using reload to ensure session is loaded
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait for logout button to appear
|
// Wait for logout button to appear
|
||||||
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
||||||
@@ -190,7 +190,7 @@ test.describe.serial('Epic 1: User Logout', () => {
|
|||||||
|
|
||||||
// Navigate to home using reload to ensure session is loaded
|
// Navigate to home using reload to ensure session is loaded
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait for logout button to appear
|
// Wait for logout button to appear
|
||||||
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
await page.waitForSelector('text=Sign out', { timeout: 10000 });
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ test.describe.serial('Epic 1: User Registration', () => {
|
|||||||
test('Registration with valid data creates account', async ({ page }) => {
|
test('Registration with valid data creates account', async ({ page }) => {
|
||||||
await page.goto('http://localhost:3000/auth/register');
|
await page.goto('http://localhost:3000/auth/register');
|
||||||
|
|
||||||
// Wait for JavaScript to be ready
|
// Wait for page to load
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
await page.waitForSelector('form');
|
await page.waitForSelector('form');
|
||||||
await page.waitForSelector('button[type="submit"]:not([disabled])');
|
await page.waitForSelector('button[type="submit"]:not([disabled])');
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -173,7 +173,7 @@ export default async function globalSetup(config: FullConfig) {
|
|||||||
// Navigate to admin page to refresh session
|
// Navigate to admin page to refresh session
|
||||||
console.log('Navigating to admin page for admin user...');
|
console.log('Navigating to admin page for admin user...');
|
||||||
await page.goto(`${baseURL}/admin`);
|
await page.goto(`${baseURL}/admin`);
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
console.log('Admin page loaded:', page.url());
|
console.log('Admin page loaded:', page.url());
|
||||||
|
|
||||||
// Wait a bit to ensure session is refreshed
|
// Wait a bit to ensure session is refreshed
|
||||||
@@ -181,7 +181,7 @@ export default async function globalSetup(config: FullConfig) {
|
|||||||
|
|
||||||
// Refresh the page to force session reload
|
// Refresh the page to force session reload
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
console.log('Page reloaded');
|
console.log('Page reloaded');
|
||||||
|
|
||||||
// Save the authentication state
|
// Save the authentication state
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ test.describe.serial('Tournament with 10 Participants and Variable Team Durabili
|
|||||||
await page.goto(`http://localhost:3000/admin/tournaments/${tournamentId}`);
|
await page.goto(`http://localhost:3000/admin/tournaments/${tournamentId}`);
|
||||||
|
|
||||||
// Wait for page to load and data to be fetched
|
// Wait for page to load and data to be fetched
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
// Wait for the page content to appear (not just "Loading...")
|
// Wait for the page content to appear (not just "Loading...")
|
||||||
await expect(page.locator('text=Matchups')).toBeVisible({ timeout: 15000 });
|
await expect(page.locator('text=Matchups')).toBeVisible({ timeout: 15000 });
|
||||||
|
|||||||
Reference in New Issue
Block a user