-
Notifications
You must be signed in to change notification settings - Fork 462
feat(clerk-js): Sign Out from multiple tabs at once #2094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
83c7ab8
ecfed06
8d2d54c
7b6afab
f2877bb
66fafe8
3391990
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/clerk-js': minor | ||
| --- | ||
|
|
||
| Introducing sign out from all open tabs at once. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
|
|
||
| import { appConfigs } from '../presets'; | ||
| import type { FakeUser } from '../testUtils'; | ||
| import { createTestUtils, testAgainstRunningApps } from '../testUtils'; | ||
|
|
||
| testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('sign out smoke test @generic', ({ app }) => { | ||
| test.describe.configure({ mode: 'serial' }); | ||
|
|
||
| let fakeUser: FakeUser; | ||
|
|
||
| test.beforeAll(async () => { | ||
| const u = createTestUtils({ app }); | ||
| fakeUser = u.services.users.createFakeUser(); | ||
| await u.services.users.createBapiUser(fakeUser); | ||
| }); | ||
|
|
||
| test.afterAll(async () => { | ||
| await fakeUser.deleteIfExists(); | ||
| await app.teardown(); | ||
| }); | ||
|
|
||
| test('sign out throught all open tabs at once', async ({ page, context }) => { | ||
| const mainTab = createTestUtils({ app, page, context }); | ||
| await mainTab.po.signIn.goTo(); | ||
| await mainTab.po.signIn.setIdentifier(fakeUser.email); | ||
| await mainTab.po.signIn.continue(); | ||
| await mainTab.po.signIn.setPassword(fakeUser.password); | ||
| await mainTab.po.signIn.continue(); | ||
| await mainTab.po.expect.toBeSignedIn(); | ||
|
|
||
| await mainTab.tabs.runInNewTab(async m => { | ||
| await m.page.goToStart(); | ||
|
|
||
| await m.page.waitForClerkJsLoaded(); | ||
|
|
||
| await m.po.expect.toBeSignedIn(); | ||
|
|
||
| await m.page.evaluate(async () => { | ||
| await window.Clerk.signOut(); | ||
| }); | ||
|
|
||
| await m.po.expect.toBeSignedOut(); | ||
| }); | ||
|
|
||
| expect(await mainTab.page.evaluate('!window.Clerk.user')).toBe(false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙃 let's add a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The helper exists but there is a problem with it, the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's add a comment about why we cannot use the helper and fix this later.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ shouldn't this be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right! Just opened a PR for that #2125 |
||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import type { Clerk } from '@clerk/types'; | ||
|
|
||
| declare global { | ||
| interface Window { | ||
| Clerk: Clerk; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.