2023-06-20 12:21:49 +00:00
|
|
|
import { v4 as uuid } from "uuid";
|
|
|
|
|
2022-12-07 15:28:28 +00:00
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
2021-03-03 19:12:16 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2023-12-19 08:25:54 +00:00
|
|
|
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import CreateUserPage from "../support/pages/admin-ui/manage/users/CreateUserPage";
|
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin-ui/ListingPage";
|
|
|
|
import UserDetailsPage from "../support/pages/admin-ui/manage/users/user_details/UserDetailsPage";
|
|
|
|
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
|
2021-03-11 20:23:08 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-12-07 15:28:28 +00:00
|
|
|
import UserGroupsPage from "../support/pages/admin-ui/manage/users/UserGroupsPage";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-12-07 15:28:28 +00:00
|
|
|
import CredentialsPage from "../support/pages/admin-ui/manage/users/CredentialsPage";
|
|
|
|
import UsersPage from "../support/pages/admin-ui/manage/users/UsersPage";
|
|
|
|
import IdentityProviderLinksTab from "../support/pages/admin-ui/manage/users/user_details/tabs/IdentityProviderLinksTab";
|
2023-03-30 08:44:36 +00:00
|
|
|
import RoleMappingTab from "../support/pages/admin-ui/manage/RoleMappingTab";
|
|
|
|
import CommonPage from "../support/pages/CommonPage";
|
2021-04-14 18:19:39 +00:00
|
|
|
|
|
|
|
let groupName = "group";
|
2021-04-19 19:53:28 +00:00
|
|
|
let groupsList: string[] = [];
|
2021-04-14 18:19:39 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
describe("User creation", () => {
|
2021-03-03 19:12:16 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2023-12-19 08:25:54 +00:00
|
|
|
const realmSettingsPage = new RealmSettingsPage();
|
2021-03-04 14:26:21 +00:00
|
|
|
const createUserPage = new CreateUserPage();
|
2021-04-14 18:19:39 +00:00
|
|
|
const userGroupsPage = new UserGroupsPage();
|
2021-03-04 14:26:21 +00:00
|
|
|
const masthead = new Masthead();
|
2021-03-11 20:23:08 +00:00
|
|
|
const modalUtils = new ModalUtils();
|
2021-03-04 14:26:21 +00:00
|
|
|
const listingPage = new ListingPage();
|
2021-03-11 20:23:08 +00:00
|
|
|
const userDetailsPage = new UserDetailsPage();
|
2021-12-21 06:22:44 +00:00
|
|
|
const credentialsPage = new CredentialsPage();
|
2023-12-19 08:25:54 +00:00
|
|
|
const attributesTab = new AttributesTab(true);
|
2022-08-22 16:05:57 +00:00
|
|
|
const usersPage = new UsersPage();
|
|
|
|
const identityProviderLinksTab = new IdentityProviderLinksTab();
|
2021-03-04 14:26:21 +00:00
|
|
|
|
|
|
|
let itemId = "user_crud";
|
2022-02-28 17:48:52 +00:00
|
|
|
let itemIdWithGroups = "user_with_groups_crud";
|
2021-12-21 06:22:44 +00:00
|
|
|
let itemIdWithCred = "user_crud_cred";
|
2022-03-07 14:32:34 +00:00
|
|
|
const itemCredential = "Password";
|
2021-03-03 19:12:16 +00:00
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
before(async () => {
|
2022-02-02 11:44:52 +00:00
|
|
|
for (let i = 0; i <= 2; i++) {
|
2023-06-20 12:21:49 +00:00
|
|
|
groupName += "_" + uuid();
|
2023-02-10 10:10:35 +00:00
|
|
|
await adminClient.createGroup(groupName);
|
2022-02-02 11:44:52 +00:00
|
|
|
groupsList = [...groupsList, groupName];
|
|
|
|
}
|
|
|
|
});
|
2021-03-04 14:26:21 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
2022-02-02 11:44:52 +00:00
|
|
|
sidebarPage.goToUsers();
|
|
|
|
});
|
2021-03-04 18:49:05 +00:00
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
after(() => adminClient.deleteGroups());
|
2021-03-04 18:49:05 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Go to create User page", () => {
|
|
|
|
createUserPage.goToCreateUser();
|
|
|
|
cy.url().should("include", "users/add-user");
|
2021-04-20 12:22:36 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
// Verify Cancel button works
|
|
|
|
createUserPage.cancel();
|
|
|
|
cy.url().should("not.include", "/add-user");
|
|
|
|
});
|
2021-04-20 12:22:36 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Create user test", () => {
|
2023-06-20 12:21:49 +00:00
|
|
|
itemId += "_" + uuid();
|
2022-02-02 11:44:52 +00:00
|
|
|
// Create
|
|
|
|
createUserPage.goToCreateUser();
|
2021-04-20 12:22:36 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
createUserPage.createUser(itemId);
|
2021-04-20 12:22:36 +00:00
|
|
|
|
2024-02-09 16:34:55 +00:00
|
|
|
createUserPage.create();
|
2022-02-28 17:48:52 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has been created");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Create user with groups test", () => {
|
2023-06-20 12:21:49 +00:00
|
|
|
itemIdWithGroups += uuid();
|
2022-02-28 17:48:52 +00:00
|
|
|
// Add user from search bar
|
|
|
|
createUserPage.goToCreateUser();
|
|
|
|
|
|
|
|
createUserPage.createUser(itemIdWithGroups);
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
createUserPage.toggleAddGroupModal();
|
2021-03-04 14:26:21 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
const groupsListCopy = groupsList.slice(0, 1);
|
2021-03-04 14:26:21 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
groupsListCopy.forEach((element) => {
|
|
|
|
cy.findByTestId(`${element}-check`).click();
|
2021-03-11 20:23:08 +00:00
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
createUserPage.joinGroups();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2024-02-09 16:34:55 +00:00
|
|
|
createUserPage.create();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been created");
|
|
|
|
});
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Create user with credentials test", () => {
|
2023-06-20 12:21:49 +00:00
|
|
|
itemIdWithCred += "_" + uuid();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-28 17:48:52 +00:00
|
|
|
// Add user from search bar
|
2022-02-02 11:44:52 +00:00
|
|
|
createUserPage.goToCreateUser();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
createUserPage.createUser(itemIdWithCred);
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
userDetailsPage.fillUserData();
|
2024-02-09 16:34:55 +00:00
|
|
|
createUserPage.create();
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been created");
|
|
|
|
sidebarPage.waitForPageLoad();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
credentialsPage
|
|
|
|
.goToCredentialsTab()
|
|
|
|
.clickEmptyStatePasswordBtn()
|
|
|
|
.fillPasswordForm()
|
|
|
|
.clickConfirmationBtn()
|
|
|
|
.clickSetPasswordBtn();
|
|
|
|
});
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-28 17:48:52 +00:00
|
|
|
it("Search existing user test", () => {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Search non-existing user test", () => {
|
|
|
|
listingPage.searchItem("user_DNE");
|
2024-04-04 11:28:09 +00:00
|
|
|
listingPage.assertNoResults();
|
2022-02-28 17:48:52 +00:00
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("User details test", () => {
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
listingPage.goToItemDetails(itemId);
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
userDetailsPage.fillUserData().save();
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been saved");
|
2021-03-23 19:02:27 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
sidebarPage.goToUsers();
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
});
|
2021-10-25 14:38:54 +00:00
|
|
|
|
2023-12-19 08:25:54 +00:00
|
|
|
it("Select Unmanaged attributes", () => {
|
|
|
|
sidebarPage.goToRealmSettings();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
realmSettingsPage.fillUnmanagedAttributes("Enabled");
|
|
|
|
realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
|
|
|
|
masthead.checkNotificationMessage("Realm successfully updated", true);
|
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("User attributes test", () => {
|
|
|
|
listingPage.goToItemDetails(itemId);
|
2021-10-25 14:38:54 +00:00
|
|
|
|
2024-01-10 15:26:13 +00:00
|
|
|
attributesTab
|
|
|
|
.goToAttributesTab()
|
|
|
|
.addAttribute("key_test", "value_test")
|
|
|
|
.save();
|
2021-10-25 14:38:54 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been saved");
|
2024-01-10 15:26:13 +00:00
|
|
|
|
2024-02-28 15:42:48 +00:00
|
|
|
attributesTab
|
|
|
|
.addAttribute("LDAP_ID", "value_test")
|
|
|
|
.addAttribute("LDAP_ID", "another_value_test")
|
|
|
|
.addAttribute("c", "d")
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has not been saved: ");
|
|
|
|
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-helper-text__item-text")
|
2024-02-28 15:42:48 +00:00
|
|
|
.filter(':contains("Update of read-only attribute rejected")')
|
|
|
|
.should("have.length", 2);
|
|
|
|
|
|
|
|
cy.reload();
|
|
|
|
|
2024-01-10 15:26:13 +00:00
|
|
|
userDetailsPage.goToDetailsTab();
|
|
|
|
attributesTab
|
|
|
|
.goToAttributesTab()
|
|
|
|
.checkAttribute("key_test", true)
|
|
|
|
.deleteAttribute(0);
|
|
|
|
|
|
|
|
userDetailsPage.goToDetailsTab();
|
|
|
|
attributesTab.goToAttributesTab().checkAttribute("key_test", false);
|
2022-02-02 11:44:52 +00:00
|
|
|
});
|
2021-10-28 18:49:19 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("User attributes with multiple values test", () => {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
2021-10-28 18:49:19 +00:00
|
|
|
|
2022-03-06 15:25:37 +00:00
|
|
|
cy.intercept("PUT", `/admin/realms/master/users/*`).as("save-user");
|
2021-10-28 18:49:19 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
const attributeKey = "key-multiple";
|
|
|
|
attributesTab
|
|
|
|
.goToAttributesTab()
|
2022-06-27 08:47:41 +00:00
|
|
|
.addAttribute(attributeKey, "other value")
|
|
|
|
.save();
|
2021-10-28 18:49:19 +00:00
|
|
|
|
2022-10-06 14:18:33 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been saved");
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.wait("@save-user").should(({ request, response }) => {
|
|
|
|
expect(response?.statusCode).to.equal(204);
|
2022-06-13 10:08:13 +00:00
|
|
|
expect(request.body.attributes, "response body").deep.equal({
|
2022-02-02 11:44:52 +00:00
|
|
|
"key-multiple": ["other value"],
|
2021-10-28 18:49:19 +00:00
|
|
|
});
|
|
|
|
});
|
2022-02-02 11:44:52 +00:00
|
|
|
});
|
2021-04-14 18:19:39 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Add user to groups test", () => {
|
|
|
|
// Go to user groups
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
2021-04-19 19:53:28 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
userGroupsPage.toggleAddGroupModal();
|
2021-04-20 12:22:36 +00:00
|
|
|
|
2022-12-07 09:06:35 +00:00
|
|
|
const groupsListCopy = groupsList.slice(0, 3);
|
2021-04-19 19:53:28 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
groupsListCopy.forEach((element) => {
|
|
|
|
cy.findByTestId(`${element}-check`).click();
|
2021-04-14 18:19:39 +00:00
|
|
|
});
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
userGroupsPage.joinGroups();
|
|
|
|
});
|
2021-04-14 18:19:39 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Leave group test", () => {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
// Go to user groups
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
cy.findByTestId(`leave-${groupsList[0]}`).click();
|
2022-02-23 14:46:56 +00:00
|
|
|
cy.findByTestId("confirm").click({ force: true });
|
2022-02-02 11:44:52 +00:00
|
|
|
});
|
2021-04-14 18:39:21 +00:00
|
|
|
|
2022-12-07 09:06:35 +00:00
|
|
|
it("search and leave group", () => {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
|
|
|
|
listingPage.searchItem("group");
|
|
|
|
userGroupsPage.leaveGroupButtonDisabled();
|
|
|
|
|
|
|
|
listingPage.clickTableHeaderItemCheckboxAllRows();
|
|
|
|
userGroupsPage.leaveGroupButtonEnabled();
|
|
|
|
userGroupsPage.leaveGroup();
|
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Go to user consents test", () => {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
2021-04-14 18:39:21 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
listingPage.goToItemDetails(itemId);
|
2021-04-14 18:39:21 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.findByTestId("user-consents-tab").click();
|
|
|
|
cy.findByTestId("empty-state").contains("No consents");
|
|
|
|
});
|
|
|
|
|
2022-08-22 16:05:57 +00:00
|
|
|
describe("Identity provider links", () => {
|
|
|
|
const usernameIdpLinksTest = "user_idp_link_test";
|
|
|
|
const identityProviders = [
|
|
|
|
{ testName: "Bitbucket", displayName: "BitBucket", alias: "bitbucket" },
|
|
|
|
{ testName: "Facebook", displayName: "Facebook", alias: "facebook" },
|
|
|
|
{
|
|
|
|
testName: "Keycloak-oidc",
|
|
|
|
displayName: "Keycloak OpenID Connect",
|
|
|
|
alias: "keycloak-oidc",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
await Promise.all([
|
|
|
|
adminClient.createUser({
|
|
|
|
username: usernameIdpLinksTest,
|
|
|
|
enabled: true,
|
|
|
|
}),
|
|
|
|
identityProviders.forEach((idp) =>
|
2023-07-11 14:03:21 +00:00
|
|
|
adminClient.createIdentityProvider(idp.displayName, idp.alias),
|
2022-08-22 16:05:57 +00:00
|
|
|
),
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2022-08-25 15:46:38 +00:00
|
|
|
after(async () => {
|
|
|
|
await adminClient.deleteUser(usernameIdpLinksTest);
|
|
|
|
await Promise.all(
|
|
|
|
identityProviders.map((idp) =>
|
2023-07-11 14:03:21 +00:00
|
|
|
adminClient.deleteIdentityProvider(idp.alias),
|
|
|
|
),
|
2022-08-25 15:46:38 +00:00
|
|
|
);
|
|
|
|
});
|
2022-08-22 16:05:57 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(usernameIdpLinksTest);
|
|
|
|
userDetailsPage.goToIdentityProviderLinksTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
identityProviders.forEach(($idp, linkedIdpsCount) => {
|
|
|
|
it(`Link account to IdP: ${$idp.testName}`, () => {
|
|
|
|
const availableIdpsCount = identityProviders.length - linkedIdpsCount;
|
|
|
|
|
|
|
|
if (linkedIdpsCount == 0) {
|
|
|
|
identityProviderLinksTab.assertNoIdentityProvidersLinkedMessageExist(
|
2023-07-11 14:03:21 +00:00
|
|
|
true,
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
identityProviderLinksTab
|
|
|
|
.assertAvailableIdentityProvidersItemsEqual(availableIdpsCount)
|
|
|
|
.clickLinkAccount($idp.testName)
|
|
|
|
.assertLinkAccountModalTitleEqual($idp.testName)
|
|
|
|
.assertLinkAccountModalIdentityProviderInputEqual($idp.testName)
|
|
|
|
.typeLinkAccountModalUserId("testUserId")
|
|
|
|
.typeLinkAccountModalUsername("testUsername")
|
|
|
|
.clickLinkAccountModalLinkBtn()
|
|
|
|
.assertNotificationIdentityProviderLinked()
|
|
|
|
.assertLinkedIdentityProvidersItemsEqual(linkedIdpsCount + 1)
|
|
|
|
.assertAvailableIdentityProvidersItemsEqual(availableIdpsCount - 1)
|
|
|
|
.assertLinkedIdentityProviderExist($idp.testName, true)
|
|
|
|
.assertAvailableIdentityProviderExist($idp.testName, false);
|
|
|
|
if (availableIdpsCount - 1 == 0) {
|
|
|
|
identityProviderLinksTab.assertNoAvailableIdentityProvidersMessageExist(
|
2023-07-11 14:03:21 +00:00
|
|
|
true,
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Link account to already added IdP fail", () => {
|
|
|
|
cy.wrap(null).then(() =>
|
|
|
|
adminClient.unlinkAccountIdentityProvider(
|
|
|
|
usernameIdpLinksTest,
|
2023-07-11 14:03:21 +00:00
|
|
|
identityProviders[0].displayName,
|
|
|
|
),
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
sidebarPage.goToUsers();
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(usernameIdpLinksTest);
|
|
|
|
userDetailsPage.goToIdentityProviderLinksTab();
|
|
|
|
|
|
|
|
cy.wrap(null).then(() =>
|
|
|
|
adminClient.linkAccountIdentityProvider(
|
|
|
|
usernameIdpLinksTest,
|
2023-07-11 14:03:21 +00:00
|
|
|
identityProviders[0].displayName,
|
|
|
|
),
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
identityProviderLinksTab
|
|
|
|
.clickLinkAccount(identityProviders[0].testName)
|
|
|
|
.assertLinkAccountModalTitleEqual(identityProviders[0].testName)
|
|
|
|
.assertLinkAccountModalIdentityProviderInputEqual(
|
2023-07-11 14:03:21 +00:00
|
|
|
identityProviders[0].testName,
|
2022-08-22 16:05:57 +00:00
|
|
|
)
|
|
|
|
.typeLinkAccountModalUserId("testUserId")
|
|
|
|
.typeLinkAccountModalUsername("testUsername")
|
|
|
|
.clickLinkAccountModalLinkBtn()
|
|
|
|
.assertNotificationAlreadyLinkedError();
|
|
|
|
modalUtils.cancelModal();
|
|
|
|
});
|
|
|
|
|
|
|
|
identityProviders.forEach(($idp, availableIdpsCount) => {
|
|
|
|
it(`Unlink account from IdP: ${$idp.testName}`, () => {
|
|
|
|
const linkedIdpsCount = identityProviders.length - availableIdpsCount;
|
|
|
|
|
|
|
|
if (availableIdpsCount == 0) {
|
|
|
|
identityProviderLinksTab.assertNoAvailableIdentityProvidersMessageExist(
|
2023-07-11 14:03:21 +00:00
|
|
|
true,
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
identityProviderLinksTab
|
|
|
|
.assertAvailableIdentityProvidersItemsEqual(availableIdpsCount)
|
|
|
|
.clickUnlinkAccount($idp.testName)
|
|
|
|
.assertUnLinkAccountModalTitleEqual($idp.testName)
|
|
|
|
.clickUnlinkAccountModalUnlinkBtn()
|
|
|
|
.assertNotificationPoviderLinkRemoved()
|
|
|
|
.assertLinkedIdentityProvidersItemsEqual(linkedIdpsCount - 1)
|
|
|
|
.assertAvailableIdentityProvidersItemsEqual(availableIdpsCount + 1)
|
|
|
|
.assertLinkedIdentityProviderExist($idp.testName, false)
|
|
|
|
.assertAvailableIdentityProviderExist($idp.testName, true);
|
|
|
|
if (linkedIdpsCount - 1 == 0) {
|
|
|
|
identityProviderLinksTab.assertNoIdentityProvidersLinkedMessageExist(
|
2023-07-11 14:03:21 +00:00
|
|
|
true,
|
2022-08-22 16:05:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Reset credential of User with empty state", () => {
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
credentialsPage
|
|
|
|
.goToCredentialsTab()
|
|
|
|
.clickEmptyStateResetBtn()
|
|
|
|
.fillResetCredentialForm();
|
2022-02-09 14:39:10 +00:00
|
|
|
masthead.checkNotificationMessage(
|
2023-07-11 14:03:21 +00:00
|
|
|
"Failed: Failed to send execute actions email",
|
2022-02-09 14:39:10 +00:00
|
|
|
);
|
2022-02-02 11:44:52 +00:00
|
|
|
});
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Reset credential of User with existing credentials", () => {
|
|
|
|
listingPage.goToItemDetails(itemIdWithCred);
|
|
|
|
credentialsPage
|
|
|
|
.goToCredentialsTab()
|
|
|
|
.clickResetBtn()
|
|
|
|
.fillResetCredentialForm();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-09 14:39:10 +00:00
|
|
|
masthead.checkNotificationMessage(
|
2023-07-11 14:03:21 +00:00
|
|
|
"Failed: Failed to send execute actions email",
|
2022-02-09 14:39:10 +00:00
|
|
|
);
|
2022-02-02 11:44:52 +00:00
|
|
|
});
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-03-07 14:32:34 +00:00
|
|
|
it("Edit credential label", () => {
|
|
|
|
listingPage.goToItemDetails(itemIdWithCred);
|
|
|
|
credentialsPage
|
|
|
|
.goToCredentialsTab()
|
|
|
|
.clickEditCredentialLabelBtn()
|
|
|
|
.fillEditCredentialForm()
|
|
|
|
.clickEditConfirmationBtn();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
2023-07-11 14:03:21 +00:00
|
|
|
"The user label has been changed successfully.",
|
2022-03-07 14:32:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Show credential data dialog", () => {
|
|
|
|
listingPage.goToItemDetails(itemIdWithCred);
|
|
|
|
credentialsPage
|
|
|
|
.goToCredentialsTab()
|
|
|
|
.clickShowDataDialogBtn()
|
|
|
|
.clickCloseDataDialogBtn();
|
|
|
|
});
|
|
|
|
|
2022-08-12 10:52:41 +00:00
|
|
|
it("Delete credential", () => {
|
2022-03-07 14:32:34 +00:00
|
|
|
listingPage.goToItemDetails(itemIdWithCred);
|
|
|
|
credentialsPage.goToCredentialsTab();
|
2022-10-07 15:00:58 +00:00
|
|
|
|
2022-08-12 10:52:41 +00:00
|
|
|
cy.wait(2000);
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get("table")
|
|
|
|
.contains(itemCredential)
|
|
|
|
.parentsUntil("tbody")
|
|
|
|
.find(".pf-v5-c-dropdown__toggle")
|
|
|
|
.click();
|
|
|
|
cy.get("table").contains("Delete").click();
|
2022-03-07 14:32:34 +00:00
|
|
|
modalUtils.checkModalTitle("Delete credentials?").confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
2023-07-11 14:03:21 +00:00
|
|
|
"The credentials has been deleted successfully.",
|
2022-03-07 14:32:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-02-28 17:48:52 +00:00
|
|
|
it("Delete user from search bar test", () => {
|
2022-02-02 11:44:52 +00:00
|
|
|
// Delete
|
2022-02-28 17:48:52 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.deleteItemFromSearchBar(itemId);
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
modalUtils.checkModalTitle("Delete user?").confirmModal();
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been deleted");
|
|
|
|
sidebarPage.waitForPageLoad();
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
listingPage.itemExist(itemId, false);
|
|
|
|
});
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-28 17:48:52 +00:00
|
|
|
it("Delete user with groups test", () => {
|
|
|
|
// Delete
|
|
|
|
listingPage.deleteItem(itemIdWithGroups);
|
|
|
|
|
|
|
|
modalUtils.checkModalTitle("Delete user?").confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has been deleted");
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
listingPage.itemExist(itemIdWithGroups, false);
|
|
|
|
});
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
it("Delete user with credential test", () => {
|
|
|
|
// Delete
|
|
|
|
listingPage.deleteItem(itemIdWithCred);
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
modalUtils.checkModalTitle("Delete user?").confirmModal();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
masthead.checkNotificationMessage("The user has been deleted");
|
|
|
|
sidebarPage.waitForPageLoad();
|
2021-12-21 06:22:44 +00:00
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
listingPage.itemExist(itemIdWithCred, false);
|
2021-03-03 19:12:16 +00:00
|
|
|
});
|
2023-03-22 16:14:53 +00:00
|
|
|
|
|
|
|
describe("Accessibility tests for users", () => {
|
2023-03-30 08:44:36 +00:00
|
|
|
const a11yUser = "a11y-user";
|
|
|
|
const role = "admin";
|
|
|
|
const roleMappingTab = new RoleMappingTab("");
|
|
|
|
|
2023-03-22 16:14:53 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
|
|
|
sidebarPage.goToUsers();
|
|
|
|
cy.injectAxe();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on load/ users list", () => {
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
2023-03-30 08:44:36 +00:00
|
|
|
it("Check a11y violations on empty create user form", () => {
|
|
|
|
createUserPage.goToCreateUser();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user details tab", () => {
|
2023-03-22 16:14:53 +00:00
|
|
|
createUserPage.goToCreateUser();
|
2023-03-30 08:44:36 +00:00
|
|
|
createUserPage.createUser(a11yUser);
|
|
|
|
userDetailsPage.fillUserData();
|
2024-02-09 16:34:55 +00:00
|
|
|
createUserPage.create();
|
2023-03-30 08:44:36 +00:00
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user attributes tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
attributesTab.goToAttributesTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user credentials tab setting a password", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
credentialsPage.goToCredentialsTab();
|
|
|
|
credentialsPage
|
|
|
|
.clickEmptyStatePasswordBtn()
|
|
|
|
.fillPasswordForm()
|
|
|
|
.clickConfirmationBtn()
|
|
|
|
.clickSetPasswordBtn();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user credentials tab resetting a password", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
credentialsPage.goToCredentialsTab();
|
|
|
|
credentialsPage.clickResetBtn();
|
|
|
|
cy.checkA11y();
|
|
|
|
modalUtils.cancelModal();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user role mapping tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
roleMappingTab.goToRoleMappingTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user role mapping tab assigning a role dialog", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
roleMappingTab.goToRoleMappingTab();
|
|
|
|
cy.findByTestId("assignRole").click();
|
|
|
|
cy.checkA11y();
|
|
|
|
roleMappingTab.selectRow(role).assign();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user groups tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user groups tab joining group dialog", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
cy.findByTestId("no-groups-empty-action").click();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user groups tab joining group", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
cy.findByTestId("no-groups-empty-action").click();
|
|
|
|
const groupsListCopy = groupsList.slice(0, 1);
|
|
|
|
groupsListCopy.forEach((element) => {
|
|
|
|
cy.findByTestId(`${element}-check`).click();
|
|
|
|
});
|
|
|
|
|
|
|
|
createUserPage.joinGroups();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user consents tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userDetailsPage.goToConsentsTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user identity provider links tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userDetailsPage.goToIdentityProviderLinksTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user sessions tab", () => {
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
userDetailsPage.goToSessionsTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on user deleting dialog", () => {
|
|
|
|
const commonPage = new CommonPage();
|
|
|
|
usersPage.goToUserListTab().goToUserDetailsPage(a11yUser);
|
|
|
|
commonPage
|
|
|
|
.actionToolbarUtils()
|
|
|
|
.clickActionToggleButton()
|
|
|
|
.clickDropdownItem("Delete");
|
2023-03-22 16:14:53 +00:00
|
|
|
cy.checkA11y();
|
2023-03-30 08:44:36 +00:00
|
|
|
cy.findByTestId("confirm").click();
|
2023-03-22 16:14:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on permissions tab", () => {
|
|
|
|
usersPage.goToPermissionsTab();
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
});
|
2021-04-19 19:53:28 +00:00
|
|
|
});
|