Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] Added multiuser support. #14417

Merged
merged 1 commit into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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