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