@@ -4,49 +4,52 @@ import { appConfigs } from '../presets';
44import type { FakeUser } from '../testUtils' ;
55import { createTestUtils , testAgainstRunningApps } from '../testUtils' ;
66
7- testAgainstRunningApps ( { withEnv : [ appConfigs . envs . withEmailCodes ] } ) ( 'sign in smoke test @generic' , ( { app } ) => {
8- test . describe . configure ( { mode : 'serial' } ) ;
9-
10- let fakeUser : FakeUser ;
11-
12- test . beforeAll ( async ( ) => {
13- const u = createTestUtils ( { app } ) ;
14- fakeUser = u . services . users . createFakeUser ( ) ;
15- await u . services . users . createBapiUser ( fakeUser ) ;
16- } ) ;
17-
18- test . afterAll ( async ( ) => {
19- await fakeUser . deleteIfExists ( ) ;
20- await app . teardown ( ) ;
21- } ) ;
22-
23- test ( 'sign in with email and password' , async ( { page, context } ) => {
24- const u = createTestUtils ( { app, page, context } ) ;
25- await u . po . signIn . goTo ( ) ;
26- await u . po . signIn . setIdentifier ( fakeUser . email ) ;
27- await u . po . signIn . continue ( ) ;
28- await u . po . signIn . setPassword ( fakeUser . password ) ;
29- await u . po . signIn . continue ( ) ;
30- await u . po . expect . toBeSignedIn ( ) ;
31- } ) ;
32-
33- test ( 'sign in with email and instant password' , async ( { page, context } ) => {
34- const u = createTestUtils ( { app, page, context } ) ;
35- await u . po . signIn . goTo ( ) ;
36- await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
37- await u . po . expect . toBeSignedIn ( ) ;
38- await u . page . pause ( ) ;
39- } ) ;
40-
41- test ( 'access protected page @express' , async ( { page, context } ) => {
42- const u = createTestUtils ( { app, page, context } ) ;
43- await u . po . signIn . goTo ( ) ;
44- await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
45- await u . po . expect . toBeSignedIn ( ) ;
46-
47- expect ( await u . page . locator ( "data-test-id='protected-api-response'" ) . count ( ) ) . toEqual ( 0 ) ;
48- await u . page . goToRelative ( '/protected' ) ;
49- await u . page . isVisible ( "data-test-id='protected-api-response'" ) ;
50- await u . page . pause ( ) ;
51- } ) ;
52- } ) ;
7+ testAgainstRunningApps ( { withEnv : [ appConfigs . envs . withEmailCodes ] } ) (
8+ 'sign in smoke test @generic @nextjs' ,
9+ ( { app } ) => {
10+ test . describe . configure ( { mode : 'serial' } ) ;
11+
12+ let fakeUser : FakeUser ;
13+
14+ test . beforeAll ( async ( ) => {
15+ const u = createTestUtils ( { app } ) ;
16+ fakeUser = u . services . users . createFakeUser ( ) ;
17+ await u . services . users . createBapiUser ( fakeUser ) ;
18+ } ) ;
19+
20+ test . afterAll ( async ( ) => {
21+ await fakeUser . deleteIfExists ( ) ;
22+ await app . teardown ( ) ;
23+ } ) ;
24+
25+ test ( 'sign in with email and password' , async ( { page, context } ) => {
26+ const u = createTestUtils ( { app, page, context } ) ;
27+ await u . po . signIn . goTo ( ) ;
28+ await u . po . signIn . setIdentifier ( fakeUser . email ) ;
29+ await u . po . signIn . continue ( ) ;
30+ await u . po . signIn . setPassword ( fakeUser . password ) ;
31+ await u . po . signIn . continue ( ) ;
32+ await u . po . expect . toBeSignedIn ( ) ;
33+ } ) ;
34+
35+ test ( 'sign in with email and instant password' , async ( { page, context } ) => {
36+ const u = createTestUtils ( { app, page, context } ) ;
37+ await u . po . signIn . goTo ( ) ;
38+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
39+ await u . po . expect . toBeSignedIn ( ) ;
40+ await u . page . pause ( ) ;
41+ } ) ;
42+
43+ test ( 'access protected page @express' , async ( { page, context } ) => {
44+ const u = createTestUtils ( { app, page, context } ) ;
45+ await u . po . signIn . goTo ( ) ;
46+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
47+ await u . po . expect . toBeSignedIn ( ) ;
48+
49+ expect ( await u . page . locator ( "data-test-id='protected-api-response'" ) . count ( ) ) . toEqual ( 0 ) ;
50+ await u . page . goToRelative ( '/protected' ) ;
51+ await u . page . isVisible ( "data-test-id='protected-api-response'" ) ;
52+ await u . page . pause ( ) ;
53+ } ) ;
54+ } ,
55+ ) ;
0 commit comments