Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2][cypress] test for reset password required #44744

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 'test@example.com',
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');
});
});
});