@@ -49,12 +49,12 @@ test('App should create account', async () => {
49
49
const title = page . locator ( 'h1' )
50
50
const subtitle = page . getByTestId ( 'subtitle' ) ;
51
51
52
- await page . getByText ( 'Create account' ) . click ( ) ;
52
+ expect ( await util . waitForNavigation ( async ( ) => {
53
+ await page . getByText ( 'Create account' ) . click ( ) ;
53
54
54
- await expect ( title ) . toHaveText ( 'Account created' ) ;
55
- await expect ( subtitle ) . toHaveText ( 'Logged in' ) ;
56
-
57
- expect ( await util . waitForNavigation ( ) ) . toEqual ( RoutePath . expired ) ;
55
+ await expect ( title ) . toHaveText ( 'Account created' ) ;
56
+ await expect ( subtitle ) . toHaveText ( 'Logged in' ) ;
57
+ } ) ) . toEqual ( RoutePath . expired ) ;
58
58
59
59
const outOfTimeTitle = page . getByTestId ( 'title' ) ;
60
60
await expect ( outOfTimeTitle ) . toHaveText ( 'Congrats!' ) ;
@@ -80,13 +80,14 @@ test('App should log in', async () => {
80
80
await expect ( title ) . toHaveText ( 'Login' ) ;
81
81
await expect ( subtitle ) . toHaveText ( 'Enter your account number' ) ;
82
82
83
- await loginInput . type ( process . env . ACCOUNT_NUMBER ! ) ;
84
- await loginInput . press ( 'Enter' ) ;
83
+ await loginInput . fill ( process . env . ACCOUNT_NUMBER ! ) ;
85
84
86
- await expect ( title ) . toHaveText ( 'Logged in' ) ;
87
- await expect ( subtitle ) . toHaveText ( 'Valid account number ') ;
85
+ expect ( await util . waitForNavigation ( async ( ) => {
86
+ await loginInput . press ( 'Enter ') ;
88
87
89
- expect ( await util . waitForNavigation ( ) ) . toEqual ( RoutePath . main ) ;
88
+ await expect ( title ) . toHaveText ( 'Logged in' ) ;
89
+ await expect ( subtitle ) . toHaveText ( 'Valid account number' ) ;
90
+ } ) ) . toEqual ( RoutePath . main ) ;
90
91
await expectDisconnected ( page ) ;
91
92
} ) ;
92
93
@@ -115,13 +116,11 @@ test('App should log in to expired account', async () => {
115
116
await expect ( title ) . toHaveText ( 'Login' ) ;
116
117
await expect ( subtitle ) . toHaveText ( 'Enter your account number' ) ;
117
118
118
- await loginInput . type ( accountNumber ) ;
119
- await loginInput . press ( 'Enter' ) ;
120
-
121
- await expect ( title ) . toHaveText ( 'Logged in' ) ;
122
- await expect ( subtitle ) . toHaveText ( 'Valid account number' ) ;
119
+ await loginInput . fill ( accountNumber ) ;
123
120
124
- expect ( await util . waitForNavigation ( ) ) . toEqual ( RoutePath . expired ) ;
121
+ expect ( await util . waitForNavigation ( async ( ) => {
122
+ await loginInput . press ( 'Enter' ) ;
123
+ } ) ) . toEqual ( RoutePath . expired ) ;
125
124
126
125
const outOfTimeTitle = page . getByTestId ( 'title' ) ;
127
126
await expect ( outOfTimeTitle ) . toHaveText ( 'Out of time' ) ;
0 commit comments