Skip to content

Commit 07249b4

Browse files
committed
Add E2E test for sign-up with SSO
1 parent 78262d7 commit 07249b4

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

integration/tests/session-tasks-sign-up.test.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import { expect, test } from '@playwright/test';
33
import { appConfigs } from '../presets';
44
import type { FakeUser } from '../testUtils';
55
import { createTestUtils, testAgainstRunningApps } from '../testUtils';
6-
import type { FakeOrganization } from '../testUtils/organizationsService';
76

87
testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
98
'session tasks after sign-up flow @nextjs',
109
({ app }) => {
1110
test.describe.configure({ mode: 'serial' });
1211

1312
let fakeUser: FakeUser;
14-
let fakeOrganization: FakeOrganization;
1513

1614
test.beforeAll(() => {
1715
const u = createTestUtils({ app });
@@ -20,7 +18,6 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
2018
withPhoneNumber: true,
2119
withUsername: true,
2220
});
23-
fakeOrganization = u.services.organizations.createFakeOrganization();
2421
});
2522

2623
test.afterAll(async () => {
@@ -45,6 +42,27 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
4542
expect(page.url()).toContain('tasks');
4643

4744
// Resolves task
45+
const fakeOrganization = u.services.organizations.createFakeOrganization();
46+
await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization);
47+
await u.po.expect.toHaveResolvedTask();
48+
49+
// Navigates to after sign-up
50+
await u.page.waitForAppUrl('/');
51+
});
52+
53+
test('with sso, navigate to task on after sign-up', async ({ page, context }) => {
54+
const u = createTestUtils({ app, page, context });
55+
56+
// Performs sign-up (transfer flow with sign-in) with SSO
57+
await u.po.signIn.goTo();
58+
await u.page.getByRole('button', { name: 'E2E OAuth Provider' }).click();
59+
await u.page.getByText('Sign in to oauth-provider').waitFor();
60+
await u.po.signIn.setIdentifier(fakeUser.email);
61+
await u.po.signIn.continue();
62+
await u.po.signIn.enterTestOtpCode();
63+
64+
// Resolves task
65+
const fakeOrganization = u.services.organizations.createFakeOrganization();
4866
await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization);
4967
await u.po.expect.toHaveResolvedTask();
5068

0 commit comments

Comments
 (0)