|
| 1 | +import { test } from '@playwright/test'; |
| 2 | + |
| 3 | +import { appConfigs } from '../presets'; |
| 4 | +import type { FakeUser } from '../testUtils'; |
| 5 | +import { createTestUtils, testAgainstRunningApps } from '../testUtils'; |
| 6 | + |
| 7 | +testAgainstRunningApps({ |
| 8 | + withEnv: [appConfigs.envs.withEmailCodes], |
| 9 | + withPattern: ['react.vite.withEmailCodes', 'vue.vite'], |
| 10 | +})('UserAvatar component integration tests @generic', ({ app }) => { |
| 11 | + test.describe.configure({ mode: 'serial' }); |
| 12 | + |
| 13 | + let fakeUser: FakeUser; |
| 14 | + |
| 15 | + test.beforeAll(async () => { |
| 16 | + const u = createTestUtils({ app }); |
| 17 | + fakeUser = u.services.users.createFakeUser({ |
| 18 | + withPhoneNumber: true, |
| 19 | + withUsername: true, |
| 20 | + }); |
| 21 | + await u.services.users.createBapiUser(fakeUser); |
| 22 | + }); |
| 23 | + |
| 24 | + test.afterAll(async () => { |
| 25 | + await app.teardown(); |
| 26 | + await fakeUser.deleteIfExists(); |
| 27 | + }); |
| 28 | + |
| 29 | + test.afterEach(async ({ page, context }) => { |
| 30 | + const u = createTestUtils({ app, page, context }); |
| 31 | + await u.page.signOut(); |
| 32 | + await u.page.context().clearCookies(); |
| 33 | + }); |
| 34 | + |
| 35 | + test('UserAvatar loads and renders correctly when user is signed in', async ({ page, context }) => { |
| 36 | + const u = createTestUtils({ app, page, context }); |
| 37 | + |
| 38 | + await u.po.signIn.goTo(); |
| 39 | + await u.po.signIn.signInWithEmailAndInstantPassword({ |
| 40 | + email: fakeUser.email, |
| 41 | + password: fakeUser.password, |
| 42 | + }); |
| 43 | + await u.po.expect.toBeSignedIn(); |
| 44 | + |
| 45 | + await u.po.userAvatar.goTo(); |
| 46 | + await u.po.userAvatar.toBeVisible(); |
| 47 | + }); |
| 48 | +}); |
0 commit comments