Skip to content

Commit f33d8e3

Browse files
committed
feat(repo): Add sign-in-smoke.test.ts
1 parent e74511e commit f33d8e3

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { test } from '@playwright/test';
2+
3+
import type { Application } from '../adapters/application';
4+
import { appConfigs, longRunningApps } from '../presets';
5+
import type { FakeUser } from '../testUtils';
6+
import { createTestUtils } from '../testUtils';
7+
8+
test.describe('sign in smoke test', () => {
9+
const configs = [longRunningApps.react.viteAllEnabled];
10+
// const configs = [longRunningApps.react.viteAllEnabled, longRunningApps.next.appRouterAllEnabled];
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+
app = await config.commit();
21+
await app.setup();
22+
await app.withEnv(appConfigs.instances.allEnabled);
23+
await app.dev();
24+
const u = createTestUtils({ app });
25+
fakeUser = u.services.users.createFakeUser();
26+
await u.services.users.createBapiUser(fakeUser);
27+
});
28+
29+
test.afterAll(async () => {
30+
await fakeUser.deleteIfExists();
31+
await app.teardown();
32+
});
33+
34+
test('sign in with email and password', async ({ page, context }) => {
35+
const u = createTestUtils({ app, page, context });
36+
await u.page.pause();
37+
await u.po.signIn.goTo();
38+
await u.po.signIn.setIdentifier(fakeUser.email);
39+
await u.po.signIn.continue();
40+
await u.po.signIn.setPassword(fakeUser.password);
41+
await u.po.signIn.continue();
42+
await u.po.expect.toBeSignedIn();
43+
});
44+
45+
test('sign in with email and instant password', async ({ page, context }) => {
46+
const u = createTestUtils({ app, page, context });
47+
await u.po.signIn.goTo();
48+
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
49+
await u.po.expect.toBeSignedIn();
50+
await u.page.pause();
51+
});
52+
});
53+
});
54+
});

0 commit comments

Comments
 (0)