new group tests (#2789)
This commit is contained in:
parent
3a6d8c8807
commit
c51aa73e71
20 changed files with 990 additions and 351 deletions
|
@ -17,6 +17,7 @@ import ClientDetailsPage, {
|
||||||
} from "../support/pages/admin_console/manage/clients/client_details/ClientDetailsPage";
|
} from "../support/pages/admin_console/manage/clients/client_details/ClientDetailsPage";
|
||||||
import CommonPage from "../support/pages/CommonPage";
|
import CommonPage from "../support/pages/CommonPage";
|
||||||
import ListingPage from "../support/pages/admin_console/ListingPage";
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
||||||
|
import AttributesTab from "../support/pages/admin_console/manage/AttributesTab";
|
||||||
|
|
||||||
let itemId = "client_crud";
|
let itemId = "client_crud";
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
|
@ -25,6 +26,7 @@ const createClientPage = new CreateClientPage();
|
||||||
const clientDetailsPage = new ClientDetailsPage();
|
const clientDetailsPage = new ClientDetailsPage();
|
||||||
const commonPage = new CommonPage();
|
const commonPage = new CommonPage();
|
||||||
const listingPage = new ListingPage();
|
const listingPage = new ListingPage();
|
||||||
|
const attributesTab = new AttributesTab();
|
||||||
|
|
||||||
describe("Clients test", () => {
|
describe("Clients test", () => {
|
||||||
describe("Client details - Client scopes subtab", () => {
|
describe("Client details - Client scopes subtab", () => {
|
||||||
|
@ -490,8 +492,10 @@ describe("Clients test", () => {
|
||||||
commonPage.tableUtils().clickRowItemLink(itemId);
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
||||||
rolesTab.goToAttributesTab();
|
rolesTab.goToAttributesTab();
|
||||||
cy.wait(["@load", "@load"]);
|
cy.wait(["@load", "@load"]);
|
||||||
rolesTab.addAttribute(1, "crud_attribute_key", "crud_attribute_value");
|
attributesTab
|
||||||
rolesTab.checkRowItemsEqualTo(1);
|
.addAttribute("crud_attribute_key", "crud_attribute_value")
|
||||||
|
.save();
|
||||||
|
attributesTab.asseertRowItemsEqualTo(1);
|
||||||
commonPage
|
commonPage
|
||||||
.masthead()
|
.masthead()
|
||||||
.checkNotificationMessage("The role has been saved", true);
|
.checkNotificationMessage("The role has been saved", true);
|
||||||
|
@ -502,7 +506,7 @@ describe("Clients test", () => {
|
||||||
commonPage.tableUtils().clickRowItemLink(itemId);
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
||||||
rolesTab.goToAttributesTab();
|
rolesTab.goToAttributesTab();
|
||||||
cy.wait(["@load", "@load"]);
|
cy.wait(["@load", "@load"]);
|
||||||
rolesTab.deleteAttribute(1);
|
attributesTab.deleteAttribute(1);
|
||||||
commonPage
|
commonPage
|
||||||
.masthead()
|
.masthead()
|
||||||
.checkNotificationMessage("The role has been saved", true);
|
.checkNotificationMessage("The role has been saved", true);
|
||||||
|
|
|
@ -1,219 +1,474 @@
|
||||||
import ListingPage from "../support/pages/admin_console/ListingPage";
|
|
||||||
import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal";
|
import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal";
|
||||||
import GroupDetailPage from "../support/pages/admin_console/manage/groups/GroupDetailPage";
|
import GroupDetailPage from "../support/pages/admin_console/manage/groups/group_details/GroupDetailPage";
|
||||||
import AttributesTab from "../support/pages/admin_console/manage//AttributesTab";
|
import AttributesTab from "../support/pages/admin_console/manage//AttributesTab";
|
||||||
import MoveGroupModal from "../support/pages/admin_console/manage/groups/MoveGroupModal";
|
import { SearchGroupPage } from "../support/pages/admin_console/manage/groups/SearchGroupPage";
|
||||||
import { SearchGroupPage } from "../support/pages/admin_console/manage/groups/SearchGroup";
|
|
||||||
import Masthead from "../support/pages/admin_console/Masthead";
|
|
||||||
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
||||||
import LoginPage from "../support/pages/LoginPage";
|
import LoginPage from "../support/pages/LoginPage";
|
||||||
import ViewHeaderPage from "../support/pages/ViewHeaderPage";
|
|
||||||
import adminClient from "../support/util/AdminClient";
|
|
||||||
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
||||||
import ModalUtils from "../support/util/ModalUtils";
|
import GroupPage from "../support/pages/admin_console/manage/groups/GroupPage";
|
||||||
|
import ChildGroupsTab from "../support/pages/admin_console/manage/groups/group_details/tabs/ChildGroupsTab";
|
||||||
|
import MembersTab from "../support/pages/admin_console/manage/groups/group_details/tabs/MembersTab";
|
||||||
|
import adminClient from "../support/util/AdminClient";
|
||||||
|
import { range } from "lodash-es";
|
||||||
|
|
||||||
describe("Group test", () => {
|
describe("Group test", () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const masthead = new Masthead();
|
|
||||||
const sidebarPage = new SidebarPage();
|
const sidebarPage = new SidebarPage();
|
||||||
const listingPage = new ListingPage();
|
|
||||||
const viewHeaderPage = new ViewHeaderPage();
|
|
||||||
const groupModal = new GroupModal();
|
const groupModal = new GroupModal();
|
||||||
const searchGroupPage = new SearchGroupPage();
|
const searchGroupPage = new SearchGroupPage();
|
||||||
const moveGroupModal = new MoveGroupModal();
|
|
||||||
const modalUtils = new ModalUtils();
|
|
||||||
const attributesTab = new AttributesTab();
|
const attributesTab = new AttributesTab();
|
||||||
|
const groupPage = new GroupPage();
|
||||||
|
const groupDetailPage = new GroupDetailPage();
|
||||||
|
const childGroupsTab = new ChildGroupsTab();
|
||||||
|
const membersTab = new MembersTab();
|
||||||
|
|
||||||
let groupName = "group";
|
const groupNamePrefix = "group_";
|
||||||
|
let groupName: string;
|
||||||
|
const groupNames: string[] = [];
|
||||||
|
const predefinedGroups = ["level", "level1", "level2", "level3"];
|
||||||
|
const emptyGroup = "empty-group";
|
||||||
|
let users: { id: string; username: string }[] = [];
|
||||||
|
const username = "test-user";
|
||||||
|
|
||||||
const clickGroup = (itemName: string) => {
|
before(async () => {
|
||||||
sidebarPage.waitForPageLoad();
|
users = await Promise.all(
|
||||||
cy.get("table").contains(itemName).click();
|
range(5).map((index) => {
|
||||||
|
const user = adminClient
|
||||||
|
.createUser({
|
||||||
|
username: username + index,
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
.then((user) => {
|
||||||
|
return { id: user.id, username: username + index };
|
||||||
|
});
|
||||||
|
return user;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
return this;
|
beforeEach(() => {
|
||||||
};
|
keycloakBefore();
|
||||||
|
loginPage.logIn();
|
||||||
|
sidebarPage.goToGroups();
|
||||||
|
groupName = groupNamePrefix + (Math.random() + 1).toString(36).substring(7);
|
||||||
|
groupNames.push(groupName);
|
||||||
|
});
|
||||||
|
|
||||||
describe("Group creation", () => {
|
describe("List", () => {
|
||||||
beforeEach(() => {
|
it("Create group from empty option", () => {
|
||||||
keycloakBefore();
|
groupPage
|
||||||
loginPage.logIn();
|
.assertNoGroupsInThisRealmEmptyStateMessageExist(true)
|
||||||
sidebarPage.goToGroups();
|
.createGroup(groupName, true)
|
||||||
|
.assertNotificationGroupCreated()
|
||||||
|
.searchGroup(groupName)
|
||||||
|
.assertGroupItemExist(groupName, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Group CRUD test", () => {
|
it("Create group from search bar", () => {
|
||||||
groupName += "_" + (Math.random() + 1).toString(36).substring(7);
|
groupPage
|
||||||
|
.assertNoGroupsInThisRealmEmptyStateMessageExist(false)
|
||||||
groupModal
|
.createGroup(groupName, false)
|
||||||
.open("no-groups-in-this-realm-empty-action")
|
.assertNotificationGroupCreated()
|
||||||
.fillGroupForm(groupName)
|
.searchGroup(groupName)
|
||||||
.clickCreate();
|
.assertGroupItemExist(groupName, true);
|
||||||
|
|
||||||
masthead.checkNotificationMessage("Group created");
|
|
||||||
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
listingPage.searchItem(groupName, false).itemExist(groupName);
|
|
||||||
|
|
||||||
// Delete
|
|
||||||
listingPage.deleteItem(groupName);
|
|
||||||
modalUtils.checkModalTitle("Delete group?").confirmModal();
|
|
||||||
masthead.checkNotificationMessage("Group deleted");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should rename group", () => {
|
it("Fail to create group with empty name", () => {
|
||||||
groupModal
|
groupPage
|
||||||
.open("no-groups-in-this-realm-empty-action")
|
.assertNoGroupsInThisRealmEmptyStateMessageExist(false)
|
||||||
.fillGroupForm(groupName)
|
.createGroup(" ", false)
|
||||||
.clickCreate();
|
.assertNotificationCouldNotCreateGroupWithEmptyName();
|
||||||
clickGroup(groupName);
|
groupModal.closeModal();
|
||||||
viewHeaderPage.clickAction("renameGroupAction");
|
groupPage.searchGroup(" ").assertNoSearchResultsMessageExist(true);
|
||||||
|
|
||||||
const newName = "Renamed group";
|
|
||||||
groupModal.fillGroupForm(newName).clickRename();
|
|
||||||
masthead.checkNotificationMessage("Group updated");
|
|
||||||
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
listingPage.searchItem(newName, false).itemExist(newName);
|
|
||||||
listingPage.deleteItem(newName);
|
|
||||||
modalUtils.checkModalTitle("Delete group?").confirmModal();
|
|
||||||
masthead.checkNotificationMessage("Group deleted");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should move group", () => {
|
it("Fail to create group with duplicated name", () => {
|
||||||
const targetGroupName = "target";
|
groupPage
|
||||||
groupModal.open("no-groups-in-this-realm-empty-action");
|
.assertNoGroupsInThisRealmEmptyStateMessageExist(false)
|
||||||
groupModal.fillGroupForm(groupName).clickCreate();
|
.createGroup(groupName, false)
|
||||||
|
.createGroup(groupName, false)
|
||||||
sidebarPage.waitForPageLoad();
|
.assertNotificationCouldNotCreateGroupWithDuplicatedName(groupName);
|
||||||
groupModal
|
groupModal.closeModal();
|
||||||
.open("openCreateGroupModal")
|
groupPage.searchGroup(groupName).assertGroupItemsEqual(1);
|
||||||
.fillGroupForm(targetGroupName)
|
|
||||||
.clickCreate();
|
|
||||||
|
|
||||||
// For some reason, this fixes clickDetailMenu
|
|
||||||
sidebarPage.goToEvents();
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
|
|
||||||
listingPage.clickRowDetails(groupName).clickDetailMenu("Move to");
|
|
||||||
moveGroupModal
|
|
||||||
.clickRow(targetGroupName)
|
|
||||||
.checkTitle(`Move ${groupName} to ${targetGroupName}`);
|
|
||||||
moveGroupModal.clickMove();
|
|
||||||
|
|
||||||
masthead.checkNotificationMessage("Group moved");
|
|
||||||
sidebarPage.waitForPageLoad();
|
|
||||||
listingPage.itemExist(groupName, false);
|
|
||||||
clickGroup(targetGroupName);
|
|
||||||
sidebarPage.waitForPageLoad();
|
|
||||||
listingPage.itemExist(groupName);
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
listingPage.deleteItem(targetGroupName);
|
|
||||||
modalUtils.checkModalTitle("Delete group?").confirmModal();
|
|
||||||
masthead.checkNotificationMessage("Group deleted");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Move groups", () => {
|
it("Empty search", () => {
|
||||||
const groups = ["group", "group1", "group2"];
|
groupPage.searchGroup(" ").assertNoSearchResultsMessageExist(true);
|
||||||
before(() => adminClient.createSubGroups(groups));
|
|
||||||
|
|
||||||
after(() => adminClient.deleteGroups());
|
|
||||||
|
|
||||||
it("Should move group to root", () => {
|
|
||||||
listingPage.goToItemDetails(groups[0]);
|
|
||||||
sidebarPage.waitForPageLoad();
|
|
||||||
listingPage.clickRowDetails(groups[1]).clickDetailMenu("Move to");
|
|
||||||
|
|
||||||
moveGroupModal.clickMove();
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
|
|
||||||
new GroupDetailPage().checkListSubGroup(groups.slice(0, -1));
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Should move group back", () => {
|
|
||||||
listingPage.clickRowDetails(groups[1]).clickDetailMenu("Move to");
|
|
||||||
|
|
||||||
moveGroupModal.clickRow(groups[0]).clickMove();
|
|
||||||
sidebarPage.goToGroups();
|
|
||||||
|
|
||||||
new GroupDetailPage().checkListSubGroup(["group"]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Group search", () => {
|
it("Search group that exists", () => {
|
||||||
viewHeaderPage.clickAction("searchGroup");
|
groupPage
|
||||||
searchGroupPage.searchGroup("group").clickSearchButton();
|
.searchGroup(groupNames[0])
|
||||||
searchGroupPage.checkTerm("group");
|
.assertGroupItemExist(groupNames[0], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Search group that does not exists", () => {
|
||||||
|
groupPage
|
||||||
|
.searchGroup("not-existent-group")
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete group from item bar", () => {
|
||||||
|
groupPage
|
||||||
|
.searchGroup(groupNames[0])
|
||||||
|
.deleteGroupItem(groupNames[0])
|
||||||
|
.assertNotificationGroupDeleted()
|
||||||
|
.searchGroup(groupNames[0])
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete group from search bar", () => {
|
||||||
|
groupPage
|
||||||
|
.selectGroupItemCheckbox([groupNames[1]])
|
||||||
|
.deleteSelectedGroups()
|
||||||
|
.assertNotificationGroupDeleted()
|
||||||
|
.searchGroup(groupNames[1])
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete groups from search bar", () => {
|
||||||
|
cy.wrap(null).then(() =>
|
||||||
|
adminClient.createGroup("group_multiple_deletion_test")
|
||||||
|
);
|
||||||
|
cy.reload();
|
||||||
|
groupPage
|
||||||
|
.selectGroupItemCheckboxAllRows()
|
||||||
|
.deleteSelectedGroups()
|
||||||
|
.assertNotificationGroupsDeleted()
|
||||||
|
.assertNoGroupsInThisRealmEmptyStateMessageExist(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Group details", () => {
|
describe("Search group under current group", () => {
|
||||||
const groups = ["level", "level1", "level2"];
|
|
||||||
const detailPage = new GroupDetailPage();
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
const createdGroups = await adminClient.createSubGroups(groups);
|
const createdGroups = await adminClient.createSubGroups(predefinedGroups);
|
||||||
for (let i = 0; i < 5; i++) {
|
await Promise.all([
|
||||||
const username = "user" + i;
|
range(5).map((index) => {
|
||||||
adminClient.createUserInGroup(username, createdGroups[i % 3].id);
|
adminClient.addUserToGroup(
|
||||||
}
|
users[index].id!,
|
||||||
adminClient.createUser({ username: "new", enabled: true });
|
createdGroups[index % 3].id
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
adminClient.createUser({ username: "new", enabled: true }),
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
it("Search child group in group", () => {
|
||||||
keycloakBefore();
|
groupPage
|
||||||
loginPage.logIn();
|
.goToGroupChildGroupsTab(predefinedGroups[0])
|
||||||
sidebarPage.goToGroups();
|
.searchGroup(predefinedGroups[1])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[1])
|
||||||
|
.searchGroup(predefinedGroups[2])
|
||||||
|
.assertGroupItemExist(predefinedGroups[2], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Search non existing child group in group", () => {
|
||||||
|
groupPage
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[0])
|
||||||
|
.searchGroup("non-existent-sub-group")
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Empty search in group", () => {
|
||||||
|
groupPage
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[0])
|
||||||
|
.searchGroup(" ")
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Group Actions", () => {
|
||||||
|
const groupNameDeleteHeaderAction = "group_test_delete_header_action";
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
await adminClient.createGroup(groupNameDeleteHeaderAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await adminClient.deleteGroups();
|
await adminClient.deleteGroups();
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
const username = "user" + i;
|
|
||||||
await adminClient.deleteUser(username);
|
|
||||||
}
|
|
||||||
await adminClient.deleteUser("new");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should display all the subgroups", () => {
|
describe("Search globally", () => {
|
||||||
clickGroup(groups[0]);
|
it("Check empty state", () => {
|
||||||
detailPage.checkListSubGroup([groups[1]]);
|
groupPage
|
||||||
|
.headerActionsearchGroup()
|
||||||
|
.assertNoSearchResultsMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
const added = "addedGroup";
|
it("Search with multiple words", () => {
|
||||||
groupModal
|
groupPage.headerActionsearchGroup();
|
||||||
.open("openCreateGroupModal")
|
searchGroupPage
|
||||||
.fillGroupForm(added)
|
.searchGroup(
|
||||||
.clickCreate();
|
predefinedGroups[0].substr(0, predefinedGroups[0].length / 2)
|
||||||
|
)
|
||||||
|
.assertGroupItemExist(predefinedGroups[0], true)
|
||||||
|
.searchGroup(
|
||||||
|
predefinedGroups[0].substr(
|
||||||
|
predefinedGroups[0].length / 2,
|
||||||
|
predefinedGroups[0].length
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.assertGroupItemExist(predefinedGroups[0], true);
|
||||||
|
});
|
||||||
|
|
||||||
detailPage.checkListSubGroup([added, groups[1]]);
|
it("Navigate to parent group details", () => {
|
||||||
|
groupPage.headerActionsearchGroup();
|
||||||
|
searchGroupPage
|
||||||
|
.searchGroup(predefinedGroups[0])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[0])
|
||||||
|
.assertGroupItemExist(predefinedGroups[1], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Navigate to sub-group details", () => {
|
||||||
|
groupPage.headerActionsearchGroup();
|
||||||
|
searchGroupPage
|
||||||
|
.searchGroup(predefinedGroups[1])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[1])
|
||||||
|
.assertGroupItemExist(predefinedGroups[2], true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should display members", () => {
|
it("Rename group", () => {
|
||||||
clickGroup(groups[0]);
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
detailPage.clickMembersTab().checkListMembers(["user0", "user3"]);
|
groupDetailPage
|
||||||
detailPage
|
.renameGroup("new_group_name")
|
||||||
.clickIncludeSubGroups()
|
.assertNotificationGroupUpdated()
|
||||||
.checkListMembers(["user0", "user3", "user1", "user4", "user2"]);
|
.assertHeaderGroupNameEqual("new_group_name")
|
||||||
|
.renameGroup(predefinedGroups[0])
|
||||||
|
.assertNotificationGroupUpdated()
|
||||||
|
.assertHeaderGroupNameEqual(predefinedGroups[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should add members", () => {
|
it("Delete group from group details", () => {
|
||||||
clickGroup(groups[0]);
|
groupPage.goToGroupChildGroupsTab(groupNameDeleteHeaderAction);
|
||||||
detailPage
|
groupDetailPage
|
||||||
.clickMembersTab()
|
.headerActionDeleteGroup()
|
||||||
.clickAddMembers()
|
.assertNotificationGroupDeleted()
|
||||||
.checkSelectableMembers(["user1", "user4"]);
|
.assertGroupItemExist(groupNameDeleteHeaderAction, false);
|
||||||
detailPage.selectUsers(["new"]).clickAdd();
|
});
|
||||||
|
});
|
||||||
|
|
||||||
masthead.checkNotificationMessage("1 user added to the group");
|
describe("Child Groups", () => {
|
||||||
detailPage.checkListMembers(["new", "user0", "user3"]);
|
before(async () => {
|
||||||
|
await adminClient.createGroup(predefinedGroups[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Attributes CRUD test", () => {
|
after(async () => {
|
||||||
clickGroup(groups[0]);
|
await adminClient.deleteGroups();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Check empty state", () => {
|
||||||
|
childGroupsTab.assertNoGroupsInThisSubGroupEmptyStateMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create group from empty state", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.createGroup(predefinedGroups[1], true)
|
||||||
|
.assertNotificationGroupCreated();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create group from search bar", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.createGroup(predefinedGroups[2], false)
|
||||||
|
.assertNotificationGroupCreated();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Fail to create group with empty name", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.createGroup(" ", false)
|
||||||
|
.assertNotificationCouldNotCreateGroupWithEmptyName();
|
||||||
|
});
|
||||||
|
|
||||||
|
// https://github.com/keycloak/keycloak-admin-ui/issues/2726
|
||||||
|
it.skip("Fail to create group with duplicated name", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.createGroup(predefinedGroups[2], false)
|
||||||
|
.assertNotificationCouldNotCreateGroupWithDuplicatedName(
|
||||||
|
predefinedGroups[2]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Move group from item bar", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.moveGroupItemAction(predefinedGroups[1], [
|
||||||
|
predefinedGroups[0],
|
||||||
|
predefinedGroups[2],
|
||||||
|
])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[2])
|
||||||
|
.assertGroupItemExist(predefinedGroups[1], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Search group", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.searchGroup(predefinedGroups[2])
|
||||||
|
.assertGroupItemExist(predefinedGroups[2], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Show child group in groups", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[2])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[1])
|
||||||
|
.assertNoGroupsInThisSubGroupEmptyStateMessageExist(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete group from search bar", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[2])
|
||||||
|
.selectGroupItemCheckbox([predefinedGroups[1]])
|
||||||
|
.deleteSelectedGroups()
|
||||||
|
.assertNotificationGroupDeleted();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Delete group from item bar", () => {
|
||||||
|
childGroupsTab
|
||||||
|
.deleteGroupItem(predefinedGroups[2])
|
||||||
|
.assertNotificationGroupDeleted()
|
||||||
|
.assertNoGroupsInThisSubGroupEmptyStateMessageExist(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Members", () => {
|
||||||
|
before(async () => {
|
||||||
|
const createdGroups = await adminClient.createSubGroups(predefinedGroups);
|
||||||
|
await Promise.all([
|
||||||
|
range(5).map((index) => {
|
||||||
|
adminClient.addUserToGroup(
|
||||||
|
users[index].id!,
|
||||||
|
createdGroups[index % 3].id
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
adminClient.createGroup(emptyGroup),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
|
childGroupsTab.goToMembersTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Add member from search bar", () => {
|
||||||
|
membersTab
|
||||||
|
.addMember(["new"], false)
|
||||||
|
.assertNotificationUserAddedToTheGroup(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Show members with sub-group users", () => {
|
||||||
|
membersTab
|
||||||
|
.assertUserItemExist(users[0].username, true)
|
||||||
|
.assertUserItemExist("new", true)
|
||||||
|
.assertUserItemExist(users[3].username, true)
|
||||||
|
.clickCheckboxIncludeSubGroupUsers()
|
||||||
|
.assertUserItemExist("new", true)
|
||||||
|
.assertUserItemExist(users[0].username, true)
|
||||||
|
.assertUserItemExist(users[1].username, true)
|
||||||
|
.assertUserItemExist(users[2].username, true)
|
||||||
|
.assertUserItemExist(users[3].username, true)
|
||||||
|
.assertUserItemExist(users[4].username, true)
|
||||||
|
.goToChildGroupsTab()
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[1])
|
||||||
|
.goToMembersTab()
|
||||||
|
.assertUserItemExist(users[1].username, true)
|
||||||
|
.assertUserItemExist(users[4].username, true)
|
||||||
|
.goToChildGroupsTab()
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[2])
|
||||||
|
.goToMembersTab()
|
||||||
|
.assertUserItemExist(users[2].username, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Add member from empty state", () => {
|
||||||
|
sidebarPage.goToGroups();
|
||||||
|
groupPage.goToGroupChildGroupsTab(emptyGroup);
|
||||||
|
childGroupsTab.goToMembersTab();
|
||||||
|
membersTab
|
||||||
|
.addMember([users[0].username, users[1].username], true)
|
||||||
|
.assertNotificationUserAddedToTheGroup(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Leave group from search bar", () => {
|
||||||
|
sidebarPage.goToGroups();
|
||||||
|
groupPage.goToGroupChildGroupsTab(emptyGroup);
|
||||||
|
childGroupsTab.goToMembersTab();
|
||||||
|
membersTab
|
||||||
|
.selectUserItemCheckbox([users[0].username])
|
||||||
|
.leaveGroupSelectedUsers()
|
||||||
|
.assertNotificationUserLeftTheGroup(1)
|
||||||
|
.assertUserItemExist(users[0].username, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Leave group from item bar", () => {
|
||||||
|
sidebarPage.goToGroups();
|
||||||
|
groupPage.goToGroupChildGroupsTab(emptyGroup);
|
||||||
|
childGroupsTab.goToMembersTab();
|
||||||
|
membersTab
|
||||||
|
.leaveGroupUserItem(users[1].username)
|
||||||
|
.assertNotificationUserLeftTheGroup(1)
|
||||||
|
.assertNoUsersFoundEmptyStateMessageExist(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Breadcrumbs", () => {
|
||||||
|
it("Navigate to parent group", () => {
|
||||||
|
groupPage
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[0])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[1])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[2])
|
||||||
|
.goToGroupChildGroupsTab(predefinedGroups[3]);
|
||||||
|
cy.reload();
|
||||||
|
groupPage.clickBreadcrumbItem(predefinedGroups[2]);
|
||||||
|
groupDetailPage.assertHeaderGroupNameEqual(predefinedGroups[2]);
|
||||||
|
groupPage.clickBreadcrumbItem(predefinedGroups[1]);
|
||||||
|
groupDetailPage.assertHeaderGroupNameEqual(predefinedGroups[1]);
|
||||||
|
groupPage.clickBreadcrumbItem(predefinedGroups[0]);
|
||||||
|
groupDetailPage.assertHeaderGroupNameEqual(predefinedGroups[0]);
|
||||||
|
groupPage
|
||||||
|
.clickBreadcrumbItem("Groups")
|
||||||
|
.assertGroupItemExist(predefinedGroups[0], true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Attributes", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
|
groupDetailPage.goToAttributesTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Add attribute", () => {
|
||||||
|
attributesTab.addAttribute("key", "value").save();
|
||||||
|
groupPage.assertNotificationGroupUpdated();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Remove attribute", () => {
|
||||||
|
attributesTab.deleteAttribute(1).asseertRowItemsEqualTo(1);
|
||||||
|
groupPage.assertNotificationGroupUpdated();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Revert changes", () => {
|
||||||
attributesTab
|
attributesTab
|
||||||
.goToAttributesTab()
|
.addAttribute("key", "value")
|
||||||
.fillLastRow("key", "value")
|
.addAnAttributeButton()
|
||||||
.saveAttribute();
|
.revert()
|
||||||
|
.asseertRowItemsEqualTo(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
masthead.checkNotificationMessage("Group updated");
|
describe("'Move to' function", () => {
|
||||||
|
it("Move group to other group", () => {
|
||||||
|
groupPage
|
||||||
|
.moveGroupItemAction(predefinedGroups[0], [emptyGroup])
|
||||||
|
.goToGroupChildGroupsTab(emptyGroup)
|
||||||
|
.assertGroupItemExist(predefinedGroups[0], true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Move group to root", () => {
|
||||||
|
groupPage
|
||||||
|
.goToGroupChildGroupsTab(emptyGroup)
|
||||||
|
.moveGroupItemAction(predefinedGroups[0], ["root"]);
|
||||||
|
sidebarPage.goToGroups();
|
||||||
|
groupPage.assertGroupItemExist(predefinedGroups[0], true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ import CreateClientPage from "../support/pages/admin_console/manage/clients/Crea
|
||||||
import Masthead from "../support/pages/admin_console/Masthead";
|
import Masthead from "../support/pages/admin_console/Masthead";
|
||||||
import ModalUtils from "../support/util/ModalUtils";
|
import ModalUtils from "../support/util/ModalUtils";
|
||||||
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
||||||
|
import GroupPage from "../support/pages/admin_console/manage/groups/GroupPage";
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const masthead = new Masthead();
|
const masthead = new Masthead();
|
||||||
|
@ -14,6 +15,7 @@ const sidebarPage = new SidebarPage();
|
||||||
const listingPage = new ListingPage();
|
const listingPage = new ListingPage();
|
||||||
const groupModal = new GroupModal();
|
const groupModal = new GroupModal();
|
||||||
const createClientPage = new CreateClientPage();
|
const createClientPage = new CreateClientPage();
|
||||||
|
const groupPage = new GroupPage();
|
||||||
|
|
||||||
const providersPage = new ProviderPage();
|
const providersPage = new ProviderPage();
|
||||||
const modalUtils = new ModalUtils();
|
const modalUtils = new ModalUtils();
|
||||||
|
@ -115,11 +117,8 @@ describe("User Fed LDAP mapper tests", () => {
|
||||||
// create a new group
|
// create a new group
|
||||||
it("Create group", () => {
|
it("Create group", () => {
|
||||||
sidebarPage.goToGroups();
|
sidebarPage.goToGroups();
|
||||||
groupModal
|
groupPage.openCreateGroupModal(true);
|
||||||
.open("no-groups-in-this-realm-empty-action")
|
groupModal.setGroupNameInput(groupName).create();
|
||||||
.fillGroupForm(groupName)
|
|
||||||
.clickCreate();
|
|
||||||
|
|
||||||
masthead.checkNotificationMessage(groupCreatedSuccess);
|
masthead.checkNotificationMessage(groupCreatedSuccess);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -141,10 +141,7 @@ describe("User creation", () => {
|
||||||
it("User attributes test", () => {
|
it("User attributes test", () => {
|
||||||
listingPage.goToItemDetails(itemId);
|
listingPage.goToItemDetails(itemId);
|
||||||
|
|
||||||
attributesTab
|
attributesTab.goToAttributesTab().addAttribute("key", "value").save();
|
||||||
.goToAttributesTab()
|
|
||||||
.fillLastRow("key", "value")
|
|
||||||
.saveAttribute();
|
|
||||||
|
|
||||||
masthead.checkNotificationMessage("The user has been saved");
|
masthead.checkNotificationMessage("The user has been saved");
|
||||||
});
|
});
|
||||||
|
@ -158,8 +155,8 @@ describe("User creation", () => {
|
||||||
const attributeKey = "key-multiple";
|
const attributeKey = "key-multiple";
|
||||||
attributesTab
|
attributesTab
|
||||||
.goToAttributesTab()
|
.goToAttributesTab()
|
||||||
.fillLastRow(attributeKey, "other value")
|
.addAttribute(attributeKey, "other value")
|
||||||
.saveAttribute();
|
.save();
|
||||||
|
|
||||||
cy.wait("@save-user").should(({ request, response }) => {
|
cy.wait("@save-user").should(({ request, response }) => {
|
||||||
expect(response?.statusCode).to.equal(204);
|
expect(response?.statusCode).to.equal(204);
|
||||||
|
|
|
@ -61,6 +61,8 @@ export default class ListingPage extends CommonElements {
|
||||||
private toolbarChangeType = "#change-type-dropdown";
|
private toolbarChangeType = "#change-type-dropdown";
|
||||||
private tableNameColumnPrefix = "name-column-";
|
private tableNameColumnPrefix = "name-column-";
|
||||||
private rowGroup = "table:visible tbody[role='rowgroup']";
|
private rowGroup = "table:visible tbody[role='rowgroup']";
|
||||||
|
private tableHeaderCheckboxItemAllRows =
|
||||||
|
"input[aria-label='Select all rows']";
|
||||||
|
|
||||||
showPreviousPageTableItems() {
|
showPreviousPageTableItems() {
|
||||||
cy.get(this.previousPageBtn).first().click();
|
cy.get(this.previousPageBtn).first().click();
|
||||||
|
@ -174,6 +176,11 @@ export default class ListingPage extends CommonElements {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickTableHeaderItemCheckboxAllRows() {
|
||||||
|
cy.get(this.tableHeaderCheckboxItemAllRows).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
clickRowSelectButton(itemName: string) {
|
clickRowSelectButton(itemName: string) {
|
||||||
cy.get(this.itemsRows)
|
cy.get(this.itemsRows)
|
||||||
.contains(itemName)
|
.contains(itemName)
|
||||||
|
|
|
@ -11,6 +11,9 @@ export default class PageObject {
|
||||||
private chipGroup = ".pf-c-chip-group";
|
private chipGroup = ".pf-c-chip-group";
|
||||||
private chipGroupCloseBtn = ".pf-c-chip-group__close";
|
private chipGroupCloseBtn = ".pf-c-chip-group__close";
|
||||||
private chipItem = ".pf-c-chip-group__list-item";
|
private chipItem = ".pf-c-chip-group__list-item";
|
||||||
|
private emptyStateDiv = ".pf-c-empty-state:visible";
|
||||||
|
private toolbarActionsButton = ".pf-c-toolbar button[aria-label='Actions']";
|
||||||
|
private breadcrumbItem = ".pf-c-breadcrumb .pf-c-breadcrumb__item";
|
||||||
|
|
||||||
protected assertExist(element: Cypress.Chainable<JQuery>, exist: boolean) {
|
protected assertExist(element: Cypress.Chainable<JQuery>, exist: boolean) {
|
||||||
element.should((!exist ? "not." : "") + "exist");
|
element.should((!exist ? "not." : "") + "exist");
|
||||||
|
@ -90,7 +93,7 @@ export default class PageObject {
|
||||||
itemName: string,
|
itemName: string,
|
||||||
element?: Cypress.Chainable<JQuery>
|
element?: Cypress.Chainable<JQuery>
|
||||||
) {
|
) {
|
||||||
(element ?? cy.get(this.drpDwnMenuItem)).contains(itemName).click();
|
(element ?? cy.get(this.drpDwnMenuItem).contains(itemName)).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +197,7 @@ export default class PageObject {
|
||||||
itemName: string,
|
itemName: string,
|
||||||
element?: Cypress.Chainable<JQuery>
|
element?: Cypress.Chainable<JQuery>
|
||||||
) {
|
) {
|
||||||
element = element ?? cy.get(this.selectMenuItem);
|
element = element ?? cy.get(this.selectMenuItem).contains(itemName);
|
||||||
return this.clickDropdownMenuItem(itemName, element);
|
return this.clickDropdownMenuItem(itemName, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +302,12 @@ export default class PageObject {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected clickToolbarAction(itemName: string) {
|
||||||
|
cy.get(this.toolbarActionsButton).click();
|
||||||
|
this.clickDropdownMenuItem(itemName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected assertChipItemExist(itemName: string, exist: boolean) {
|
protected assertChipItemExist(itemName: string, exist: boolean) {
|
||||||
cy.get(this.chipItem).within(() => {
|
cy.get(this.chipItem).within(() => {
|
||||||
cy.contains(itemName).should((exist ? "" : "not.") + "exist");
|
cy.contains(itemName).should((exist ? "" : "not.") + "exist");
|
||||||
|
@ -317,4 +326,18 @@ export default class PageObject {
|
||||||
);
|
);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected assertEmptyStateExist(exist: boolean) {
|
||||||
|
if (exist) {
|
||||||
|
cy.get(this.emptyStateDiv).should("exist").should("be.visible");
|
||||||
|
} else {
|
||||||
|
cy.get(this.emptyStateDiv).should("not.exist");
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected clickBreadcrumbItem(itemName: string) {
|
||||||
|
cy.get(this.breadcrumbItem).contains(itemName).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
export default class AttributesTab {
|
export default class AttributesTab {
|
||||||
private saveAttributeBtn = "save-attributes";
|
private saveAttributeBtn = "save-attributes";
|
||||||
private addAttributeBtn = "attribute-add-row";
|
private addAttributeBtn = "attributes-add-row";
|
||||||
private attributesTab = "attributes";
|
private attributesTab = "attributes";
|
||||||
private attributeRow = "[data-testid=row]";
|
private attributeRow = "[data-testid=row]";
|
||||||
private keyInput = (index: number) => `attributes[${index}].key`;
|
private keyInput = (index: number) => `attributes[${index}].key`;
|
||||||
private valueInput = (index: number) => `attributes[${index}].value`;
|
private valueInput = (index: number) => `attributes[${index}].value`;
|
||||||
|
|
||||||
goToAttributesTab() {
|
public goToAttributesTab() {
|
||||||
cy.findByTestId(this.attributesTab).click();
|
cy.findByTestId(this.attributesTab).click();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
addRow() {
|
public addAttribute(key: string, value: string) {
|
||||||
cy.findByTestId(this.addAttributeBtn).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
fillLastRow(key: string, value: string) {
|
|
||||||
cy.get(this.attributeRow)
|
cy.get(this.attributeRow)
|
||||||
.its("length")
|
.its("length")
|
||||||
.then((index) => {
|
.then((index) => {
|
||||||
|
@ -27,8 +22,43 @@ export default class AttributesTab {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAttribute() {
|
public save() {
|
||||||
cy.findByTestId(this.saveAttributeBtn).click();
|
cy.findByTestId(this.saveAttributeBtn).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public revert() {
|
||||||
|
cy.get(".pf-c-button.pf-m-link").contains("Revert").click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteAttributeButton(row: number) {
|
||||||
|
cy.findByTestId(`attributes[${row - 1}].remove`).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addAnAttributeButton() {
|
||||||
|
cy.findByTestId(this.addAttributeBtn).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteAttribute(rowIndex: number) {
|
||||||
|
this.deleteAttributeButton(rowIndex);
|
||||||
|
this.save();
|
||||||
|
|
||||||
|
cy.findAllByTestId(`attributes[${rowIndex - 1}].key`).should(
|
||||||
|
"have.value",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
cy.findAllByTestId(`attributes[${rowIndex - 1}].value`).should(
|
||||||
|
"have.value",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public asseertRowItemsEqualTo(amount: number) {
|
||||||
|
cy.findAllByTestId("row").its("length").should("be.eq", amount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,44 +53,6 @@ export default class ClientRolesTab extends CommonPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clickAddAnAttributeButton() {
|
|
||||||
cy.findByTestId("attributes-add-row").click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickDeleteAttributeButton(row: number) {
|
|
||||||
cy.findByTestId(`attributes[${row - 1}].remove`).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
addAttribute(rowIndex: number, key: string, value: string) {
|
|
||||||
cy.findAllByTestId(`attributes[${rowIndex - 1}].key`).type(key);
|
|
||||||
cy.findAllByTestId(`attributes[${rowIndex - 1}].value`).type(value);
|
|
||||||
this.clickAddAnAttributeButton();
|
|
||||||
this.formUtils().save();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteAttribute(rowIndex: number) {
|
|
||||||
this.clickDeleteAttributeButton(rowIndex);
|
|
||||||
this.formUtils().save();
|
|
||||||
|
|
||||||
cy.findAllByTestId(`attributes[${rowIndex - 1}].key`).should(
|
|
||||||
"have.value",
|
|
||||||
""
|
|
||||||
);
|
|
||||||
cy.findAllByTestId(`attributes[${rowIndex - 1}].value`).should(
|
|
||||||
"have.value",
|
|
||||||
""
|
|
||||||
);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkRowItemsEqualTo(amount: number) {
|
|
||||||
cy.findAllByTestId("row").its("length").should("be.eq", amount);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
hideInheritedRoles() {
|
hideInheritedRoles() {
|
||||||
cy.get(this.hideInheritedRolesChkBox).check();
|
cy.get(this.hideInheritedRolesChkBox).check();
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
const expect = chai.expect;
|
|
||||||
|
|
||||||
export default class GroupDetailPage {
|
|
||||||
private groupNamesColumn = '[data-label="Group name"] > a';
|
|
||||||
private memberTab = "members";
|
|
||||||
private memberNameColumn =
|
|
||||||
'[data-testid="members-table"] > tbody > tr > [data-label="Name"]';
|
|
||||||
private includeSubGroupsCheck = "includeSubGroupsCheck";
|
|
||||||
private addMembers = "addMember";
|
|
||||||
private addMember = "add";
|
|
||||||
private memberUsernameColumn = 'tbody > tr > [data-label="Username"]';
|
|
||||||
|
|
||||||
checkListSubGroup(subGroups: string[]) {
|
|
||||||
cy.get(this.groupNamesColumn).should((groups) => {
|
|
||||||
expect(groups).to.have.length(subGroups.length);
|
|
||||||
for (let index = 0; index < subGroups.length; index++) {
|
|
||||||
const subGroup = subGroups[index];
|
|
||||||
expect(groups).to.contain(subGroup);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickMembersTab() {
|
|
||||||
cy.findByTestId(this.memberTab).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkListMembers(members: string[]) {
|
|
||||||
cy.get(this.memberNameColumn).should((member) => {
|
|
||||||
expect(member).to.have.length(members.length);
|
|
||||||
for (let index = 0; index < members.length; index++) {
|
|
||||||
expect(member.eq(index)).to.contain(members[index]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectableMembers(members: string[]) {
|
|
||||||
cy.get(this.memberUsernameColumn).should((member) => {
|
|
||||||
for (const user of members) {
|
|
||||||
expect(member).to.contain(user);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectUsers(users: string[]) {
|
|
||||||
for (const user of users) {
|
|
||||||
cy.get(this.memberUsernameColumn)
|
|
||||||
.contains(user)
|
|
||||||
.parent()
|
|
||||||
.find("input")
|
|
||||||
.click();
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickAdd() {
|
|
||||||
cy.findByTestId(this.addMember).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickIncludeSubGroups() {
|
|
||||||
cy.findByTestId(this.includeSubGroupsCheck).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickAddMembers() {
|
|
||||||
cy.findByTestId(this.addMembers).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +1,30 @@
|
||||||
export default class GroupModal {
|
import ModalUtils from "../../../../util/ModalUtils";
|
||||||
private nameInput = "groupNameInput";
|
|
||||||
private createButton = "createGroup";
|
export default class GroupModal extends ModalUtils {
|
||||||
|
private createGroupModalTitle = "Create a group";
|
||||||
|
private groupNameInput = "groupNameInput";
|
||||||
|
private createGroupBnt = "createGroup";
|
||||||
private renameButton = "renameGroup";
|
private renameButton = "renameGroup";
|
||||||
|
|
||||||
open(name?: string) {
|
public setGroupNameInput(name: string) {
|
||||||
if (name) {
|
cy.findByTestId(this.groupNameInput).clear().type(name);
|
||||||
cy.findByTestId(name).click();
|
|
||||||
} else {
|
|
||||||
cy.get("button").contains("Create").click();
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillGroupForm(name = "") {
|
public create() {
|
||||||
cy.findByTestId(this.nameInput).clear().type(name);
|
cy.findByTestId(this.createGroupBnt).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clickCreate() {
|
public rename() {
|
||||||
cy.findByTestId(this.createButton).click();
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickRename() {
|
|
||||||
cy.findByTestId(this.renameButton).click();
|
cy.findByTestId(this.renameButton).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public assertCreateGroupModalVisible(isVisible: boolean) {
|
||||||
|
super
|
||||||
|
.assertModalVisible(isVisible)
|
||||||
|
.assertModalTitleEqual(this.createGroupModalTitle);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
177
cypress/support/pages/admin_console/manage/groups/GroupPage.ts
Normal file
177
cypress/support/pages/admin_console/manage/groups/GroupPage.ts
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
import PageObject from "../../components/PageObject";
|
||||||
|
import ListingPage from "../../ListingPage";
|
||||||
|
import Masthead from "../../Masthead";
|
||||||
|
import SidebarPage from "../../SidebarPage";
|
||||||
|
import GroupModal from "./GroupModal";
|
||||||
|
import MoveGroupModal from "./MoveGroupModal";
|
||||||
|
|
||||||
|
const groupModal = new GroupModal();
|
||||||
|
const moveGroupModal = new MoveGroupModal();
|
||||||
|
const listingPage = new ListingPage();
|
||||||
|
const masthead = new Masthead();
|
||||||
|
const sidebarPage = new SidebarPage();
|
||||||
|
|
||||||
|
export default class GroupPage extends PageObject {
|
||||||
|
protected createGroupEmptyStateBtn = "no-groups-in-this-realm-empty-action";
|
||||||
|
private createGroupBtn = "openCreateGroupModal";
|
||||||
|
protected actionDrpDwnButton = "action-dropdown";
|
||||||
|
private actionDrpDwnItemSearchGroup = "searchGroup";
|
||||||
|
|
||||||
|
public openCreateGroupModal(emptyState: boolean) {
|
||||||
|
if (emptyState) {
|
||||||
|
cy.findByTestId(this.createGroupEmptyStateBtn).click();
|
||||||
|
} else {
|
||||||
|
cy.findByTestId(this.createGroupBtn).click();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public createGroup(groupName: string, emptyState: boolean) {
|
||||||
|
this.openCreateGroupModal(emptyState);
|
||||||
|
groupModal
|
||||||
|
.assertCreateGroupModalVisible(true)
|
||||||
|
.setGroupNameInput(groupName)
|
||||||
|
.create();
|
||||||
|
cy.intercept("POST", "*/admin/realms/master/groups").as("post");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public searchGroup(groupName: string) {
|
||||||
|
listingPage.searchItem(groupName, false);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public headerActionsearchGroup() {
|
||||||
|
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
|
||||||
|
super.clickDropdownMenuItem(
|
||||||
|
"",
|
||||||
|
cy.findByTestId(this.actionDrpDwnItemSearchGroup)
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToGroupChildGroupsTab(groupName: string) {
|
||||||
|
listingPage.goToItemDetails(groupName);
|
||||||
|
cy.intercept("GET", "*/admin/realms/master/groups/*").as("get");
|
||||||
|
sidebarPage.waitForPageLoad();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectGroupItemCheckbox(items: string[]) {
|
||||||
|
for (const item of items) {
|
||||||
|
listingPage.clickItemCheckbox(item);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectGroupItemCheckboxAllRows() {
|
||||||
|
listingPage.clickTableHeaderItemCheckboxAllRows();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteSelectedGroups(confirmModal = true) {
|
||||||
|
this.clickToolbarAction("Delete");
|
||||||
|
if (confirmModal) {
|
||||||
|
groupModal.confirmModal();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteGroupItem(groupName: string, confirmModal = true) {
|
||||||
|
listingPage.deleteItem(groupName);
|
||||||
|
if (confirmModal) {
|
||||||
|
groupModal.confirmModal();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public moveGroupItemAction(
|
||||||
|
groupName: string,
|
||||||
|
destinationGroupName: string[]
|
||||||
|
) {
|
||||||
|
listingPage.clickRowDetails(groupName);
|
||||||
|
listingPage.clickDetailMenu("Move to");
|
||||||
|
moveGroupModal
|
||||||
|
.assertModalVisible(true)
|
||||||
|
.assertModalTitleEqual(`Move ${groupName} to root`);
|
||||||
|
if (!destinationGroupName.includes("root")) {
|
||||||
|
for (const destination of destinationGroupName) {
|
||||||
|
moveGroupModal
|
||||||
|
.clickRow(destination)
|
||||||
|
.assertModalTitleEqual(`Move ${groupName} to ${destination}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
moveGroupModal.clickMove();
|
||||||
|
this.assertNotificationGroupMoved();
|
||||||
|
moveGroupModal.assertModalExist(false);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public clickBreadcrumbItem(groupName: string) {
|
||||||
|
super.clickBreadcrumbItem(groupName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertGroupItemExist(groupName: string, exist: boolean) {
|
||||||
|
listingPage.itemExist(groupName, exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNoGroupsInThisRealmEmptyStateMessageExist(exist: boolean) {
|
||||||
|
this.assertEmptyStateExist(exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertGroupItemsEqual(number: number) {
|
||||||
|
listingPage.itemsEqualTo(number);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNoSearchResultsMessageExist(exist: boolean) {
|
||||||
|
super.assertEmptyStateExist(exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationGroupDeleted() {
|
||||||
|
masthead.checkNotificationMessage("Group deleted");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationGroupsDeleted() {
|
||||||
|
masthead.checkNotificationMessage("Groups deleted");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationGroupCreated() {
|
||||||
|
masthead.checkNotificationMessage("Group created");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationGroupMoved() {
|
||||||
|
masthead.checkNotificationMessage("Group moved");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationGroupUpdated() {
|
||||||
|
masthead.checkNotificationMessage("Group updated");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationCouldNotCreateGroupWithEmptyName() {
|
||||||
|
masthead.checkNotificationMessage(
|
||||||
|
"Could not create group Group name is missing"
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationCouldNotCreateGroupWithDuplicatedName(
|
||||||
|
groupName: string
|
||||||
|
) {
|
||||||
|
masthead.checkNotificationMessage(
|
||||||
|
"Could not create group Top level group named '" +
|
||||||
|
groupName +
|
||||||
|
"' already exists."
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
export default class MoveGroupModal {
|
import ModalUtils from "../../../../util/ModalUtils";
|
||||||
|
|
||||||
|
export default class MoveGroupModal extends ModalUtils {
|
||||||
private moveButton = "groups:moveHere-button";
|
private moveButton = "groups:moveHere-button";
|
||||||
private title = ".pf-c-modal-box__title";
|
private title = ".pf-c-modal-box__title";
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
export class SearchGroupPage {
|
|
||||||
private searchField = "group-search";
|
|
||||||
private searchButton = "search-button";
|
|
||||||
|
|
||||||
searchGroup(search: string) {
|
|
||||||
cy.findByTestId(this.searchField).type(search);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickSearchButton() {
|
|
||||||
cy.findByTestId(this.searchButton).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkTerm(searchTerm: string) {
|
|
||||||
cy.get(".pf-c-chip-group").children().contains(searchTerm).should("exist");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import GroupPage from "./GroupPage";
|
||||||
|
|
||||||
|
export class SearchGroupPage extends GroupPage {
|
||||||
|
private searchField = "group-search";
|
||||||
|
private searchButton = "search-button";
|
||||||
|
|
||||||
|
public searchGroup(groupName: string) {
|
||||||
|
this.typeSearchInput(groupName);
|
||||||
|
this.clickSearchButton();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public typeSearchInput(value: string) {
|
||||||
|
cy.findByTestId(this.searchField).type(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public clickSearchButton() {
|
||||||
|
cy.findByTestId(this.searchButton).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public checkTerm(searchTerm: string) {
|
||||||
|
cy.get(".pf-c-chip-group").children().contains(searchTerm).should("exist");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
import ModalUtils from "../../../../../util/ModalUtils";
|
||||||
|
import GroupPage from "../GroupPage";
|
||||||
|
|
||||||
|
const modalUtils = new ModalUtils();
|
||||||
|
|
||||||
|
export default class GroupDetailPage extends GroupPage {
|
||||||
|
private groupNamesColumn = '[data-label="Group name"] > a';
|
||||||
|
private memberTab = "members";
|
||||||
|
private childGroupsTab = "groups";
|
||||||
|
private attributesTab = "attributes";
|
||||||
|
private roleMappingTab = "role-mapping-tab";
|
||||||
|
private memberNameColumn =
|
||||||
|
'[data-testid="members-table"] > tbody > tr > [data-label="Name"]';
|
||||||
|
private addMembers = "addMember";
|
||||||
|
private memberUsernameColumn = 'tbody > tr > [data-label="Username"]';
|
||||||
|
private actionDrpDwnItemRenameGroup = "renameGroupAction";
|
||||||
|
private actionDrpDwnItemDeleteGroup = "deleteGroup";
|
||||||
|
private headerGroupName = ".pf-l-level.pf-m-gutter";
|
||||||
|
private renameGroupModalGroupNameInput = "groupNameInput";
|
||||||
|
private renameGroupModalRenameBtn = "renameGroup";
|
||||||
|
|
||||||
|
public goToChildGroupsTab() {
|
||||||
|
cy.findByTestId(this.childGroupsTab).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToMembersTab() {
|
||||||
|
cy.findByTestId(this.memberTab).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToAttributesTab() {
|
||||||
|
cy.findByTestId(this.attributesTab).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToRoleMappingTab() {
|
||||||
|
cy.findByTestId(this.roleMappingTab).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public headerActionRenameGroup() {
|
||||||
|
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
|
||||||
|
super.clickDropdownMenuItem(
|
||||||
|
"",
|
||||||
|
cy.findByTestId(this.actionDrpDwnItemRenameGroup)
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public headerActionDeleteGroup() {
|
||||||
|
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
|
||||||
|
super.clickDropdownMenuItem(
|
||||||
|
"",
|
||||||
|
cy.findByTestId(this.actionDrpDwnItemDeleteGroup)
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public renameGroup(newGroupName: string) {
|
||||||
|
this.headerActionRenameGroup();
|
||||||
|
modalUtils.checkModalTitle("Rename group");
|
||||||
|
cy.findByTestId(this.renameGroupModalGroupNameInput)
|
||||||
|
.clear()
|
||||||
|
.type(newGroupName);
|
||||||
|
cy.findByTestId(this.renameGroupModalRenameBtn).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteGroupHeaderAction() {
|
||||||
|
this.headerActionDeleteGroup();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertHeaderGroupNameEqual(groupName: string) {
|
||||||
|
cy.get(this.headerGroupName).find("h1").should("have.text", groupName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkListSubGroup(subGroups: string[]) {
|
||||||
|
cy.get(this.groupNamesColumn).should((groups) => {
|
||||||
|
expect(groups).to.have.length(subGroups.length);
|
||||||
|
for (let index = 0; index < subGroups.length; index++) {
|
||||||
|
const subGroup = subGroups[index];
|
||||||
|
expect(groups).to.contain(subGroup);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
clickMembersTab() {
|
||||||
|
cy.findByTestId(this.memberTab).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkListMembers(members: string[]) {
|
||||||
|
cy.get(this.memberNameColumn).should((member) => {
|
||||||
|
expect(member).to.have.length(members.length);
|
||||||
|
for (let index = 0; index < members.length; index++) {
|
||||||
|
expect(member.eq(index)).to.contain(members[index]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkSelectableMembers(members: string[]) {
|
||||||
|
cy.get(this.memberUsernameColumn).should((member) => {
|
||||||
|
for (const user of members) {
|
||||||
|
expect(member).to.contain(user);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectUsers(users: string[]) {
|
||||||
|
for (const user of users) {
|
||||||
|
cy.get(this.memberUsernameColumn)
|
||||||
|
.contains(user)
|
||||||
|
.parent()
|
||||||
|
.find("input")
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
clickAddMembers() {
|
||||||
|
cy.findByTestId(this.addMembers).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import GroupDetailPage from "../GroupDetailPage";
|
||||||
|
|
||||||
|
export default class ChildGroupsTab extends GroupDetailPage {
|
||||||
|
protected createGroupEmptyStateBtn =
|
||||||
|
"no-groups-in-this-sub-group-empty-action";
|
||||||
|
|
||||||
|
public assertNoGroupsInThisSubGroupEmptyStateMessageExist(exist: boolean) {
|
||||||
|
super.assertEmptyStateExist(exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
import ModalUtils from "../../../../../../util/ModalUtils";
|
||||||
|
import ListingPage from "../../../../ListingPage";
|
||||||
|
import Masthead from "../../../../Masthead";
|
||||||
|
import SidebarPage from "../../../../SidebarPage";
|
||||||
|
import GroupDetailPage from "../GroupDetailPage";
|
||||||
|
|
||||||
|
const modalUtils = new ModalUtils();
|
||||||
|
const listingPage = new ListingPage();
|
||||||
|
const masthead = new Masthead();
|
||||||
|
const sidebarPage = new SidebarPage();
|
||||||
|
|
||||||
|
export default class MembersTab extends GroupDetailPage {
|
||||||
|
private addMemberEmptyStateBtn = "no-users-found-empty-action";
|
||||||
|
private addMemberBtn = "addMember";
|
||||||
|
private includeSubGroupsCheck = "includeSubGroupsCheck";
|
||||||
|
|
||||||
|
public openAddMemberModal(emptyState: boolean) {
|
||||||
|
cy.intercept("GET", "*/admin/realms/master/users?first=*").as("get");
|
||||||
|
if (emptyState) {
|
||||||
|
cy.findByTestId(this.addMemberEmptyStateBtn).click();
|
||||||
|
} else {
|
||||||
|
cy.findByTestId(this.addMemberBtn).click();
|
||||||
|
}
|
||||||
|
sidebarPage.waitForPageLoad();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addMember(usernames: string[], emptyState: boolean) {
|
||||||
|
this.openAddMemberModal(emptyState);
|
||||||
|
modalUtils.assertModalVisible(true).assertModalTitleEqual("Add member");
|
||||||
|
for (const username of usernames) {
|
||||||
|
listingPage.clickItemCheckbox(username);
|
||||||
|
}
|
||||||
|
modalUtils.add();
|
||||||
|
modalUtils.assertModalExist(false);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectUserItemCheckbox(items: string[]) {
|
||||||
|
for (const item of items) {
|
||||||
|
listingPage.clickItemCheckbox(item);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public leaveGroupSelectedUsers() {
|
||||||
|
this.clickToolbarAction("Leave group");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public leaveGroupUserItem(username: string) {
|
||||||
|
listingPage.clickRowDetails(username);
|
||||||
|
listingPage.clickDetailMenu("Leave group");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public clickCheckboxIncludeSubGroupUsers() {
|
||||||
|
cy.findByTestId(this.includeSubGroupsCheck).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationUserAddedToTheGroup(amount: number) {
|
||||||
|
masthead.checkNotificationMessage(
|
||||||
|
`${amount} user${amount > 1 ? "s" : ""} added to the group`
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNotificationUserLeftTheGroup(amount: number) {
|
||||||
|
masthead.checkNotificationMessage(
|
||||||
|
`${amount} user${amount > 1 ? "s" : ""} left the group`
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertNoUsersFoundEmptyStateMessageExist(exist: boolean) {
|
||||||
|
super.assertEmptyStateExist(exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public assertUserItemExist(username: string, exist: boolean) {
|
||||||
|
listingPage.itemExist(username, exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
import GroupDetailPage from "../GroupDetailPage";
|
||||||
|
|
||||||
|
export default class PermissionsTab extends GroupDetailPage {}
|
|
@ -95,6 +95,11 @@ class AdminClient {
|
||||||
return await this.client.users.create(user);
|
return await this.client.users.create(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addUserToGroup(userId: string, groupId: string) {
|
||||||
|
await this.login();
|
||||||
|
await this.client.users.addToGroup({ id: userId, groupId });
|
||||||
|
}
|
||||||
|
|
||||||
async createUserInGroup(username: string, groupId: string) {
|
async createUserInGroup(username: string, groupId: string) {
|
||||||
await this.login();
|
await this.login();
|
||||||
const user = await this.createUser({ username, enabled: true });
|
const user = await this.createUser({ username, enabled: true });
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import PageObject from "../pages/admin_console/components/PageObject";
|
||||||
import TablePage from "../pages/admin_console/components/TablePage";
|
import TablePage from "../pages/admin_console/components/TablePage";
|
||||||
import CommonElements from "../pages/CommonElements";
|
|
||||||
|
|
||||||
export default class ModalUtils extends CommonElements {
|
export default class ModalUtils extends PageObject {
|
||||||
|
private modalDiv = ".pf-c-modal-box";
|
||||||
private modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
|
private modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
|
||||||
private modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
|
private modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
|
||||||
private confirmModalBtn = "confirm";
|
private confirmModalBtn = "confirm";
|
||||||
|
@ -10,18 +11,16 @@ export default class ModalUtils extends CommonElements {
|
||||||
private copyToClipboardBtn = '[id*="copy-button"]';
|
private copyToClipboardBtn = '[id*="copy-button"]';
|
||||||
private addModalDropdownBtn = "#add-dropdown > button";
|
private addModalDropdownBtn = "#add-dropdown > button";
|
||||||
private addModalDropdownItem = "#add-dropdown [role='menuitem']";
|
private addModalDropdownItem = "#add-dropdown [role='menuitem']";
|
||||||
|
private primaryBtn = ".pf-c-button.pf-m-primary";
|
||||||
|
private addBtn = "add";
|
||||||
private tablePage = new TablePage(TablePage.tableSelector);
|
private tablePage = new TablePage(TablePage.tableSelector);
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super(".pf-c-modal-box");
|
|
||||||
}
|
|
||||||
|
|
||||||
table() {
|
table() {
|
||||||
return this.tablePage;
|
return this.tablePage;
|
||||||
}
|
}
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
cy.get(this.primaryBtn).contains("Add").click();
|
cy.findByTestId(this.addBtn).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +68,8 @@ export default class ModalUtils extends CommonElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkModalTitle(title: string) {
|
checkModalTitle(title: string) {
|
||||||
cy.get(this.modalTitle).invoke("text").should("eq", title);
|
//deprecated
|
||||||
|
this.assertModalTitleEqual(title);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +85,24 @@ export default class ModalUtils extends CommonElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertModalHasElement(elementSelector: string, exist: boolean) {
|
assertModalHasElement(elementSelector: string, exist: boolean) {
|
||||||
cy.get(this.parentSelector)
|
cy.get(this.modalDiv)
|
||||||
.find(elementSelector)
|
.find(elementSelector)
|
||||||
.should((exist ? "" : ".not") + "exist");
|
.should((exist ? "" : ".not") + "exist");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertModalVisible(isVisible: boolean) {
|
||||||
|
super.assertIsVisible(cy.get(this.modalDiv), isVisible);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
assertModalExist(exist: boolean) {
|
||||||
|
super.assertExist(cy.get(this.modalDiv), exist);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
assertModalTitleEqual(text: string) {
|
||||||
|
cy.get(this.modalTitle).invoke("text").should("eq", text);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue