keycloak-scim/cypress/support/pages/admin_console/Masthead.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

79 lines
1.8 KiB
TypeScript

export default class Masthead {
private menuBtn = "#nav-toggle";
private logoBtn = "#masthead-logo";
private helpBtn = "#help";
private closeAlertMessageBtn = ".pf-c-alert__action button";
private closeLastAlertMessageBtn =
".pf-c-alert-group > li:first-child .pf-c-alert__action button";
private alertMessage = ".pf-c-alert__title";
private userDrpDwn = "#user-dropdown";
private userDrpDwnKebab = "#user-dropdown-kebab";
checkIsAdminConsole() {
cy.get(this.logoBtn).should("exist");
cy.get(this.userDrpDwn).should("exist");
return this;
}
get isMobileMode() {
return window.parent[0].innerWidth < 1024;
}
setMobileMode(isMobileMode: boolean) {
if (isMobileMode) {
cy.viewport("iphone-6");
} else {
cy.viewport(1024, 768);
}
}
toggleGlobalHelp() {
cy.get(this.helpBtn).click();
cy.get("#enableHelp").click({ force: true });
}
userDropdown() {
if (this.isMobileMode) {
return cy.get(this.userDrpDwnKebab);
} else {
return cy.get(this.userDrpDwn);
}
}
signOut() {
this.userDropdown().click();
cy.get("#sign-out").click();
}
accountManagement() {
this.userDropdown().click();
cy.get("#manage-account").click();
}
checkNotificationMessage(message: string, closeNotification?: boolean) {
cy.get(this.alertMessage).should("contain.text", message);
if (closeNotification) {
this.closeLastAlertMessage();
}
return this;
}
closeLastAlertMessage() {
cy.get(this.closeLastAlertMessageBtn).click();
return this;
}
closeAllAlertMessages() {
cy.get(this.closeAlertMessageBtn).click({ multiple: true });
return this;
}
checkKebabShown() {
cy.get(this.userDrpDwn).should("not.be.visible");
cy.get(this.userDrpDwnKebab).should("exist");
return this;
}
}