Skip to content

Commit d473b52

Browse files
committed
test(e2e): Update tests to handle untrusted password on sign-in (#7345)
1 parent 24948c9 commit d473b52

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

.changeset/funny-crabs-crash.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
3+
---

integration/tests/session-tasks-sign-in-reset-password.test.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
import { hash } from '../models/helpers';
44
import { appConfigs } from '../presets';
@@ -28,6 +28,13 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
2828
await u.po.signIn.setPassword(user.password);
2929
await u.po.signIn.continue();
3030

31+
await expect(
32+
u.page.getByText(
33+
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
34+
),
35+
).toBeVisible();
36+
await u.po.signIn.getAltMethodsEmailCodeButton().click();
37+
3138
await u.page.getByRole('textbox', { name: 'code' }).click();
3239
await u.page.keyboard.type('424242', { delay: 100 });
3340

@@ -62,7 +69,8 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
6269
await u.services.users.passwordUntrusted(createdUser.id);
6370
const fakeOrganization = u.services.organizations.createFakeOrganization();
6471
await u.services.organizations.createBapiOrganization({
65-
...fakeOrganization,
72+
name: fakeOrganization.name,
73+
slug: fakeOrganization.slug + Date.now().toString(),
6674
createdBy: createdUser.id,
6775
});
6876

@@ -73,9 +81,15 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
7381
await u.po.signIn.setPassword(user.password);
7482
await u.po.signIn.continue();
7583

76-
await u.page.getByRole('textbox', { name: 'code' }).fill('424242');
84+
await expect(
85+
u.page.getByText(
86+
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
87+
),
88+
).toBeVisible();
89+
await u.po.signIn.getAltMethodsEmailCodeButton().click();
7790

78-
await u.po.expect.toBeSignedIn();
91+
await u.page.getByRole('textbox', { name: 'code' }).click();
92+
await u.page.keyboard.type('424242', { delay: 100 });
7993

8094
// Redirects back to tasks when accessing protected route by `auth.protect`
8195
await u.page.goToRelative('/page-protected');

0 commit comments

Comments
 (0)