File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export class LoginPage{
77 readonly continueButton : Locator ;
88 readonly continue : Locator ;
99 readonly invalidUserError : Locator ;
10+ readonly invalidPasswordError : Locator ;
1011
1112 constructor ( page : Page ) {
1213 this . page = page ;
@@ -15,6 +16,7 @@ export class LoginPage{
1516 this . passwordInput = page . getByRole ( 'textbox' , { name : 'Password' } ) ;
1617 this . continue = page . getByRole ( 'button' , { name : 'Continue' } ) ;
1718 this . invalidUserError = page . getByText ( 'Enter a valid email' ) ;
19+ this . invalidPasswordError = page . getByText ( 'Your email or password is incorrect. Try again.' ) ;
1820 }
1921
2022 async fillEmail ( email : string ) {
@@ -53,6 +55,10 @@ export class LoginPage{
5355 async verifyInvalidUserLogin ( ) {
5456 await expect ( this . invalidUserError ) . toBeVisible ( ) ;
5557 }
58+
59+ async verifyInvalidPassword ( ) {
60+ await expect ( this . invalidPasswordError ) . toBeVisible ( ) ;
61+ }
5662}
5763
5864export default LoginPage ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ let loginPage: LoginPage;
77const password = process . env . PASSWORD ! ;
88const username = process . env . USERNAME ! ;
99const invalidUser = userData . INVALID_USER ;
10+ const invalidPassword = userData . INVALID_PASSWORD ;
1011
1112test . beforeEach ( async ( { page } ) => {
1213 await page . goto ( './login' ) ;
@@ -19,8 +20,13 @@ test.beforeEach(async ({ page }) => {
1920 await loginPage . verifyLogin ( ) ;
2021 } ) ;
2122
22- test ( `unsuccessful login` , async ( ) => {
23+ test ( `unsuccessful login -invalid user email ` , async ( ) => {
2324 await loginPage . loginWithInvalidUser ( invalidUser ) ;
2425 await loginPage . verifyInvalidUserLogin ( ) ;
2526 } ) ;
27+
28+ test ( `unsuccessful login -invalid password` , async ( ) => {
29+ await loginPage . doLogin ( username , invalidPassword ) ;
30+ await loginPage . verifyInvalidPassword ( ) ;
31+ } ) ;
2632 } ) ;
You can’t perform that action at this time.
0 commit comments