From 9d8d33121a6de3026b54c33a87b91040078ba8ec Mon Sep 17 00:00:00 2001 From: giancarlo Date: Thu, 11 Apr 2024 18:50:55 +0800 Subject: [PATCH] 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 --- apps/e2e/tests/authentication/auth.po.ts | 10 ++++++---- apps/e2e/tests/authentication/auth.spec.ts | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/e2e/tests/authentication/auth.po.ts b/apps/e2e/tests/authentication/auth.po.ts index da283969e..c01776b07 100644 --- a/apps/e2e/tests/authentication/auth.po.ts +++ b/apps/e2e/tests/authentication/auth.po.ts @@ -11,19 +11,21 @@ export class AuthPageObject { } goToSignIn() { - return this.page.goto('/auth/sign-in'); + return this.page.goto('/auth/sign-in', { + waitUntil: 'networkidle', + }); } goToSignUp() { - return this.page.goto('/auth/sign-up'); + return this.page.goto('/auth/sign-up', { + waitUntil: 'networkidle', + }); } async signIn(params: { email: 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="password"]', params.password); await this.page.click('button[type="submit"]'); diff --git a/apps/e2e/tests/authentication/auth.spec.ts b/apps/e2e/tests/authentication/auth.spec.ts index 2544a2faf..620df8a90 100644 --- a/apps/e2e/tests/authentication/auth.spec.ts +++ b/apps/e2e/tests/authentication/auth.spec.ts @@ -40,9 +40,9 @@ test.describe('Auth flow', () => { 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'); }); });