Skip to content

Commit acf8d43

Browse files
authored
[5.2][cypress] test for reset password required (#44744)
* test for reset password required * cs
1 parent c8a5474 commit acf8d43

File tree

1 file changed

+37
-0
lines changed
  • tests/System/integration/administrator/components/com_users

1 file changed

+37
-0
lines changed

tests/System/integration/administrator/components/com_users/User.cy.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,41 @@ describe('Test in backend that the user form', () => {
3030
cy.get('#system-message-container').contains('User saved.').should('exist');
3131
});
3232
});
33+
34+
it('can reset password for a user', () => {
35+
cy.db_createUser({
36+
name: 'automated test user',
37+
username: 'test',
38+
39+
password: '098f6bcd4621d373cade4e832627b4f6',
40+
group_id: 8,
41+
requireReset: 1,
42+
}).then(() => {
43+
// Check that the user is required to reset the password
44+
cy.visit('/administrator/index.php?option=com_users');
45+
cy.contains('Password Reset Required').should('exist');
46+
cy.doAdministratorLogout();
47+
48+
// Check that the user is redirected to the password reset page
49+
cy.visit('administrator/index.php');
50+
cy.get('#mod-login-username').type('test');
51+
cy.get('#mod-login-password').type('test');
52+
cy.get('#btn-login-submit').click();
53+
cy.contains('You are required to reset your password before proceeding.').should('exist');
54+
cy.get('#jform_password').clear().type('testresetpswd');
55+
cy.get('#jform_password2').clear().type('testresetpswd');
56+
cy.clickToolbarButton('Save & Close');
57+
cy.get('#system-message-container').contains('User saved.').should('exist');
58+
cy.doAdministratorLogout();
59+
60+
// Check that the user can login with the new password
61+
cy.visit('administrator/index.php');
62+
cy.get('#mod-login-username').type('test');
63+
cy.get('#mod-login-password').type('testresetpswd');
64+
cy.get('#btn-login-submit').click();
65+
66+
cy.visit('/administrator/index.php?option=com_users');
67+
cy.contains('Password Reset Required').should('not.exist');
68+
});
69+
});
3370
});

0 commit comments

Comments
 (0)