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