2021-09-27 10:04:21 +00:00
|
|
|
import { SET_PASSWORD } from "../../elements/account/setPassword";
|
|
|
|
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
2023-03-09 08:18:07 +00:00
|
|
|
import { INVITE_STAFF_MEMBER_FORM_SELECTORS } from "../../elements/staffMembers/inviteStaffMemberForm";
|
|
|
|
import { STAFF_MEMBER_DETAILS_SELECTORS } from "../../elements/staffMembers/staffMemberDetails";
|
2021-09-27 10:04:21 +00:00
|
|
|
import { userDetailsUrl } from "../../fixtures/urlList";
|
|
|
|
|
|
|
|
export function fillUpSetPassword(password) {
|
|
|
|
cy.get(SET_PASSWORD.confirmPasswordInput)
|
|
|
|
.type(password)
|
|
|
|
.get(SET_PASSWORD.passwordInput)
|
|
|
|
.type(password)
|
2022-01-31 08:37:49 +00:00
|
|
|
.addAliasToGraphRequest("setPassword")
|
2021-09-27 10:04:21 +00:00
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
|
|
|
.click()
|
2022-01-31 08:37:49 +00:00
|
|
|
.waitForRequestAndCheckIfNoErrors("@setPassword");
|
2021-09-27 10:04:21 +00:00
|
|
|
}
|
|
|
|
|
2022-12-23 10:30:21 +00:00
|
|
|
export function fillUpUserDetailsAndAddFirstPermission(
|
|
|
|
firstName,
|
|
|
|
lastName,
|
|
|
|
email,
|
|
|
|
) {
|
|
|
|
fillUpOnlyUserDetails(firstName, lastName, email);
|
|
|
|
cy.confirmationMessageShouldDisappear()
|
2023-03-09 08:18:07 +00:00
|
|
|
.fillAutocompleteSelect(STAFF_MEMBER_DETAILS_SELECTORS.permissionsSelect)
|
|
|
|
.get(STAFF_MEMBER_DETAILS_SELECTORS.permissionsSelect)
|
2022-01-31 08:37:49 +00:00
|
|
|
.find("input")
|
|
|
|
.first()
|
|
|
|
.type("{esc}", { force: true })
|
2021-09-27 10:04:21 +00:00
|
|
|
.addAliasToGraphRequest("StaffMemberUpdate")
|
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
|
|
|
.click()
|
|
|
|
.waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
|
|
|
|
}
|
|
|
|
|
2022-12-23 10:30:21 +00:00
|
|
|
export function fillUpOnlyUserDetails(firstName, lastName, email) {
|
2023-03-09 08:18:07 +00:00
|
|
|
cy.get(INVITE_STAFF_MEMBER_FORM_SELECTORS.firstNameInput)
|
2022-12-23 10:30:21 +00:00
|
|
|
.type(firstName)
|
2023-03-09 08:18:07 +00:00
|
|
|
.get(INVITE_STAFF_MEMBER_FORM_SELECTORS.lastNameInput)
|
2022-12-23 10:30:21 +00:00
|
|
|
.type(lastName)
|
2023-03-09 08:18:07 +00:00
|
|
|
.get(INVITE_STAFF_MEMBER_FORM_SELECTORS.emailInput)
|
2022-12-23 10:30:21 +00:00
|
|
|
.type(email)
|
|
|
|
.get(BUTTON_SELECTORS.submit)
|
|
|
|
.click();
|
|
|
|
}
|
|
|
|
|
2021-09-27 10:04:21 +00:00
|
|
|
export function updateUserActiveFlag(userId) {
|
|
|
|
cy.visitAndWaitForProgressBarToDisappear(userDetailsUrl(userId))
|
2023-03-09 08:18:07 +00:00
|
|
|
.get(STAFF_MEMBER_DETAILS_SELECTORS.isActiveCheckBox)
|
2021-09-27 10:04:21 +00:00
|
|
|
.click()
|
|
|
|
.addAliasToGraphRequest("StaffMemberUpdate")
|
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
|
|
|
.click()
|
|
|
|
.waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
|
|
|
|
}
|