|
| 1 | +import { test } from '@playwright/test'; |
| 2 | + |
| 3 | +import type { Application } from '../adapters/application'; |
| 4 | +import { vercelDeployment } from '../adapters/deployment'; |
| 5 | +import { appConfigs } from '../presets'; |
| 6 | +import type { FakeUser } from '../testUtils'; |
| 7 | +import { createTestUtils } from '../testUtils'; |
| 8 | + |
| 9 | +test.describe('vercel deployment', () => { |
| 10 | + const configs = [appConfigs.next.appRouter]; |
| 11 | + |
| 12 | + configs.forEach(config => { |
| 13 | + test.describe(`${config.name}`, () => { |
| 14 | + test.describe.configure({ mode: 'serial' }); |
| 15 | + |
| 16 | + let app: Application; |
| 17 | + let fakeUser: FakeUser; |
| 18 | + |
| 19 | + test.beforeAll(async () => { |
| 20 | + test.setTimeout(120_000); |
| 21 | + app = await vercelDeployment(config); |
| 22 | + fakeUser = createTestUtils({ app }).services.users.createFakeUser(); |
| 23 | + }); |
| 24 | + |
| 25 | + test.afterAll(async () => { |
| 26 | + await fakeUser.deleteIfExists(); |
| 27 | + await app.teardown(); |
| 28 | + }); |
| 29 | + |
| 30 | + test('sign up', async ({ page, context }) => { |
| 31 | + const u = createTestUtils({ app, page, context }); |
| 32 | + await u.po.signUp.goTo(); |
| 33 | + await u.po.signUp.signUpWithEmailAndPassword({ email: fakeUser.email, password: fakeUser.password }); |
| 34 | + await u.po.signUp.enterOtpCode(await u.services.email.getCodeForEmailAddress(fakeUser.email)); |
| 35 | + await u.po.expect.toBeSignedIn(); |
| 36 | + }); |
| 37 | + |
| 38 | + test('sign in', async ({ page, context }) => { |
| 39 | + const u = createTestUtils({ app, page, context }); |
| 40 | + await u.po.signIn.goTo(); |
| 41 | + await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password }); |
| 42 | + await u.po.expect.toBeSignedIn(); |
| 43 | + await u.page.waitForURL(app.serverUrl); |
| 44 | + }); |
| 45 | + }); |
| 46 | + }); |
| 47 | +}); |
0 commit comments