docbrown/cypress/e2e/seededFlows/adminFlows/users/userAdminUtilitites.js
Rajat Talesra f2cc2ae774
Admin Area: Bulk assign user roles (#19733)
* Bulk Assign Roles UI

* Renaming roles to role

* Added role to multiple users without using note.

* Role note added

* Role blank key fix

* Removed roles

* typo fix

* AuditLog Added

* Optimising code

* Good standing role issue

* Good standing role issue fix

* Minor PR changes based on review

* Added cypress tests

* Added spec tests for BulkAssignRole

* Minor fixes
2023-07-18 18:41:54 +05:30

45 lines
1.2 KiB
JavaScript

/**
* E2E helper function for user admin tests that validates the correct flash success message appears
*
* @param {string} [message="User has been updated"] The expected flash message text
*/
export function verifyAndDismissUserUpdatedMessage(
message = 'User has been updated',
) {
cy.findByTestId('flash-success')
.as('success')
.then((element) => {
expect(element.text().trim()).equal(message);
});
cy.get('@success').within(() => {
cy.findByRole('button', { name: 'Dismiss message' })
.should('have.focus')
.click();
});
cy.findByTestId('flash-success').should('not.exist');
}
/**
* E2E helper function for user admin tests that validates the correct flash danger message appears
*
* @param {string} [message="There was some error"] The expected flash message text
*/
export function verifyAndDismissDangerMessage(
message = 'There was some error',
) {
cy.findByTestId('flash-danger')
.as('danger')
.then((element) => {
expect(element.text().trim()).equal(message);
});
cy.get('@danger').within(() => {
cy.findByRole('button', { name: 'Dismiss message' })
.should('have.focus')
.click();
});
cy.findByTestId('flash-danger').should('not.exist');
}