@@ -4,7 +4,10 @@ export class LoginPage {
4
4
constructor ( private page : Page ) { }
5
5
6
6
async login ( email : string , password : string ) {
7
- console . log ( "Attempting login with:" , { email, password } ) ; // Debug log
7
+ console . log ( `Attempting login on ${ this . page . url ( ) } with` , {
8
+ email,
9
+ password,
10
+ } ) ; // Debug log
8
11
9
12
// Fill email
10
13
const emailInput = this . page . getByPlaceholder ( "[email protected] " ) ;
@@ -35,15 +38,20 @@ export class LoginPage {
35
38
36
39
// Start waiting for navigation before clicking
37
40
const navigationPromise = Promise . race ( [
38
- this . page . waitForURL ( "/" , { timeout : 10_000 } ) , // Wait for home page
39
- this . page . waitForURL ( "/marketplace" , { timeout : 10_000 } ) , // Wait for home page
40
- this . page . waitForURL ( "/onboarding/**" , { timeout : 10_000 } ) , // Wait for onboarding page
41
+ this . page
42
+ . waitForURL ( / ^ \/ ( m a r k e t p l a c e | o n b o a r d i n g ( \/ .* ) ? ) ? $ / , { timeout : 10_000 } )
43
+ . catch ( ( reason ) => {
44
+ console . warn (
45
+ `Navigation away from /login timed out: ${ reason } . Current URL: ${ this . page . url ( ) } ` ,
46
+ ) ;
47
+ throw reason ;
48
+ } ) , // Wait for home page
41
49
] ) ;
42
50
43
- console . log ( " About to click login button" ) ; // Debug log
51
+ console . log ( ` About to click login button on ${ this . page . url ( ) } ` ) ; // Debug log
44
52
await loginButton . click ( ) ;
45
53
46
- console . log ( "Waiting for navigation" ) ; // Debug log
54
+ console . log ( "Waiting for navigation away from /login " ) ; // Debug log
47
55
await navigationPromise ;
48
56
49
57
await this . page . goto ( "/marketplace" ) ;
0 commit comments