Skip to content

Commit 54bec39

Browse files
committed
fix: recursive loggin in upon failed login attempt
1 parent 7a0d228 commit 54bec39

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cypress/support/commands.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ Cypress.Commands.add('login', (path) => {
5353
cy.get('input[name="password"]').type('Abc12345678');
5454
cy.get('button[type="submit"]').click();
5555
cy.wait('@sessionCheck').its('response.statusCode').should('equal', 200);
56+
57+
// Sometimes the page hangs after logging in.
58+
// If this happens we reload the page and log in again.
5659
cy.reload();
60+
cy.get('body').then(($b) => {
61+
if ($b.text().includes('Log in to your Strapi account')) {
62+
cy.login();
63+
}
64+
});
5765
}
5866
// Register
5967
if ($body.text().includes('Credentials are only used to authenticate in Strapi')) {

0 commit comments

Comments
 (0)