-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(repo): Add tests for Sign Out functionality
- Loading branch information
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { 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(); | ||
}); | ||
}); | ||
|
||
expect(await mainTab.page.evaluate('!window.Clerk.user')).toBe(false); | ||
}); | ||
}); |