keycloak-scim/cypress/support/pages/admin_console/manage/RoleMappingTab.ts
Erik Jan de Wit 8d72f8a705
Fixing cypress tests (#586)
* upgrade cypress

* fixed delete now has dialog

* also check "unAssign"

* client type no longer required

* providers and group changes

* grp creation working

* moved create realm button ouside the dropdown

* sped up test and added cleanup

* Revert "moved create realm button ouside the dropdown"

This reverts commit e2076a5305808417de910ba8fada8e528e5c356a.

* make test re-runnable

* removed un needed navigation

* Fix misformed Cypress config for GitHub Action

* cleanup after test

* fixed cleanup

* temporary removed this test

* also remove user "new"

* try adding a wait for CI

* get different modal id

* add {force: true} to modal functions

* mv grp search last and ignore 401

* try using cy.get and disable video for testing

* add back video artifacts

Co-authored-by: mfrances <mfrances@redhat.com>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: jenny-s51 <jshandel@redhat.com>
2021-05-06 07:31:40 +02:00

67 lines
1.5 KiB
TypeScript

const expect = chai.expect;
export default class RoleMappingTab {
private tab = "#pf-tab-serviceAccount-serviceAccount";
private scopeTab = "scopeTab";
private assignRole = "assignRole";
private unAssign = "unAssignRole";
private assign = "assign";
private hide = "#hideInheritedRoles";
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;
}
clickUnAssign() {
cy.getId(this.unAssign).click();
return this;
}
hideInheritedRoles() {
cy.get(this.hide).check();
return this;
}
selectRow(name: string) {
cy.get(this.namesColumn)
.contains(name)
.parent()
.within(() => {
cy.get("input").click();
});
return this;
}
checkRoles(roleNames: string[]) {
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");
}
return this;
}
}