-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
7 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 |
---|---|---|
@@ -1 +1,59 @@ | ||
// TODO | ||
import { test } from '@playwright/test'; | ||
|
||
import type { Application } from '../../models/application'; | ||
import { appConfigs } from '../../presets'; | ||
import type { FakeOrganization, FakeUser } from '../../testUtils'; | ||
import { createTestUtils } from '../../testUtils'; | ||
|
||
test.describe('Library Mode basic tests for @react-router', () => { | ||
test.describe.configure({ mode: 'parallel' }); | ||
let app: Application; | ||
let fakeUser: FakeUser; | ||
let fakeOrganization: FakeOrganization; | ||
|
||
test.beforeAll(async () => { | ||
app = await appConfigs.reactRouter.reactRouterLibrary.commit(); | ||
|
||
await app.setup(); | ||
await app.withEnv(appConfigs.envs.withEmailCodes); | ||
await app.dev(); | ||
|
||
const u = createTestUtils({ app }); | ||
fakeUser = u.services.users.createFakeUser(); | ||
const user = await u.services.users.createBapiUser(fakeUser); | ||
fakeOrganization = await u.services.users.createFakeOrganization(user.id); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await fakeOrganization.delete(); | ||
await fakeUser.deleteIfExists(); | ||
|
||
await app.teardown(); | ||
}); | ||
|
||
test.afterEach(async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
await u.page.signOut(); | ||
await u.page.context().clearCookies(); | ||
}); | ||
|
||
test('should log in successfully', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToAppHome(); | ||
await u.po.expect.toBeSignedOut(); | ||
await u.page.waitForClerkJsLoaded(); | ||
|
||
await u.page.getByRole('button', { name: /Sign in/i }).click(); | ||
await u.po.signIn.waitForMounted(); | ||
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password }); | ||
|
||
await u.page.waitForAppUrl('/'); | ||
await u.po.expect.toBeSignedIn(); | ||
await u.po.userButton.waitForMounted(); | ||
await u.po.userButton.toggleTrigger(); | ||
await u.po.userButton.waitForPopover(); | ||
|
||
await u.po.userButton.toHaveVisibleMenuItems([/Manage account/i, /Sign out$/i]); | ||
}); | ||
}); |
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