2025-11-12 12:22:28 +00:00
|
|
|
import { commonSelectors } from "Selectors/common";
|
|
|
|
|
import {
|
2025-11-19 12:56:54 +00:00
|
|
|
commonEeSelectors,
|
|
|
|
|
instanceSettingsSelector,
|
2025-11-12 12:22:28 +00:00
|
|
|
} from "Selectors/eeCommon";
|
|
|
|
|
import { usersSelector } from "Selectors/manageUsers";
|
|
|
|
|
import {
|
2025-11-19 12:56:54 +00:00
|
|
|
instanceAllUsersSelectors,
|
|
|
|
|
usersTableElementsInInstance,
|
2025-11-12 12:22:28 +00:00
|
|
|
} from "Selectors/superAdminSelectors";
|
|
|
|
|
import {
|
2025-11-19 12:56:54 +00:00
|
|
|
openInstanceSettings,
|
|
|
|
|
openUserActionMenu,
|
2025-11-12 12:22:28 +00:00
|
|
|
} from "Support/utils/platform/eeCommon";
|
|
|
|
|
import { instanceSettingsText } from "Texts/eeCommon";
|
|
|
|
|
import {
|
2025-11-19 12:56:54 +00:00
|
|
|
instanceAllUsersText,
|
|
|
|
|
usersTableElementsInInstanceText,
|
2025-11-12 12:22:28 +00:00
|
|
|
} from "Texts/superAdminText";
|
|
|
|
|
|
2025-11-19 19:47:29 +00:00
|
|
|
import { onboardingSelectors } from "Selectors/onboarding";
|
|
|
|
|
|
|
|
|
|
import { usersText } from "Texts/manageUsers";
|
|
|
|
|
|
2025-11-12 12:22:28 +00:00
|
|
|
export const openAllUsersPage = () => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openInstanceSettings();
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyAllUsersHeaderUI = () => {
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.get(commonEeSelectors.pageTitle).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceSettingsText.pageTitle
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.allUsersTab).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceAllUsersText.allUsersTabInInstance
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.manageInstanceSettings).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceSettingsText.manageInstanceSettings
|
|
|
|
|
);
|
|
|
|
|
cy.get('[data-cy="breadcrumb-header-settings"]').verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"SettingsAll Users"
|
|
|
|
|
);
|
|
|
|
|
cy.get('[data-cy="title-users-page"]').should(
|
|
|
|
|
"have.text",
|
|
|
|
|
"Manage all users"
|
|
|
|
|
);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyTableControls = () => {
|
2025-11-19 12:56:54 +00:00
|
|
|
for (const element in usersTableElementsInInstance) {
|
|
|
|
|
cy.get(usersTableElementsInInstance[element]).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
usersTableElementsInInstanceText[element]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
cy.get(usersSelector.userFilterInput).should("be.visible");
|
|
|
|
|
cy.get(instanceSettingsSelector.typeColumnHeader).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceSettingsText.typeColumnHeader
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.workspaceColumnHeader).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceSettingsText.workspaceColumnHeader
|
|
|
|
|
);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyUsersFilterOptions = () => {
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.get(usersSelector.userFilterInput).click();
|
|
|
|
|
["All", "Active", "Invited", "Archived"].forEach((opt) => {
|
|
|
|
|
cy.contains(opt).should("be.visible");
|
|
|
|
|
});
|
|
|
|
|
cy.get("body").click(0, 0);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyUserRow = (
|
2025-11-19 12:56:54 +00:00
|
|
|
userName,
|
|
|
|
|
userEmail,
|
|
|
|
|
userType = "workspace",
|
|
|
|
|
userStatus = "active"
|
2025-11-12 12:22:28 +00:00
|
|
|
) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.get(instanceSettingsSelector.userName(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
userName
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.userEmail(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
userEmail
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.userType(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
userType
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceSettingsSelector.userStatus(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
userStatus
|
|
|
|
|
);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const openResetPasswordModal = () => {
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.get(instanceAllUsersSelectors.resetPasswordButton).click();
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyResetPasswordModalUI = (userEmail) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openResetPasswordModal();
|
|
|
|
|
cy.get('[data-cy="reset-password-title"]').should(
|
|
|
|
|
"have.text",
|
|
|
|
|
"Reset password"
|
|
|
|
|
);
|
|
|
|
|
cy.contains(userEmail).should("be.visible");
|
|
|
|
|
cy.contains("label", "Automatically generate a password").should(
|
|
|
|
|
"be.visible"
|
|
|
|
|
);
|
|
|
|
|
cy.contains(
|
|
|
|
|
"You will be able to view and copy the password in the next step"
|
|
|
|
|
).should("be.visible");
|
|
|
|
|
cy.contains("label", "Create password").should("be.visible");
|
|
|
|
|
cy.contains("label", "Create password").click();
|
|
|
|
|
cy.get('[data-cy="password-input"]').should("be.visible");
|
2025-12-11 13:14:35 +00:00
|
|
|
// cy.contains("Password should be at least 5 characters").should("be.visible");
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.get(commonSelectors.cancelButton).should("be.visible");
|
|
|
|
|
cy.get('[data-cy="reset-button"]').should("be.visible");
|
|
|
|
|
cy.get(commonSelectors.cancelButton).click();
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyUserActionMenu = (userName) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openUserActionMenu(userName);
|
|
|
|
|
cy.get(instanceAllUsersSelectors.editUserDetailsButton).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceAllUsersText.editUserDetails
|
|
|
|
|
);
|
|
|
|
|
cy.get(instanceAllUsersSelectors.resetPasswordButton).should("be.visible");
|
|
|
|
|
cy.get(instanceAllUsersSelectors.archiveUserButton).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceAllUsersText.archiveUser
|
|
|
|
|
);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const openArchiveUserModal = (userName) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openUserActionMenu(userName);
|
|
|
|
|
cy.get(instanceAllUsersSelectors.archiveUserButton).click();
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyArchiveUserModalUI = (userName, userEmail) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openArchiveUserModal(userEmail);
|
|
|
|
|
cy.get(commonEeSelectors.modalTitle).contains(
|
|
|
|
|
instanceAllUsersText.archiveModalTitle
|
|
|
|
|
);
|
|
|
|
|
cy.contains(userEmail).should("be.visible");
|
|
|
|
|
cy.contains(instanceAllUsersText.archiveModalMessage).should("be.visible");
|
|
|
|
|
cy.get(commonSelectors.cancelButton).should("be.visible");
|
|
|
|
|
cy.contains("button", instanceAllUsersText.archiveConfirmButton).should(
|
|
|
|
|
"be.visible"
|
|
|
|
|
);
|
|
|
|
|
cy.get(commonSelectors.cancelButton).click();
|
|
|
|
|
|
|
|
|
|
openArchiveUserModal(userEmail);
|
|
|
|
|
cy.get('[data-cy="confirm-button"]').click();
|
2025-11-19 19:47:29 +00:00
|
|
|
cy.verifyToastMessage(
|
|
|
|
|
commonSelectors.toastMessage,
|
|
|
|
|
"User has been archived from this instance successfully!"
|
|
|
|
|
);
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.wait(1000);
|
|
|
|
|
cy.get(instanceSettingsSelector.userStatus(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"archived"
|
|
|
|
|
);
|
2025-11-19 19:47:29 +00:00
|
|
|
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const openEditUserModal = (userEmail) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openUserActionMenu(userEmail);
|
|
|
|
|
cy.get(instanceAllUsersSelectors.editUserDetailsButton).click();
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const updateUserNameAndVerifyChanges = ({
|
2025-11-19 12:56:54 +00:00
|
|
|
currentName,
|
|
|
|
|
userEmail,
|
|
|
|
|
newName,
|
2025-11-12 12:22:28 +00:00
|
|
|
}) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openEditUserModal(userEmail);
|
|
|
|
|
cy.get(commonEeSelectors.modalTitle).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
instanceSettingsText.editModalTitle
|
|
|
|
|
);
|
|
|
|
|
cy.verifyLabel("Name");
|
|
|
|
|
cy.get(instanceAllUsersSelectors.inputFieldFullName)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.should("have.value", currentName)
|
|
|
|
|
.clear()
|
|
|
|
|
.type(newName);
|
|
|
|
|
cy.get(instanceAllUsersSelectors.inputFieldEmail)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.should("have.value", userEmail);
|
|
|
|
|
cy.verifyLabel("Email address");
|
|
|
|
|
cy.get(instanceSettingsSelector.superAdminToggle).should("be.visible");
|
|
|
|
|
cy.get(instanceAllUsersSelectors.updateButton).click();
|
|
|
|
|
cy.contains(newName).should("be.visible");
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const verifyUnarchiveUserModal = (userName, userEmail) => {
|
2025-11-19 12:56:54 +00:00
|
|
|
openArchiveUserModal(userEmail);
|
|
|
|
|
|
|
|
|
|
cy.contains(userEmail).should("be.visible");
|
|
|
|
|
cy.contains(instanceAllUsersText.unarchiveModalMessage).should("be.visible");
|
|
|
|
|
cy.contains("button", instanceAllUsersText.unarchiveConfirmButton).should(
|
|
|
|
|
"be.visible"
|
|
|
|
|
);
|
|
|
|
|
cy.get(commonSelectors.cancelButton).should("be.visible").click();
|
|
|
|
|
|
|
|
|
|
openArchiveUserModal(userEmail);
|
|
|
|
|
cy.get('[data-cy="confirm-button"]').click();
|
2025-11-19 19:47:29 +00:00
|
|
|
|
2025-11-19 12:56:54 +00:00
|
|
|
cy.verifyToastMessage(
|
|
|
|
|
commonSelectors.toastMessage,
|
|
|
|
|
"User has been unarchived from this instance successfully!"
|
|
|
|
|
);
|
2025-11-19 19:47:29 +00:00
|
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
cy.get(instanceSettingsSelector.userStatus(userName)).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"active"
|
|
|
|
|
);
|
2025-11-12 12:22:28 +00:00
|
|
|
};
|
2025-11-19 19:47:29 +00:00
|
|
|
|
|
|
|
|
export const loginAsUser = (email, password = usersText.password) => {
|
|
|
|
|
cy.visit("/my-workspace");
|
|
|
|
|
cy.waitForElement(onboardingSelectors.signupEmailInput);
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
cy.clearAndType(onboardingSelectors.signupEmailInput, email);
|
|
|
|
|
cy.clearAndType(onboardingSelectors.loginPasswordInput, password);
|
|
|
|
|
cy.get(onboardingSelectors.signInButton).click();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const loginAndExpectToast = (email, message, password = usersText.password) => {
|
|
|
|
|
loginAsUser(email, password);
|
|
|
|
|
cy.verifyToastMessage(commonSelectors.toastMessage, message);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const visitAllUsersPage = (loginEmail) => {
|
|
|
|
|
if (loginEmail) {
|
|
|
|
|
cy.apiLogin(loginEmail);
|
|
|
|
|
} else {
|
|
|
|
|
cy.apiLogin();
|
|
|
|
|
}
|
|
|
|
|
cy.visit("settings/all-users");
|
|
|
|
|
cy.waitForElement(commonSelectors.homePageLogo);
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
};
|