11import { Page , Locator } from '@playwright/test' ;
2+ import { BasePage } from '@infinum/e2e-utils/pages' ;
23
3- export class LoginPage {
4- readonly page : Page ;
4+ export class LoginPage extends BasePage {
55 readonly emailInput : Locator ;
66 readonly passwordInput : Locator ;
77 readonly submitButton : Locator ;
88 readonly errorMessage : Locator ;
99
1010 constructor ( page : Page ) {
11- this . page = page ;
11+ super ( page ) ;
1212
1313 // Semantic locators
1414 this . emailInput = page . getByLabel ( 'Email' ) ;
@@ -18,27 +18,21 @@ export class LoginPage {
1818 }
1919
2020 async goto ( ) {
21- await this . page . goto ( '/en/login' ) ;
22-
23- // Wait for page to be fully loaded
24- await this . page . waitForLoadState ( 'networkidle' ) ;
21+ await this . navigateTo ( '/en/login' ) ;
22+ await this . waitForLoad ( ) ;
2523 }
2624
2725 async login ( email : string , password : string ) {
2826 // Check if form elements are available
29- await this . emailInput . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
30- await this . passwordInput . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
31- await this . submitButton . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
27+ await this . waitForVisible ( this . emailInput ) ;
28+ await this . waitForVisible ( this . passwordInput ) ;
29+ await this . waitForVisible ( this . submitButton ) ;
3230
3331 await this . emailInput . fill ( email ) ;
34-
3532 await this . passwordInput . fill ( password ) ;
36-
3733 await this . submitButton . click ( ) ;
3834
3935 // Wait for navigation to complete
40- try {
41- await this . page . waitForLoadState ( 'networkidle' , { timeout : 15000 } ) ;
42- } catch ( error ) { }
36+ await this . waitForNavigation ( ) ;
4337 }
4438}
0 commit comments