fix: recursive loggin in upon failed login attempt

pull/166/head
Boaz Poolman 2024-12-30 20:54:54 +00:00
parent 7a0d228f77
commit 54bec393bf
1 changed files with 8 additions and 0 deletions

View File

@ -53,7 +53,15 @@ Cypress.Commands.add('login', (path) => {
cy.get('input[name="password"]').type('Abc12345678');
cy.get('button[type="submit"]').click();
cy.wait('@sessionCheck').its('response.statusCode').should('equal', 200);
// Sometimes the page hangs after logging in.
// If this happens we reload the page and log in again.
cy.reload();
cy.get('body').then(($b) => {
if ($b.text().includes('Log in to your Strapi account')) {
cy.login();
}
});
}
// Register
if ($body.text().includes('Credentials are only used to authenticate in Strapi')) {