Skip to content

Commit c777432

Browse files
committed
Add test to replicate behavior
1 parent 8ee859c commit c777432

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

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

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

33
import { appConfigs } from '../presets';
44
import type { FakeUser } from '../testUtils';
@@ -27,23 +27,47 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
2727
await app.teardown();
2828
});
2929

30-
test('navigate to task on after sign-up', async ({ page, context }) => {
31-
// Performs sign-up
30+
// test('navigate to task on after sign-up', async ({ page, context }) => {
31+
// // Performs sign-up
32+
// const u = createTestUtils({ app, page, context });
33+
// await u.po.signUp.goTo();
34+
// await u.po.signUp.signUpWithEmailAndPassword({
35+
// email: fakeUser.email,
36+
// password: fakeUser.password,
37+
// });
38+
// await u.po.expect.toBeSignedIn();
39+
40+
// // Redirects back to tasks when accessing protected route by `auth.protect`
41+
// await u.page.goToRelative('/page-protected');
42+
// expect(u.page.url()).toContain('tasks');
43+
44+
// // Resolves task
45+
// const fakeOrganization = Object.assign(u.services.organizations.createFakeOrganization(), {
46+
// slug: u.services.organizations.createFakeOrganization().slug + '-with-sign-up',
47+
// });
48+
// await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization);
49+
// await u.po.expect.toHaveResolvedTask();
50+
51+
// // Navigates to after sign-up
52+
// await u.page.waitForAppUrl('/');
53+
// });
54+
55+
test('with sso, navigate to task on after sign-up', async ({ page, context }) => {
3256
const u = createTestUtils({ app, page, context });
57+
3358
await u.po.signUp.goTo();
34-
await u.po.signUp.signUpWithEmailAndPassword({
35-
email: fakeUser.email,
36-
password: fakeUser.password,
37-
});
38-
await u.po.expect.toBeSignedIn();
59+
await u.page.getByRole('button', { name: 'E2E OAuth Provider' }).click();
3960

40-
// Redirects back to tasks when accessing protected route by `auth.protect`
41-
await u.page.goToRelative('/page-protected');
42-
expect(u.page.url()).toContain('tasks');
61+
u.po.signIn.getGoToSignUp();
62+
await u.po.signUp.waitForMounted();
63+
await u.po.signUp.setIdentifier(fakeUser.email);
64+
await u.po.signUp.continue();
65+
await u.po.signUp.enterTestOtpCode();
4366

4467
// Resolves task
68+
await u.po.signIn.waitForMounted();
4569
const fakeOrganization = Object.assign(u.services.organizations.createFakeOrganization(), {
46-
slug: u.services.organizations.createFakeOrganization().slug + '-with-sign-up',
70+
slug: u.services.organizations.createFakeOrganization().slug + '-with-sign-in-sso',
4771
});
4872
await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization);
4973
await u.po.expect.toHaveResolvedTask();

packages/testing/src/playwright/unstable/page-objects/signUp.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export const createSignUpComponentPageObject = (testArgs: { page: EnhancedPage }
3232
state: state === 'closed' ? 'detached' : 'attached',
3333
});
3434
},
35+
setIdentifier: (val: string) => {
36+
return self.getIdentifierInput().fill(val);
37+
},
3538
signUpWithOauth: (provider: string) => {
3639
return page.getByRole('button', { name: new RegExp(`continue with ${provider}`, 'gi') });
3740
},

0 commit comments

Comments
 (0)