User groups testing (#3951)

This commit is contained in:
Dominik Kawka 2022-12-07 09:06:35 +00:00 committed by GitHub
parent 998b111d6e
commit 4bc08e3cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View file

@ -180,7 +180,7 @@ describe("User creation", () => {
userGroupsPage.goToGroupsTab(); userGroupsPage.goToGroupsTab();
userGroupsPage.toggleAddGroupModal(); userGroupsPage.toggleAddGroupModal();
const groupsListCopy = groupsList.slice(0, 1); const groupsListCopy = groupsList.slice(0, 3);
groupsListCopy.forEach((element) => { groupsListCopy.forEach((element) => {
cy.findByTestId(`${element}-check`).click(); cy.findByTestId(`${element}-check`).click();
@ -198,6 +198,19 @@ describe("User creation", () => {
cy.findByTestId("confirm").click({ force: true }); cy.findByTestId("confirm").click({ force: true });
}); });
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();
});
it("Go to user consents test", () => { it("Go to user consents test", () => {
listingPage.searchItem(itemId).itemExist(itemId); listingPage.searchItem(itemId).itemExist(itemId);

View file

@ -1,12 +1,18 @@
import ModalUtils from "apps/admin-ui/cypress/support/util/ModalUtils";
const modalUtils = new ModalUtils();
export default class UserGroupsPage { export default class UserGroupsPage {
userGroupsTab: string; userGroupsTab: string;
addGroupButton: string; addGroupButton: string;
joinGroupButton: string; joinGroupButton: string;
leaveGroupButton: string;
constructor() { constructor() {
this.userGroupsTab = "user-groups-tab"; this.userGroupsTab = "user-groups-tab";
this.addGroupButton = "add-group-button"; this.addGroupButton = "add-group-button";
this.joinGroupButton = "users:join-button"; this.joinGroupButton = "users:join-button";
this.leaveGroupButton = "leave-group-button";
} }
goToGroupsTab() { goToGroupsTab() {
@ -26,4 +32,20 @@ export default class UserGroupsPage {
return this; return this;
} }
leaveGroup() {
cy.findByTestId(this.leaveGroupButton).click();
modalUtils.confirmModal();
return this;
}
leaveGroupButtonDisabled() {
cy.findByTestId(this.leaveGroupButton).should("be.disabled");
return this;
}
leaveGroupButtonEnabled() {
cy.findByTestId(this.leaveGroupButton).should("not.be.disabled");
return this;
}
} }