Skip to content

Commit

Permalink
🧪 🪲 Fix failing cypress test (#5674)
Browse files Browse the repository at this point in the history
There's a test that's consistently failing in all my PRs and is related to a timing inssue in the `login` function.

**How to test**

All cypress tests should pass
  • Loading branch information
jpelay authored Jul 24, 2024
1 parent 5918eaf commit 7505588
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/cypress/e2e/tools/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ export function loginForAdmin() {
}

export function login(username, password) {
cy.intercept('/auth/login').as('login')
cy.clearCookies();
cy.clearAllLocalStorage()
cy.clearAllSessionStorage();
goToLogin();
cy.getDataCy('username').type(username);
cy.getDataCy('password').type(password);
cy.getDataCy('login_button').click();
cy.wait(500);
cy.wait('@login');
}

export function logout()
{
cy.intercept('/auth/logout').as('logout')
goToHome();
cy.getDataCy('user_dropdown').click()
cy.getDataCy('logout_button').click()
cy.wait('@logout')
}

export default {loginForUser};

0 comments on commit 7505588

Please sign in to comment.