Skip to content

Commit ae3c818

Browse files
authored
chore(e2e): Speed up reverification tests (#5662)
1 parent 13d29d0 commit ae3c818

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

.changeset/short-experts-show.md

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

integration/tests/reverification.test.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,13 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withReverification] })(
222222
await u.page.getByRole('button', { name: /LogUserId/i }).click();
223223
await expect(u.page.getByText(/\{\s*"userId"\s*:\s*"user_[^"]+"\s*\}/i)).toBeVisible();
224224

225-
const total = 1000 * 120;
226-
await page.waitForTimeout(total / 3);
227-
await page.waitForTimeout(total / 3);
228-
await u.po.userProfile.goTo();
229-
await page.waitForTimeout(total / 3);
225+
// Hack to reset fva
226+
await u.po.expect.toBeSignedIn();
227+
await page.evaluate(async () => {
228+
return window.Clerk.session.startVerification({
229+
level: 'first_factor',
230+
});
231+
});
230232
await u.page.goToRelative(`/requires-re-verification`);
231233
await u.page.getByRole('button', { name: /LogUserId/i }).click();
232234
await expect(
@@ -237,7 +239,6 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withReverification] })(
237239
});
238240

239241
test(`reverification recovery from ${capitalize(type)}`, async ({ page, context }) => {
240-
test.setTimeout(270_000);
241242
const u = createTestUtils({ app, page, context });
242243

243244
await u.po.signIn.goTo();
@@ -253,11 +254,14 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withReverification] })(
253254
await u.page.getByRole('button', { name: /LogUserId/i }).click();
254255
await expect(u.page.getByText(/\{\s*"userId"\s*:\s*"user_[^"]+"\s*\}/i)).toBeVisible();
255256

256-
const total = 1000 * 120;
257-
await page.waitForTimeout(total / 3);
258-
await page.waitForTimeout(total / 3);
259-
await u.po.userProfile.goTo();
260-
await page.waitForTimeout(total / 3);
257+
// Hack to reset fva
258+
await u.po.expect.toBeSignedIn();
259+
await page.evaluate(async () => {
260+
return window.Clerk.session.startVerification({
261+
level: 'first_factor',
262+
});
263+
});
264+
261265
await u.page.goToRelative(`/action-with-use-reverification`);
262266
await u.po.expect.toBeSignedIn();
263267
await u.page.getByRole('button', { name: /LogUserId/i }).click();

0 commit comments

Comments
 (0)