Skip to content

Commit 53983db

Browse files
authored
chore(e2e): Fix flaky tests for multi-session with tasks (#6306)
1 parent dedf487 commit 53983db

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

integration/tests/session-tasks-multi-session.test.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
3030
await app.teardown();
3131
});
3232

33-
test.afterEach(async ({ page, context }) => {
33+
test('when switching sessions, navigate to task', async ({ page, context }) => {
3434
const u = createTestUtils({ app, page, context });
35-
await u.page.signOut();
36-
await u.page.context().clearCookies();
37-
});
3835

39-
test.skip('when switching sessions, navigate to task', async ({ page, context }) => {
40-
const u = createTestUtils({ app, page, context });
36+
// TODO -> Figure out why test is flaky on Next.js 14
37+
if (u.nextJsVersion === '14') {
38+
test.skip();
39+
return;
40+
}
4141

4242
// Performs sign-in
4343
await u.po.signIn.goTo();
@@ -82,15 +82,22 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
8282
await u.po.userButton.waitForPopover();
8383
await u.po.userButton.toHaveVisibleMenuItems([/Manage account/i, /Sign out$/i]);
8484
await u.po.userButton.switchAccount(user2.email);
85+
await u.po.userButton.waitForPopoverClosed();
8586

86-
// Resolve task
87+
// Wait for sign-in component to be mounted after switching accounts
8788
await u.po.signIn.waitForMounted();
89+
await page.waitForURL(/tasks/);
90+
91+
// Resolve task
8892
const fakeOrganization2 = u.services.organizations.createFakeOrganization();
8993
await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization2);
9094
await u.po.expect.toHaveResolvedTask();
9195

9296
// Navigates to after sign-in
9397
await u.page.waitForAppUrl('/');
98+
99+
await u.page.signOut();
100+
await u.page.context().clearCookies();
94101
});
95102
},
96103
);

0 commit comments

Comments
 (0)