Skip to content

Commit

Permalink
#8700 Give Cypress a chance to retry
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Feb 28, 2023
1 parent ec81829 commit 072e39e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ Cypress.Commands.add('createUser', user => {
if (!('password' in user)) user.password = user.username + user.username;
if (!('password2' in user)) user.password2 = user.username + user.username;
if (!('roles' in user)) user.roles = [];
cy.get('div[id=userGridContainer] a:contains("Add User")').click();
const addUser = cy.get('div[id=userGridContainer] a:contains("Add User")');
addUser.click();
cy.wait(2000); // Avoid occasional glitches with given name field
cy.get('input[id^="givenName-en_US"]').type(user.givenName, {delay: 0});
cy.get('input[id^="familyName-en_US"]').type(user.familyName, {delay: 0});
Expand All @@ -398,6 +399,8 @@ Cypress.Commands.add('createUser', user => {
cy.route('POST', '**/grid/settings/user/user-grid/update-user-roles*').as('rolesSaved');
cy.get('form[id=userRoleForm] button[id^=submitFormButton]').click();
cy.wait('@rolesSaved').its('status').should('eq', 200);
// Once the interface refreshes, the "Add User" should be removed from the DOM and recreated.
addUser.should('not.be.visible');
});

Cypress.Commands.add('flushNotifications', function() {
Expand Down

0 comments on commit 072e39e

Please sign in to comment.