keycloak-scim/cypress/support/pages/admin_console/SidebarPage.ts
Aboullos 5227115f05
Add Clients tests, fix notification message and stabilize tests (#1999)
* Add Clients tests and fix notification message

* Remove TODO message

* Add waits and refactor

* Refactor and fix tests in realm settings

* Fix lint

* Refactor, fix tests and add stability

* Refactor and stabilize tests

* Stabilize tests

* Fix Realm settings event test and stabilize

* Set confirmModal to always force click

* Add force click and wait

* Fix masthead test

* Modify cypress.json

* Modify realm dropdown selector

* Revert hook changes
2022-02-16 17:34:54 +01:00

133 lines
3 KiB
TypeScript

export default class SidebarPage {
private realmsDrpDwn = "#realm-select button.pf-c-dropdown__toggle";
private realmsList = '#realm-select ul[role="menu"]';
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";
getCurrentRealm() {
return cy.get(this.realmsDrpDwn).scrollIntoView().invoke("text");
}
goToRealm(realmName: string) {
this.waitForPageLoad();
cy.get(this.realmsDrpDwn).scrollIntoView().click({ force: true });
cy.get(this.realmsList).contains(realmName).click({ force: true });
this.waitForPageLoad();
return this;
}
goToCreateRealm() {
this.waitForPageLoad();
cy.get(this.realmsDrpDwn).scrollIntoView().click({ force: true });
cy.findByTestId(this.createRealmBtn).click({ force: true });
this.waitForPageLoad();
return this;
}
goToClients() {
this.waitForPageLoad();
cy.get(this.clientsBtn).scrollIntoView().click({ force: true });
this.waitForPageLoad();
return this;
}
goToClientScopes() {
this.waitForPageLoad();
cy.get(this.clientScopesBtn).scrollIntoView().click();
this.waitForPageLoad();
return this;
}
goToRealmRoles() {
this.waitForPageLoad();
cy.get(this.realmRolesBtn).click();
this.waitForPageLoad();
return this;
}
goToUsers() {
this.waitForPageLoad();
cy.get(this.usersBtn).click();
this.waitForPageLoad();
return this;
}
goToGroups() {
this.waitForPageLoad();
cy.get(this.groupsBtn).click();
this.waitForPageLoad();
return this;
}
goToSessions() {
this.waitForPageLoad();
cy.get(this.sessionsBtn).click();
this.waitForPageLoad();
return this;
}
goToEvents() {
this.waitForPageLoad();
cy.get(this.eventsBtn).click();
this.waitForPageLoad();
return this;
}
goToRealmSettings() {
this.waitForPageLoad();
cy.get(this.realmSettingsBtn).click({ force: true });
this.waitForPageLoad();
return this;
}
goToAuthentication() {
this.waitForPageLoad();
cy.get(this.authenticationBtn).click();
this.waitForPageLoad();
return this;
}
goToIdentityProviders() {
this.waitForPageLoad();
cy.get(this.identityProvidersBtn).click();
this.waitForPageLoad();
return this;
}
goToUserFederation() {
this.waitForPageLoad();
cy.get(this.userFederationBtn).click();
this.waitForPageLoad();
return this;
}
waitForPageLoad() {
cy.get('[role="progressbar"]').should("not.exist");
return this;
}
}