Skip to content

Commit

Permalink
Fix auth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Jan 8, 2025
1 parent cefb098 commit 6ac6fa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/auth.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Authentication', () => {
it('should not login with incorrect credentials', () => {
ListPage.navigate();
ListPage.logout();
LoginPage.login('foo', 'bar');
LoginPage.login('foo', 'bar', true);
cy.contains('Authentication failed, please retry');
});
it('should login with correct credentials', () => {
Expand Down
8 changes: 5 additions & 3 deletions cypress/support/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ export default url => ({
cy.get(this.elements.username);
},

login(username = 'login', password = 'password') {
login(username = 'login', password = 'password', shouldFail = false) {
cy.get(this.elements.username).clear().type(username);
cy.get(this.elements.password).clear().type(password);
cy.get(this.elements.submitButton).click();
cy.get(this.elements.title);
cy.get(this.elements.appLoader);
if (!shouldFail) {
cy.get(this.elements.title);
cy.get(this.elements.appLoader);
}
},
});

0 comments on commit 6ac6fa4

Please sign in to comment.