Skip to content

Commit

Permalink
Adding cookie policy approval dialog check
Browse files Browse the repository at this point in the history
Signed-off-by: Tibor Dancs <[email protected]>
  • Loading branch information
ScrewTSW committed Sep 26, 2023
1 parent e06dbb1 commit 54759ac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/e2e/pageobjects/login/openshift/OcpRedHatLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/pageobjects/login/openshift/RedHatLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -34,6 +36,18 @@ export class RedHatLoginPage {
await this.driverHelper.waitVisibility(RedHatLoginPage.USERNAME_INPUT, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}

async waitAndConfirmCookiePolicy(): Promise<void> {
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<void> {
Logger.debug();

Expand Down

0 comments on commit 54759ac

Please sign in to comment.