Skip to content

Commit

Permalink
[e2e] Added multiuser support.
Browse files Browse the repository at this point in the history
Signed-off-by: Radim Hopp <rhopp@redhat.com>
  • Loading branch information
rhopp committed Sep 4, 2019
1 parent 25de692 commit 9072be9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
8 changes: 2 additions & 6 deletions e2e/pageobjects/ide/Ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
import axios from 'axios';
import { DriverHelper } from '../../utils/DriverHelper';
import { injectable, inject } from 'inversify';
import { CLASSES, TYPES } from '../../inversify.types';
import { CLASSES } from '../../inversify.types';
import { TestConstants } from '../../TestConstants';
import { By, WebElement, error } from 'selenium-webdriver';
import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
import { WorkspaceStatus } from '../../utils/workspace/WorkspaceStatus';

export enum RightToolbarButton {
Explorer = 'Explorer',
Expand All @@ -34,8 +32,7 @@ export class Ide {
private static readonly IDE_IFRAME_CSS: string = 'iframe#ide-application-iframe';

constructor(
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
@inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil) { }
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }

async waitAndSwitchToIdeFrame(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
await this.driverHelper.waitAndSwitchToFrame(By.css(Ide.IDE_IFRAME_CSS), timeout);
Expand Down Expand Up @@ -104,7 +101,6 @@ export class Ide {
timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {

await this.waitAndSwitchToIdeFrame(timeout);
await this.testWorkspaceUtil.waitWorkspaceStatus(workspaceNamespace, workspaceName, WorkspaceStatus.RUNNING);
await this.waitIde(timeout);
}

Expand Down
13 changes: 2 additions & 11 deletions e2e/pageobjects/login/SingleUserLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,14 @@
**********************************************************************/
import 'reflect-metadata';
import { ICheLoginPage } from './ICheLoginPage';
import { injectable, inject } from 'inversify';
import { ThenableWebDriver } from 'selenium-webdriver';
import { TYPES, CLASSES } from '../../inversify.types';
import { IDriver } from '../../driver/IDriver';
import { injectable } from 'inversify';
import { TestConstants } from '../../TestConstants';
import { Dashboard } from '../dashboard/Dashboard';

@injectable()
export class SingleUserLoginPage implements ICheLoginPage {
constructor(
@inject(TYPES.Driver) private readonly driver: IDriver,
@inject(CLASSES.Dashboard) private readonly dashboard: Dashboard) { }

async login(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
const webDriver: ThenableWebDriver = this.driver.get();
await webDriver.navigate().to(TestConstants.TS_SELENIUM_BASE_URL);
await this.dashboard.waitPage(timeout);
// do nothing
}

}
7 changes: 5 additions & 2 deletions e2e/tests/e2e_happy_path/HappyPath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import { e2eContainer } from '../../inversify.config';
import { DriverHelper } from '../../utils/DriverHelper';
import { CLASSES } from '../../inversify.types';
import { TYPES, CLASSES } from '../../inversify.types';
import { Ide, RightToolbarButton } from '../../pageobjects/ide/Ide';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { TopMenu } from '../../pageobjects/ide/TopMenu';
Expand All @@ -24,6 +24,7 @@ import { DebugView } from '../../pageobjects/ide/DebugView';
import { WarningDialog } from '../../pageobjects/ide/WarningDialog';
import { Terminal } from '../../pageobjects/ide/Terminal';
import { OpenWorkspaceWidget } from '../../pageobjects/ide/OpenWorkspaceWidget';
import { ICheLoginPage } from '../../pageobjects/login/ICheLoginPage';
import * as fs from 'fs';

const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
Expand Down Expand Up @@ -51,6 +52,7 @@ const textForErrorMessageChange: string = 'HHHHHHHHHHHHH';
const codeNavigationClassName: string = 'SpringApplication.class';
const pathToYamlFolder: string = projectName;
const yamlFileName: string = 'devfile.yaml';
const loginPage: ICheLoginPage = e2eContainer.get<ICheLoginPage>(TYPES.CheLogin);

const SpringAppLocators = {
springTitleLocator: By.xpath('//div[@class=\'container-fluid\']//h2[text()=\'Welcome\']'),
Expand All @@ -63,7 +65,8 @@ const SpringAppLocators = {

suite('Validation of workspace start', async () => {
test('Open workspace', async () => {
await driverHelper.navigateAndWaitToUrl(workspaceUrl);
await driverHelper.navigateToUrl(workspaceUrl);
await loginPage.login();
});

test('Wait workspace running state', async () => {
Expand Down

0 comments on commit 9072be9

Please sign in to comment.