2021-05-03 16:44:47 +00:00
|
|
|
const expect = chai.expect;
|
|
|
|
|
|
|
|
export default class RealmSelector {
|
|
|
|
private realmSelector = "realmSelector";
|
|
|
|
private realmContextSelector = ".keycloak__realm_selector__context_selector";
|
|
|
|
|
|
|
|
shouldContainAll(realmsList: string[]) {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.realmSelector)
|
2021-05-03 16:44:47 +00:00
|
|
|
.scrollIntoView()
|
|
|
|
.get("ul")
|
|
|
|
.should((realms) => {
|
|
|
|
for (let index = 0; index < realmsList.length; index++) {
|
|
|
|
const realmName = realmsList[index];
|
|
|
|
expect(realms).to.contain(realmName);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
openRealmContextSelector() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.realmSelector).scrollIntoView();
|
2021-05-03 16:44:47 +00:00
|
|
|
cy.get(this.realmContextSelector).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|