From 23b11eb879d74bc6e9c7e5cbd96c1ac878f0b702 Mon Sep 17 00:00:00 2001 From: Aboullos <61687012+Aboullos@users.noreply.github.com> Date: Wed, 5 Jan 2022 10:56:38 +0100 Subject: [PATCH] Update Masthead tests (#1820) --- cypress/integration/login_test.spec.ts | 2 +- cypress/integration/masthead_test.spec.ts | 2 +- cypress/support/pages/admin_console/Masthead.ts | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cypress/integration/login_test.spec.ts b/cypress/integration/login_test.spec.ts index eef192d9ff..22b7b4d238 100644 --- a/cypress/integration/login_test.spec.ts +++ b/cypress/integration/login_test.spec.ts @@ -22,7 +22,7 @@ describe("Logging In", () => { it("logs in", () => { loginPage.logIn(username, password); - masthead.isAdminConsole(); + masthead.checkIsAdminConsole(); cy.getCookie("KEYCLOAK_SESSION_LEGACY").should("exist"); }); diff --git a/cypress/integration/masthead_test.spec.ts b/cypress/integration/masthead_test.spec.ts index 4393a31eb2..b932b3b500 100644 --- a/cypress/integration/masthead_test.spec.ts +++ b/cypress/integration/masthead_test.spec.ts @@ -19,7 +19,7 @@ const goToAcctMgtTest = () => { masthead.accountManagement(); cy.contains("Welcome to Keycloak Account Management"); cy.get("#landingReferrerLink").click({ force: true }); - masthead.isAdminConsole(); + masthead.checkIsAdminConsole(); }); }; diff --git a/cypress/support/pages/admin_console/Masthead.ts b/cypress/support/pages/admin_console/Masthead.ts index 38b6a5289b..fb306eac22 100644 --- a/cypress/support/pages/admin_console/Masthead.ts +++ b/cypress/support/pages/admin_console/Masthead.ts @@ -5,9 +5,8 @@ export default class Masthead { private userDrpDwn = "#user-dropdown"; private userDrpDwnKebab = "#user-dropdown-kebab"; - private isMobile = false; - isAdminConsole() { + checkIsAdminConsole() { cy.get(this.logoBtn).should("exist"); cy.get(this.userDrpDwn).should("exist"); @@ -15,11 +14,10 @@ export default class Masthead { } get isMobileMode() { - return this.isMobile; + return window.parent[0].innerWidth < 1024; } setMobileMode(isMobileMode: boolean) { - this.isMobile = isMobileMode; if (isMobileMode) { cy.viewport("iphone-6"); } else {