refactor(e2e): increase timeout to avoid test failure

This commit is contained in:
sumit_chaturvedi
2025-06-25 17:56:43 +05:30
parent dc9d5b0bcd
commit ae1219dac8
2 changed files with 10 additions and 6 deletions
+4 -3
View File
@@ -5,9 +5,9 @@ dotenv.config();
const isLocal = process.env.LOCAL === "true";
export default defineConfig({
timeout: 60 * 1000,
timeout: 90 * 1000,
testDir: "./tests/e2e",
fullyParallel: true,
fullyParallel: false,
forbidOnly: !isLocal,
retries: isLocal ? 0 : 2,
workers: isLocal ? undefined : 1,
@@ -17,6 +17,7 @@ export default defineConfig({
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
navigationTimeout: 60 * 1000,
},
/* Configure projects for major browsers */
@@ -64,6 +65,6 @@ export default defineConfig({
command: "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: true,
timeout: 400 * 1000, // 5 minute
timeout: 120 * 1000, // wait up to 2 minutes for frontend to boot
},
});
+6 -3
View File
@@ -34,8 +34,9 @@ test('should show error for invalid credentials', async ({ page }) => {
await page.fill('input[name="email"]', 'wrong@gmail.com');
await page.fill('input[name="password"]', 'WrongPassword123');
await page.getByRole('button', { name: /log in/i }).click();
await page.waitForTimeout(7000);
await expect(page.getByText(/invalid email or password/i)).toBeVisible({ timeout: 10000 });
await expect(page.getByText(/Invalid email or password/i)).toBeVisible();
});
test('should sign in successfully', async ({ page }) => {
@@ -48,6 +49,8 @@ test('should sign in successfully', async ({ page }) => {
// Submit the form
await page.getByRole('button', { name: /log in/i }).click();
await page.waitForURL('/', { timeout: 15000 });
await expect(page).toHaveURL('/');
await page.waitForTimeout(7000);
await page.waitForURL((url) => !url.pathname.includes('sign-in'), {
timeout: 15000,
});
});