Skip to content

Commit a7718c7

Browse files
Copilotrenemadsen
andcommitted
Fix Cypress password test to ensure password is always reverted
Co-authored-by: renemadsen <[email protected]>
1 parent f370e48 commit a7718c7

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

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

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,43 @@ describe('Password settings - Change password', function () {
55
before(() => {
66
cy.visit('http://localhost:4200');
77
loginPage.login();
8-
passwordSettingsPage.Navbar.goToPasswordSettings();
9-
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');
108
});
119

12-
it('should change password to new password', () => {
10+
it('should change password and revert it back', () => {
11+
// Navigate to password settings
12+
passwordSettingsPage.Navbar.goToPasswordSettings();
13+
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');
14+
1315
// Change password to new password
1416
passwordSettingsPage.setNewPassword();
1517

1618
// Logout
1719
passwordSettingsPage.Navbar.logout();
18-
cy.get('#loginBtn').should('be.visible');
20+
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
1921

20-
// Login with new password
22+
// Login with new password to verify change worked
2123
cy.visit('http://localhost:4200');
2224
loginPage.loginWithNewPassword();
2325

2426
// Verify we're logged in by checking for the new eForm button
25-
cy.get('#newEFormBtn').should('be.visible');
27+
cy.get('#newEFormBtn', { timeout: 10000 }).should('be.visible');
2628

27-
// Navigate to password settings
29+
// Navigate to password settings to revert
2830
passwordSettingsPage.Navbar.goToPasswordSettings();
29-
cy.get('#oldPassword').should('be.visible');
30-
});
31-
32-
it('should revert password back to original', () => {
31+
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');
32+
3333
// Revert password back to original
3434
passwordSettingsPage.revertToOldPassword();
3535

3636
// Logout
3737
passwordSettingsPage.Navbar.logout();
38-
cy.get('#loginBtn').should('be.visible');
38+
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
3939

40-
// Login with original password
40+
// Login with original password to verify revert worked
4141
cy.visit('http://localhost:4200');
4242
loginPage.login();
4343

4444
// Verify we're logged in
45-
cy.get('#newEFormBtn').should('be.visible');
46-
47-
// Navigate to password settings to verify we can access it
48-
passwordSettingsPage.Navbar.goToPasswordSettings();
49-
cy.get('#oldPassword').should('be.visible');
45+
cy.get('#newEFormBtn', { timeout: 10000 }).should('be.visible');
5046
});
5147
});

0 commit comments

Comments
 (0)