Group permission tests (#3246)

This commit is contained in:
Dominik Kawka 2022-09-05 22:30:25 +01:00 committed by GitHub
parent 9c22d91d12
commit a8ab21096b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View file

@ -473,4 +473,15 @@ describe("Group test", () => {
groupPage.assertGroupItemExist(predefinedGroups[0], true); groupPage.assertGroupItemExist(predefinedGroups[0], true);
}); });
}); });
describe("Permissions", () => {
beforeEach(() => {
groupPage.goToGroupChildGroupsTab(predefinedGroups[0]);
groupDetailPage.goToPermissionsTab();
});
it("enable/disable permissions", () => {
groupDetailPage.enablePermissionSwitch();
});
});
}); });

View file

@ -9,6 +9,7 @@ export default class GroupDetailPage extends GroupPage {
private childGroupsTab = "groups"; private childGroupsTab = "groups";
private attributesTab = "attributes"; private attributesTab = "attributes";
private roleMappingTab = "role-mapping-tab"; private roleMappingTab = "role-mapping-tab";
private permissionsTab = "permissionsTab";
private memberNameColumn = private memberNameColumn =
'[data-testid="members-table"] > tbody > tr > [data-label="Name"]'; '[data-testid="members-table"] > tbody > tr > [data-label="Name"]';
private addMembers = "addMember"; private addMembers = "addMember";
@ -18,7 +19,7 @@ export default class GroupDetailPage extends GroupPage {
private headerGroupName = ".pf-l-level.pf-m-gutter"; private headerGroupName = ".pf-l-level.pf-m-gutter";
private renameGroupModalGroupNameInput = "groupNameInput"; private renameGroupModalGroupNameInput = "groupNameInput";
private renameGroupModalRenameBtn = "renameGroup"; private renameGroupModalRenameBtn = "renameGroup";
private permissionSwitch = "permissionSwitch";
public goToChildGroupsTab() { public goToChildGroupsTab() {
cy.findByTestId(this.childGroupsTab).click(); cy.findByTestId(this.childGroupsTab).click();
return this; return this;
@ -39,6 +40,11 @@ export default class GroupDetailPage extends GroupPage {
return this; return this;
} }
public goToPermissionsTab() {
cy.findByTestId(this.permissionsTab).click();
return this;
}
public headerActionRenameGroup() { public headerActionRenameGroup() {
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton)); super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
super.clickDropdownMenuItem( super.clickDropdownMenuItem(
@ -128,4 +134,16 @@ export default class GroupDetailPage extends GroupPage {
cy.findByTestId(this.addMembers).click(); cy.findByTestId(this.addMembers).click();
return this; return this;
} }
enablePermissionSwitch() {
cy.findByTestId(this.permissionSwitch).parent().click();
this.assertSwitchStateOn(cy.findByTestId(this.permissionSwitch));
cy.findByTestId(this.permissionSwitch).parent().click();
modalUtils
.checkModalTitle("Disable permissions?")
.checkConfirmButtonText("Confirm")
.confirmModal();
this.assertSwitchStateOff(cy.findByTestId(this.permissionSwitch));
return this;
}
} }

View file

@ -146,6 +146,7 @@ export const PermissionsTab = ({ id, type }: PermissionsTabProps) => {
> >
<Switch <Switch
id="permissionsEnabled" id="permissionsEnabled"
data-testid="permissionSwitch"
label={t("common:on")} label={t("common:on")}
labelOff={t("common:off")} labelOff={t("common:off")}
isChecked={permission.enabled} isChecked={permission.enabled}