forked from joomla/joomla-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.2][cypress] test for reset password required (joomla#44744)
* test for reset password required * cs
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'); | ||
}); | ||
}); | ||
}); |