-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kseniia Krytska
committed
Feb 20, 2025
1 parent
f07058c
commit 8787461
Showing
5 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
/// <reference types="cypress" /> | ||
import SignInPage from '../pageObjects/signInObjects'; | ||
import SecurePage from '../pageObjects/secureObjects'; | ||
const signInPage = new SignInPage(); | ||
|
||
const securePage = new SecurePage(); | ||
|
||
const username = 'tomsmith'; | ||
const password = 'SuperSecretPassword!'; | ||
|
||
describe('Sign In page', () => { | ||
beforeEach(() => { | ||
cy.visit('/login'); | ||
}); | ||
|
||
it('should login with valid credentials', () => { | ||
signInPage.typeInUsernameField(username); | ||
signInPage.typeInPasswordField(password); | ||
signInPage.clickLogin(); | ||
signInPage.assertNotification('You logged into a secure area!'); | ||
cy.assertUrl('/secure'); | ||
}); | ||
|
||
it('', () => { | ||
it('should not login with invalid credentials', () => { | ||
signInPage.typeInUsernameField('myusername'); | ||
signInPage.typeInPasswordField('jhHJu9=_'); | ||
signInPage.clickLogin(); | ||
signInPage.assertNotification('Your username is invalid!'); | ||
cy.assertUrl('/login'); | ||
}); | ||
|
||
it('should logout', () => { | ||
signInPage.typeInUsernameField(username); | ||
signInPage.typeInPasswordField(password); | ||
signInPage.clickLogin(); | ||
securePage.logOutButton.click(); | ||
signInPage.assertNotification('You logged out of the secure area!'); | ||
cy.assertUrl('/login'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
export default class SecurePage { | ||
get logOutButton() { | ||
return cy.get('[class="button secondary radius"]'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="cypress" /> | ||
|
||
export default class SignInPage { | ||
typeInUsernameField(username) { | ||
cy.get('#username').type(username); | ||
} | ||
|
||
typeInPasswordField(password) { | ||
cy.get('#password').type(password); | ||
} | ||
|
||
clickLogin() { | ||
cy.get('.radius').click(); | ||
} | ||
|
||
assertNotification(text) { | ||
cy.get('#flash').assertNotifText(text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters