Group role mapping tests (#3314)
This commit is contained in:
parent
71c79b31ed
commit
c6aea1cd44
4 changed files with 75 additions and 0 deletions
|
@ -10,6 +10,8 @@ import ChildGroupsTab from "../support/pages/admin_console/manage/groups/group_d
|
||||||
import MembersTab from "../support/pages/admin_console/manage/groups/group_details/tabs/MembersTab";
|
import MembersTab from "../support/pages/admin_console/manage/groups/group_details/tabs/MembersTab";
|
||||||
import adminClient from "../support/util/AdminClient";
|
import adminClient from "../support/util/AdminClient";
|
||||||
import { range } from "lodash-es";
|
import { range } from "lodash-es";
|
||||||
|
import RoleMappingTab from "../support/pages/admin_console/manage/RoleMappingTab";
|
||||||
|
import CommonPage from "../support/pages/CommonPage";
|
||||||
|
|
||||||
describe("Group test", () => {
|
describe("Group test", () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
|
@ -21,6 +23,7 @@ describe("Group test", () => {
|
||||||
const groupDetailPage = new GroupDetailPage();
|
const groupDetailPage = new GroupDetailPage();
|
||||||
const childGroupsTab = new ChildGroupsTab();
|
const childGroupsTab = new ChildGroupsTab();
|
||||||
const membersTab = new MembersTab();
|
const membersTab = new MembersTab();
|
||||||
|
const commonPage = new CommonPage();
|
||||||
|
|
||||||
const groupNamePrefix = "group_";
|
const groupNamePrefix = "group_";
|
||||||
let groupName: string;
|
let groupName: string;
|
||||||
|
@ -474,6 +477,39 @@ describe("Group test", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Role mappings", () => {
|
||||||
|
const roleMappingTab = new RoleMappingTab("group");
|
||||||
|
beforeEach(() => {
|
||||||
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
|
groupDetailPage.goToRoleMappingTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Check empty state", () => {
|
||||||
|
commonPage.emptyState().checkIfExists(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Assign roles from empty state", () => {
|
||||||
|
roleMappingTab.assignRole();
|
||||||
|
groupDetailPage.createRoleMappingSearch();
|
||||||
|
roleMappingTab.assign();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Show and search roles", () => {
|
||||||
|
groupDetailPage.checkRoles();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Check hide inherited roles option", () => {
|
||||||
|
roleMappingTab.unhideInheritedRoles();
|
||||||
|
roleMappingTab.hideInheritedRoles();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Remove roles", () => {
|
||||||
|
roleMappingTab.selectRow("offline_access");
|
||||||
|
roleMappingTab.unAssign();
|
||||||
|
groupDetailPage.deleteRole();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Permissions", () => {
|
describe("Permissions", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
|
||||||
|
|
|
@ -64,6 +64,9 @@ export default class ListingPage extends CommonElements {
|
||||||
private tableHeaderCheckboxItemAllRows =
|
private tableHeaderCheckboxItemAllRows =
|
||||||
"input[aria-label='Select all rows']";
|
"input[aria-label='Select all rows']";
|
||||||
|
|
||||||
|
private searchBtnInModal =
|
||||||
|
".pf-c-modal-box .pf-c-toolbar__content-section button.pf-m-control:visible";
|
||||||
|
|
||||||
showPreviousPageTableItems() {
|
showPreviousPageTableItems() {
|
||||||
cy.get(this.previousPageBtn).first().click();
|
cy.get(this.previousPageBtn).first().click();
|
||||||
|
|
||||||
|
@ -110,6 +113,14 @@ export default class ListingPage extends CommonElements {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchItemInModal(searchValue: string) {
|
||||||
|
cy.get(this.searchInput).clear();
|
||||||
|
if (searchValue) {
|
||||||
|
cy.get(this.searchInput).type(searchValue);
|
||||||
|
}
|
||||||
|
cy.get(this.searchBtnInModal).click({ force: true });
|
||||||
|
}
|
||||||
|
|
||||||
checkTableLength(length: number, identifier: string) {
|
checkTableLength(length: number, identifier: string) {
|
||||||
cy.get("table")
|
cy.get("table")
|
||||||
.should("have.class", identifier)
|
.should("have.class", identifier)
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import ModalUtils from "../../../../../util/ModalUtils";
|
import ModalUtils from "../../../../../util/ModalUtils";
|
||||||
|
import ListingPage from "../../../ListingPage";
|
||||||
import GroupPage from "../GroupPage";
|
import GroupPage from "../GroupPage";
|
||||||
|
|
||||||
const modalUtils = new ModalUtils();
|
const modalUtils = new ModalUtils();
|
||||||
|
const listingPage = new ListingPage();
|
||||||
|
const groupPage = new GroupPage();
|
||||||
|
|
||||||
export default class GroupDetailPage extends GroupPage {
|
export default class GroupDetailPage extends GroupPage {
|
||||||
private groupNamesColumn = '[data-label="Group name"] > a';
|
private groupNamesColumn = '[data-label="Group name"] > a';
|
||||||
|
@ -146,4 +149,28 @@ export default class GroupDetailPage extends GroupPage {
|
||||||
this.assertSwitchStateOff(cy.findByTestId(this.permissionSwitch));
|
this.assertSwitchStateOff(cy.findByTestId(this.permissionSwitch));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createRoleMapping() {
|
||||||
|
listingPage.clickItemCheckbox("default-roles-");
|
||||||
|
}
|
||||||
|
|
||||||
|
createRoleMappingSearch() {
|
||||||
|
listingPage.searchItemInModal("offline_access");
|
||||||
|
listingPage.clickItemCheckbox("offline_access");
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRoles() {
|
||||||
|
listingPage.itemExist("offline_access");
|
||||||
|
listingPage.searchItem("offline_access", false);
|
||||||
|
listingPage.itemExist("offline_access");
|
||||||
|
listingPage.searchItem("non-existant-role", false);
|
||||||
|
groupPage.assertNoSearchResultsMessageExist(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteRole() {
|
||||||
|
modalUtils
|
||||||
|
.checkModalTitle("Remove mapping?")
|
||||||
|
.checkConfirmButtonText("Remove")
|
||||||
|
.confirmModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,7 @@ export const RoleMapping = ({
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={t("common:hideInheritedRoles")}
|
label={t("common:hideInheritedRoles")}
|
||||||
id="hideInheritedRoles"
|
id="hideInheritedRoles"
|
||||||
|
data-testid="hideInheritedRoles"
|
||||||
isChecked={hide}
|
isChecked={hide}
|
||||||
onChange={(check) => {
|
onChange={(check) => {
|
||||||
setHide(check);
|
setHide(check);
|
||||||
|
|
Loading…
Reference in a new issue