Skip to content

Commit

Permalink
[5.2][cypress] test for reset password required (joomla#44744)
Browse files Browse the repository at this point in the history
* test for reset password required

* cs
  • Loading branch information
alikon authored Jan 22, 2025
1 parent c8a5474 commit acf8d43
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,41 @@ describe('Test in backend that the user form', () => {
cy.get('#system-message-container').contains('User saved.').should('exist');
});
});

it('can reset password for a user', () => {
cy.db_createUser({
name: 'automated test user',
username: 'test',
email: '[email protected]',
password: '098f6bcd4621d373cade4e832627b4f6',
group_id: 8,
requireReset: 1,
}).then(() => {
// Check that the user is required to reset the password
cy.visit('/administrator/index.php?option=com_users');
cy.contains('Password Reset Required').should('exist');
cy.doAdministratorLogout();

// Check that the user is redirected to the password reset page
cy.visit('administrator/index.php');
cy.get('#mod-login-username').type('test');
cy.get('#mod-login-password').type('test');
cy.get('#btn-login-submit').click();
cy.contains('You are required to reset your password before proceeding.').should('exist');
cy.get('#jform_password').clear().type('testresetpswd');
cy.get('#jform_password2').clear().type('testresetpswd');
cy.clickToolbarButton('Save & Close');
cy.get('#system-message-container').contains('User saved.').should('exist');
cy.doAdministratorLogout();

// Check that the user can login with the new password
cy.visit('administrator/index.php');
cy.get('#mod-login-username').type('test');
cy.get('#mod-login-password').type('testresetpswd');
cy.get('#btn-login-submit').click();

cy.visit('/administrator/index.php?option=com_users');
cy.contains('Password Reset Required').should('not.exist');
});
});
});

0 comments on commit acf8d43

Please sign in to comment.