keycloak-scim/cypress/support/pages/admin_console/manage/groups/GroupDetailPage.ts
Erik Jan de Wit e4d83d0fe3
Group details (#425)
* added details for groups

* add includeSubGroups checkbox

* added tests

* fixed reload for group attributes

* fixed spacing on associate roles tab

* fixed group reload after save

* fixed test
2021-03-16 08:37:57 -04:00

59 lines
1.6 KiB
TypeScript

const expect = chai.expect;
export default class GroupDetailPage {
private groupNamesColumn = '[data-label="Group name"] > a';
private memberTab = "members";
private attributesTab = "attributes";
private memberNameColumn = 'tbody > tr > [data-label="Name"]';
private includeSubGroupsCheck = "includeSubGroupsCheck";
private keyInput = '[name="attributes[0].key"]';
private valueInput = '[name="attributes[0].value"]';
private saveAttributeBtn = ".pf-c-form__actions > .pf-m-primary";
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.getId(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;
}
clickIncludeSubGroups() {
cy.getId(this.includeSubGroupsCheck).click();
return this;
}
clickAttributesTab() {
cy.getId(this.attributesTab).click();
return this;
}
fillAttribute(key: string, value: string) {
cy.get(this.keyInput).type(key).get(this.valueInput).type(value);
return this;
}
saveAttribute() {
cy.get(this.saveAttributeBtn).click();
return this;
}
}