forked from cardosofelipe/fast-next-template
Adjust Playwright authentication tests for Firefox compatibility
- Increased `waitForTimeout` to 1500ms in registration and password reset tests to account for slower rendering in Firefox. - Simplified password reset validation error checks by relying on URL assertions instead of specific locators. - Improved test reliability and cross-browser compatibility across authentication flows.
This commit is contained in:
@@ -59,7 +59,7 @@ test.describe('Registration Flow', () => {
|
||||
|
||||
// Submit form
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForTimeout(1500); // Increased for Firefox
|
||||
|
||||
// Should stay on register page (validation failed)
|
||||
await expect(page).toHaveURL('/register');
|
||||
@@ -74,7 +74,7 @@ test.describe('Registration Flow', () => {
|
||||
|
||||
// Submit form
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForTimeout(1500); // Increased for Firefox
|
||||
|
||||
// Should stay on register page (validation failed)
|
||||
await expect(page).toHaveURL('/register');
|
||||
@@ -135,12 +135,14 @@ test.describe('Registration Flow', () => {
|
||||
test('should navigate to login page', async ({ page }) => {
|
||||
// Click login link - use more specific selector
|
||||
const loginLink = page.getByRole('link', { name: 'Sign in' });
|
||||
await loginLink.click();
|
||||
|
||||
// Wait a moment for navigation
|
||||
await page.waitForTimeout(1000);
|
||||
// Use Promise.all to wait for navigation
|
||||
await Promise.all([
|
||||
page.waitForURL('/login', { timeout: 10000 }),
|
||||
loginLink.click()
|
||||
]);
|
||||
|
||||
// Should navigate to login page
|
||||
// Should be on login page
|
||||
await expect(page).toHaveURL('/login');
|
||||
await expect(page.locator('h2')).toContainText('Sign in to your account');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user