Skip to content

Commit f4e687c

Browse files
Copilotrenemadsen
andcommitted
Add login page wait to logout and intercept to loginWithNewPassword
Co-authored-by: renemadsen <[email protected]>
1 parent b08d556 commit f4e687c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

eform-client/cypress/e2e/Login.page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class LoginPage {
3939
loginWithNewPassword() {
4040
this.getUsernameInput().type(loginConstants.username);
4141
this.getPasswordInput().type(loginConstants.newPassword);
42+
cy.intercept('POST', '**/api/templates/index').as('login');
4243
this.getLoginButton().click();
44+
cy.wait('@login', { timeout: 60000 });
4345
cy.get('#newEFormBtn').should('be.visible');
4446
}
4547

eform-client/cypress/e2e/Navbar.page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export class Navbar {
9191
this.signOutDropdown().click();
9292
cy.wait(500);
9393
this.logoutBtn().click();
94-
cy.wait(500);
94+
// Wait for login page to be fully loaded
95+
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
9596
}
9697

9798
public goToProfileSettings() {

eform-client/cypress/e2e/e/password-settings.change-password.spec.cy.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ describe('Password settings - Change password', function () {
1515
// Change password to new password
1616
passwordSettingsPage.setNewPassword();
1717

18-
// Logout
18+
// Logout (waits for login page to load)
1919
passwordSettingsPage.Navbar.logout();
20-
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
2120

2221
// Login with new password to verify change worked
2322
cy.visit('http://localhost:4200');
@@ -33,9 +32,8 @@ describe('Password settings - Change password', function () {
3332
// Revert password back to original
3433
passwordSettingsPage.revertToOldPassword();
3534

36-
// Logout
35+
// Logout (waits for login page to load)
3736
passwordSettingsPage.Navbar.logout();
38-
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
3937

4038
// Login with original password to verify revert worked
4139
cy.visit('http://localhost:4200');

0 commit comments

Comments
 (0)