keycloak-scim/cypress/support/pages/admin_console/manage/RoleMappingTab.ts
Erik Jan de Wit b86db32ba8
Add scope tab to client scope detail page (#514)
* initial version of the scope tab

* fixed assign

* moved form logic added test

* added unassign

* fixed merge error

* fixed labels
2021-04-20 08:10:00 -04:00

51 lines
1.1 KiB
TypeScript

const expect = chai.expect;
export default class RoleMappingTab {
private tab = "#pf-tab-serviceAccount-serviceAccount";
private scopeTab = "scopeTab";
private assignRole = "assignRole";
private assign = "assign";
private assignedRolesTable = "assigned-roles";
private namesColumn = 'td[data-label="Name"]:visible';
goToServiceAccountTab() {
cy.get(this.tab).click();
return this;
}
goToScopeTab() {
cy.getId(this.scopeTab).click();
return this;
}
clickAssignRole() {
cy.getId(this.assignRole).click();
return this;
}
clickAssign() {
cy.getId(this.assign).click();
return this;
}
selectRow(name: string) {
cy.get(this.namesColumn)
.contains(name)
.parent()
.within(() => {
cy.get("input").click();
});
return this;
}
checkRoles(roleNames: string[]) {
cy.getId(this.assignedRolesTable)
.get(this.namesColumn)
.should((roles) => {
for (let index = 0; index < roleNames.length; index++) {
const roleName = roleNames[index];
expect(roles).to.contain(roleName);
}
});
return this;
}
}