Update e2e tests for authentication
The commit modifies end-to-end testing for the authentication process. It replaces the explicit waitForURL method with the waitForTimeout method and makes the navigation checks less strict. Aside from this, it configures the page navigation methods to wait until there is no network activity
This commit is contained in:
@@ -11,19 +11,21 @@ export class AuthPageObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goToSignIn() {
|
goToSignIn() {
|
||||||
return this.page.goto('/auth/sign-in');
|
return this.page.goto('/auth/sign-in', {
|
||||||
|
waitUntil: 'networkidle',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
goToSignUp() {
|
goToSignUp() {
|
||||||
return this.page.goto('/auth/sign-up');
|
return this.page.goto('/auth/sign-up', {
|
||||||
|
waitUntil: 'networkidle',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async signIn(params: {
|
async signIn(params: {
|
||||||
email: string,
|
email: string,
|
||||||
password: string
|
password: string
|
||||||
}) {
|
}) {
|
||||||
await this.page.locator('input[name="email"]').clear();
|
|
||||||
|
|
||||||
await this.page.fill('input[name="email"]', params.email);
|
await this.page.fill('input[name="email"]', params.email);
|
||||||
await this.page.fill('input[name="password"]', params.password);
|
await this.page.fill('input[name="password"]', params.password);
|
||||||
await this.page.click('button[type="submit"]');
|
await this.page.click('button[type="submit"]');
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ test.describe('Auth flow', () => {
|
|||||||
password: 'password',
|
password: 'password',
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForURL('http://localhost:3000/home');
|
await page.waitForTimeout(500);
|
||||||
|
|
||||||
expect(page.url()).toContain('http://localhost:3000/home');
|
expect(page.url()).toContain('/home');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user