2021-04-20 12:10:00 +00:00
|
|
|
const expect = chai.expect;
|
|
|
|
export default class RoleMappingTab {
|
|
|
|
private tab = "#pf-tab-serviceAccount-serviceAccount";
|
|
|
|
private scopeTab = "scopeTab";
|
|
|
|
private assignRole = "assignRole";
|
2021-05-06 05:31:40 +00:00
|
|
|
private unAssign = "unAssignRole";
|
2021-04-20 12:10:00 +00:00
|
|
|
private assign = "assign";
|
2021-05-06 05:31:40 +00:00
|
|
|
private hide = "#hideInheritedRoles";
|
2021-04-20 12:10:00 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-05-06 05:31:40 +00:00
|
|
|
clickUnAssign() {
|
|
|
|
cy.getId(this.unAssign).click();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
hideInheritedRoles() {
|
|
|
|
cy.get(this.hide).check();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-04-20 12:10:00 +00:00
|
|
|
selectRow(name: string) {
|
|
|
|
cy.get(this.namesColumn)
|
|
|
|
.contains(name)
|
|
|
|
.parent()
|
|
|
|
.within(() => {
|
|
|
|
cy.get("input").click();
|
|
|
|
});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
checkRoles(roleNames: string[]) {
|
2021-05-06 05:31:40 +00:00
|
|
|
if (roleNames && roleNames.length) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
cy.getId(this.assignedRolesTable).should("not.exist");
|
|
|
|
}
|
2021-04-20 12:10:00 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|