From 9209044541803d886ab14f7e085311ac3b92cfa5 Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Wed, 18 May 2022 13:50:48 +0200 Subject: [PATCH] Added new logic for the landing page into appropriate login handler classes, updated dependencies (#21409) Signed-off-by: Tibor Dancs --- tests/e2e/package-lock.json | 14 +++++++------- tests/e2e/package.json | 2 +- .../login/RegularUserOcpCheLoginPage.ts | 13 ++++++++++++- tests/e2e/tests/login/Login.spec.ts | 6 +++++- tests/e2e/testsLibrary/CodeExecutionTests.ts | 6 +----- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json index cbf870e94e3..4a6839ba061 100644 --- a/tests/e2e/package-lock.json +++ b/tests/e2e/package-lock.json @@ -21,7 +21,7 @@ "@types/selenium-webdriver": "3.0.16", "axios": "^0.25.0", "chai": "4.2.0", - "chromedriver": "^99.0.0", + "chromedriver": "^101.0.0", "mocha": "^9.1.3", "rimraf": "2.6.2", "selenium-webdriver": "3.6.0", @@ -498,9 +498,9 @@ } }, "node_modules/chromedriver": { - "version": "99.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-99.0.0.tgz", - "integrity": "sha512-pyB+5LuyZdb7EBPL3i5D5yucZUD+SlkdiUtmpjaEnLd9zAXp+SvD/hP5xF4l/ZmWvUo/1ZLxAI1YBdhazGTpgA==", + "version": "101.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-101.0.0.tgz", + "integrity": "sha512-LkkWxy6KM/0YdJS8qBeg5vfkTZTRamhBfOttb4oic4echDgWvCU1E8QcBbUBOHqZpSrYMyi7WMKmKMhXFUaZ+w==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -2749,9 +2749,9 @@ } }, "chromedriver": { - "version": "99.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-99.0.0.tgz", - "integrity": "sha512-pyB+5LuyZdb7EBPL3i5D5yucZUD+SlkdiUtmpjaEnLd9zAXp+SvD/hP5xF4l/ZmWvUo/1ZLxAI1YBdhazGTpgA==", + "version": "101.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-101.0.0.tgz", + "integrity": "sha512-LkkWxy6KM/0YdJS8qBeg5vfkTZTRamhBfOttb4oic4echDgWvCU1E8QcBbUBOHqZpSrYMyi7WMKmKMhXFUaZ+w==", "dev": true, "requires": { "@testim/chrome-version": "^1.1.2", diff --git a/tests/e2e/package.json b/tests/e2e/package.json index 2e99122e1a1..b756d097de7 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -39,7 +39,7 @@ "@types/selenium-webdriver": "3.0.16", "axios": "^0.25.0", "chai": "4.2.0", - "chromedriver": "^99.0.0", + "chromedriver": "^101.0.0", "mocha": "^9.1.3", "rimraf": "2.6.2", "selenium-webdriver": "3.6.0", diff --git a/tests/e2e/pageobjects/login/RegularUserOcpCheLoginPage.ts b/tests/e2e/pageobjects/login/RegularUserOcpCheLoginPage.ts index 7c8af6eefe5..74a906ae5f5 100644 --- a/tests/e2e/pageobjects/login/RegularUserOcpCheLoginPage.ts +++ b/tests/e2e/pageobjects/login/RegularUserOcpCheLoginPage.ts @@ -15,17 +15,28 @@ import { injectable, inject } from 'inversify'; import { CLASSES } from '../../inversify.types'; import { TestConstants } from '../../TestConstants'; import { Logger } from '../../utils/Logger'; +import { TimeoutConstants } from '../../TimeoutConstants'; +import { By } from 'selenium-webdriver'; +import { DriverHelper } from '../../utils/DriverHelper'; @injectable() export class RegularUserOcpCheLoginPage implements ICheLoginPage { + private readonly OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR: string = `//div[@class='panel-login']`; + private readonly OPEN_SHIFT_LOGIN_LANDING_PAGE_BUTTON_LOCATOR: string = `${this.OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR}/div[contains(@class, 'panel-content')]/form/button`; + constructor( @inject(CLASSES.OcpLoginPage) private readonly ocpLogin: OcpLoginPage, - @inject(CLASSES.CheLoginPage) private readonly cheLogin: CheLoginPage) { } + @inject(CLASSES.CheLoginPage) private readonly cheLogin: CheLoginPage, + @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async login() { Logger.debug('RegularUserOcpCheLoginPage.login'); + Logger.debug('OcpRedHatLoginPage.login wait for LogInWithOpenShift page and click button'); + await this.driverHelper.waitPresence(By.xpath(this.OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT); + await this.driverHelper.waitAndClick(By.xpath(this.OPEN_SHIFT_LOGIN_LANDING_PAGE_BUTTON_LOCATOR)); + if (await this.ocpLogin.isIdentityProviderLinkVisible()) { await this.ocpLogin.clickOnLoginProviderTitle(); } diff --git a/tests/e2e/tests/login/Login.spec.ts b/tests/e2e/tests/login/Login.spec.ts index 19659a4f677..0614fb00b1e 100644 --- a/tests/e2e/tests/login/Login.spec.ts +++ b/tests/e2e/tests/login/Login.spec.ts @@ -8,9 +8,12 @@ * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -import { TestConstants, CLASSES, ICheLoginPage, TYPES, Logger } from '../..'; import { e2eContainer } from '../../inversify.config'; +import { CLASSES, TYPES } from '../../inversify.types'; +import { ICheLoginPage } from '../../pageobjects/login/ICheLoginPage'; +import { TestConstants } from '../../TestConstants'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; +import { Logger } from '../../utils/Logger'; const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const loginPage: ICheLoginPage = e2eContainer.get(TYPES.CheLogin); @@ -18,6 +21,7 @@ const loginPage: ICheLoginPage = e2eContainer.get(TYPES.CheLogin) suite('Login test', async () => { test('Login', async () => { await browserTabsUtil.navigateTo(TestConstants.TS_SELENIUM_BASE_URL); + await loginPage.login(); if (TestConstants.TS_SELENIUM_LAUNCH_FULLSCREEN) { Logger.debug(`TS_SELENIUM_LAUNCH_FULLSCREEN is set to true, maximizing window.`); diff --git a/tests/e2e/testsLibrary/CodeExecutionTests.ts b/tests/e2e/testsLibrary/CodeExecutionTests.ts index d6b469bd432..1f0823d8db0 100644 --- a/tests/e2e/testsLibrary/CodeExecutionTests.ts +++ b/tests/e2e/testsLibrary/CodeExecutionTests.ts @@ -20,8 +20,6 @@ import { DialogWindow } from '../pageobjects/ide/DialogWindow'; import { DriverHelper } from '../utils/DriverHelper'; import { Logger } from '../utils/Logger'; import { QuickOpenContainer } from '../pageobjects/ide/QuickOpenContainer'; -import { BrowserTabsUtil } from '../utils/BrowserTabsUtil'; -import { WorkspaceHandlingTests } from './WorkspaceHandlingTests'; @injectable() export class CodeExecutionTests { @@ -34,9 +32,7 @@ export class CodeExecutionTests { @inject(CLASSES.Ide) private readonly ide: Ide, @inject(CLASSES.DialogWindow) private readonly dialogWindow: DialogWindow, @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper, - @inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer, - @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil, - @inject(CLASSES.WorkspaceHandlingTests) private readonly workspaceHandlingTests: WorkspaceHandlingTests) {} + @inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer) {} public runTask(taskName: string, timeout: number) { test(`Run command '${taskName}'`, async () => {