From 54759acc4cdf7c5694e6622797efc8b6ea569257 Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Tue, 26 Sep 2023 17:52:40 +0200 Subject: [PATCH] Adding cookie policy approval dialog check Signed-off-by: Tibor Dancs --- .../login/openshift/OcpRedHatLoginPage.ts | 6 ++++++ .../pageobjects/login/openshift/RedHatLoginPage.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/e2e/pageobjects/login/openshift/OcpRedHatLoginPage.ts b/tests/e2e/pageobjects/login/openshift/OcpRedHatLoginPage.ts index d904cb4774d0..18b123b429db 100644 --- a/tests/e2e/pageobjects/login/openshift/OcpRedHatLoginPage.ts +++ b/tests/e2e/pageobjects/login/openshift/OcpRedHatLoginPage.ts @@ -40,6 +40,12 @@ export class OcpRedHatLoginPage implements ICheLoginPage { ); await this.ocpLogin.waitAndClickOnLoginProviderTitle(); await this.redHatLogin.waitRedHatLoginWelcomePage(); + try { + await this.redHatLogin.waitAndConfirmCookiePolicy(); + } catch (err) { + Logger.warn('Cookie confirmation dialog not present, continuing...'); + Logger.warn(`${err}`); + } await this.redHatLogin.enterUserNameRedHat(); await this.redHatLogin.clickNextButton(); await this.redHatLogin.enterPasswordRedHat(); diff --git a/tests/e2e/pageobjects/login/openshift/RedHatLoginPage.ts b/tests/e2e/pageobjects/login/openshift/RedHatLoginPage.ts index 5d51998ab8ee..03666aa108cb 100644 --- a/tests/e2e/pageobjects/login/openshift/RedHatLoginPage.ts +++ b/tests/e2e/pageobjects/login/openshift/RedHatLoginPage.ts @@ -22,6 +22,8 @@ export class RedHatLoginPage { private static readonly PASSWORD_INPUT: By = By.id('password'); private static readonly NEXT_BUTTON: By = By.id('login-show-step2'); private static readonly LOGIN_BUTTON: By = By.id('rh-password-verification-submit-button'); + private static readonly COOKIE_DIALOG_IFRAME: By = By.xpath('//div[@class="truste_box_overlay"]//iframe[@class="truste_popframe"]'); + private static readonly COOKIE_DIALOG_BUTTON: By = By.xpath('//div[@class="pdynamicbutton"]//a[@class="call"]'); constructor( @inject(CLASSES.DriverHelper) @@ -34,6 +36,18 @@ export class RedHatLoginPage { await this.driverHelper.waitVisibility(RedHatLoginPage.USERNAME_INPUT, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT); } + async waitAndConfirmCookiePolicy(): Promise { + Logger.debug(); + + await this.driverHelper.waitVisibility(RedHatLoginPage.COOKIE_DIALOG_IFRAME, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT); + await this.driverHelper + .getDriver() + .switchTo() + .frame(await this.driverHelper.getDriver().findElement(RedHatLoginPage.COOKIE_DIALOG_IFRAME)); + await this.driverHelper.waitAndClick(RedHatLoginPage.COOKIE_DIALOG_BUTTON, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT); + await this.driverHelper.refreshPage(); + } + async enterPasswordRedHat(): Promise { Logger.debug();