keycloak-scim/tests/cypress/support/pages/admin_console/Masthead.js
Stan Silvert f2e26b0049
Cypress tests for masthead. (#304)
* Cypress tests for masthead.

* Update snapshot

* Update Keycloak version.

* Fix download address

* Update start.js

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Follow redirect when downloading keycloak.

* Refactor HeaderPage into Masthead and ModalUtils

* Minor change to kick off build.

* logOutTest no longer needs a param

* goToAcctMgtTest no longer needs a param

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Fix userDropdown() method

* Minor refactor

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>
2021-01-21 07:09:50 -05:00

58 lines
1.1 KiB
JavaScript

export default class Masthead {
constructor() {
this.menuBtn = "#nav-toggle";
this.logoBtn = "#masthead-logo";
this.helpBtn = "#help";
this.userDrpDwn = "#user-dropdown";
this.userDrpDwnKebab = "#user-dropdown-kebab";
}
isAdminConsole() {
cy.get(this.logoBtn).should("exist");
cy.get(this.userDrpDwn).should("exist");
return this;
}
isMobileMode() {
return cy.window().specWindow.parent[0].innerWidth < 768;
}
setMobileMode(isMobileMode) {
if (isMobileMode) {
cy.viewport("iphone-6");
} else {
cy.viewport();
}
}
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) {
cy.contains(message).should("exist");
return this;
}
}