From 5922d1fa1e12342887ba5c0dd7fe3fc7f78e0dc3 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 27 Nov 2025 19:57:23 +0100 Subject: [PATCH] fix(test): correctly set fixed time in login test --- frontend/tests/e2e/user/login.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/tests/e2e/user/login.spec.ts b/frontend/tests/e2e/user/login.spec.ts index 75088bf57..7a83389ad 100644 --- a/frontend/tests/e2e/user/login.spec.ts +++ b/frontend/tests/e2e/user/login.spec.ts @@ -37,15 +37,14 @@ async function login(page: Page): Promise { } test.describe('Login', () => { - test.beforeEach(async ({apiContext}) => { + test.beforeEach(async ({page, apiContext}) => { await UserFactory.create(1, {username: credentials.username}) + await page.clock.setFixedTime(new Date(1625656161057)) // 13:00 }) test('Should log in with the right credentials', async ({page}) => { await page.goto('/login') await login(page) - await page.clock.install({time: new Date(1625656161057)}) // 13:00 - // Use more specific selector to avoid strict mode violation await expect(page.locator('main h2')).toContainText(`Hi ${credentials.username}!`) })