Skip to content

Commit

Permalink
Added new logic for the landing page into appropriate login handler c…
Browse files Browse the repository at this point in the history
…lasses, updated dependencies (#21409)

Signed-off-by: Tibor Dancs <tdancs@redhat.com>
  • Loading branch information
ScrewTSW authored May 18, 2022
1 parent 8e6670a commit 9209044
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
14 changes: 7 additions & 7 deletions tests/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 12 additions & 1 deletion tests/e2e/pageobjects/login/RegularUserOcpCheLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 5 additions & 1 deletion tests/e2e/tests/login/Login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
* 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<ICheLoginPage>(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.`);
Expand Down
6 changes: 1 addition & 5 deletions tests/e2e/testsLibrary/CodeExecutionTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 9209044

Please sign in to comment.