keycloak-scim/apps/admin-ui/cypress/support/pages/admin_console/SidebarPage.ts

146 lines
3.2 KiB
TypeScript
Raw Normal View History

2022-04-19 12:25:57 +00:00
import CommonElements from "../CommonElements";
export default class SidebarPage extends CommonElements {
private realmsDrpDwn = "realmSelectorToggle";
private createRealmBtn = "add-realm";
private clientsBtn = "#nav-item-clients";
private clientScopesBtn = "#nav-item-client-scopes";
private realmRolesBtn = "#nav-item-roles";
private usersBtn = "#nav-item-users";
private groupsBtn = "#nav-item-groups";
private sessionsBtn = "#nav-item-sessions";
private eventsBtn = "#nav-item-events";
private realmSettingsBtn = "#nav-item-realm-settings";
private authenticationBtn = "#nav-item-authentication";
private identityProvidersBtn = "#nav-item-identity-providers";
private userFederationBtn = "#nav-item-user-federation";
2021-01-27 12:56:28 +00:00
2022-04-06 09:21:04 +00:00
showCurrentRealms(length: number) {
cy.findByTestId(this.realmsDrpDwn).click();
cy.get('[data-testid="realmSelector"] li').should(
"have.length",
length + 1 // account for button
);
cy.findByTestId(this.realmsDrpDwn).click({ force: true });
2022-04-06 09:21:04 +00:00
}
2021-01-27 12:56:28 +00:00
getCurrentRealm() {
return cy.findByTestId(this.realmsDrpDwn).scrollIntoView().invoke("text");
2021-01-27 12:56:28 +00:00
}
goToRealm(realmName: string) {
this.waitForPageLoad();
cy.findByTestId(this.realmsDrpDwn)
.click()
.parent()
.contains(realmName)
.click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToCreateRealm() {
this.waitForPageLoad();
cy.findByTestId(this.realmsDrpDwn).click({ force: true });
cy.findByTestId(this.createRealmBtn).click({ force: true });
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToClients() {
this.waitForPageLoad();
cy.get(this.clientsBtn).click({ force: true });
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToClientScopes() {
this.waitForPageLoad();
cy.get(this.clientScopesBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToRealmRoles() {
cy.get(this.realmRolesBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToUsers() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.usersBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToGroups() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.groupsBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToSessions() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.sessionsBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToEvents() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.eventsBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToRealmSettings() {
this.waitForPageLoad();
2022-02-15 16:02:17 +00:00
cy.get(this.realmSettingsBtn).click({ force: true });
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToAuthentication() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.authenticationBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToIdentityProviders() {
this.waitForPageLoad();
2021-05-07 18:42:59 +00:00
cy.get(this.identityProvidersBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
goToUserFederation() {
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
cy.get(this.userFederationBtn).click();
this.waitForPageLoad();
2021-01-27 12:56:28 +00:00
return this;
}
waitForPageLoad() {
cy.get('[role="progressbar"]').should("not.exist");
return this;
}
2021-01-27 12:56:28 +00:00
}