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

[TS_SELENIUM] Increase logging of tests steps #14686

Merged
merged 23 commits into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e3cbea5
Update chromedriver version
Ohrimenko1988 Aug 7, 2019
431f48e
Merge branch 'master' of https://github.com/eclipse/che into selen-up…
Ohrimenko1988 Sep 6, 2019
56fff68
Merge branch 'master' of https://github.com/eclipse/che into selen-up…
Ohrimenko1988 Sep 23, 2019
80dbe47
Create logger
Ohrimenko1988 Sep 23, 2019
fbbe35d
Merge branch 'selen-update-driver' of https://github.com/eclipse/che …
Ohrimenko1988 Sep 23, 2019
cc208d6
Add log covering
Ohrimenko1988 Sep 23, 2019
cd17c84
Cleanup code
Ohrimenko1988 Sep 24, 2019
009c863
Merge branch 'master' of https://github.com/eclipse/che into selen-lo…
Ohrimenko1988 Sep 24, 2019
f29784c
Cover classes from 'ide' package by logging
Ohrimenko1988 Sep 24, 2019
00a443c
Add logging of 'Editor' pageobject
Ohrimenko1988 Sep 25, 2019
75f4ca2
Cover the 'WorkspaceDetails' by logging
Ohrimenko1988 Sep 25, 2019
1aa2970
Cover the 'WorkspaceDetailsPlugins' by logging
Ohrimenko1988 Sep 25, 2019
dca6d07
Cover the 'Dashboard' by logging
Ohrimenko1988 Sep 25, 2019
c53f36b
Cover the 'NewWorkspace' by logging
Ohrimenko1988 Sep 25, 2019
f267fa1
Cover the 'Workspaces' by logging
Ohrimenko1988 Sep 25, 2019
00b22c3
Cover the 'MultiUserLoginPage' by logging
Ohrimenko1988 Sep 25, 2019
c615a06
Cover the 'OcpLoginByTempAdmin' by logging
Ohrimenko1988 Sep 25, 2019
ac9fdb8
Cover the 'SingleUserLoginPage' by logging
Ohrimenko1988 Sep 25, 2019
b4d5c16
Cover the 'OcpLoginPage' by logging
Ohrimenko1988 Sep 25, 2019
402cf48
Cover the 'OcpWebConsolePage' by logging
Ohrimenko1988 Sep 25, 2019
68b7c58
Intermediate changes
Ohrimenko1988 Sep 26, 2019
647be42
Merge master and resolve conflict
Ohrimenko1988 Sep 27, 2019
ee08d0e
Increase timeot in the 'waitSuggestion' method
Ohrimenko1988 Sep 27, 2019
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
25 changes: 23 additions & 2 deletions e2e/pageobjects/dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { By } from 'selenium-webdriver';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { Workspaces } from './Workspaces';
import { Logger } from '../../utils/Logger';

@injectable()
export class Dashboard {
Expand All @@ -27,6 +28,8 @@ export class Dashboard {
@inject(CLASSES.Workspaces) private readonly workspaces: Workspaces) { }

async stopWorkspaceByUI(workspaceName: string) {
Logger.debug(`Dashboard.stopWorkspaceByUI "${workspaceName}"`);

await this.openDashboard();
await this.clickWorkspacesButton();
await this.workspaces.waitPage();
Expand All @@ -37,6 +40,8 @@ export class Dashboard {
}

async deleteWorkspaceByUI(workspaceName: string) {
Logger.debug(`Dashboard.deleteWorkspaceByUI "${workspaceName}"`);

await this.openDashboard();
await this.clickWorkspacesButton();
await this.workspaces.waitPage();
Expand All @@ -49,39 +54,55 @@ export class Dashboard {
}

async openDashboard() {
await this.driverHelper.getDriver().navigate().to(TestConstants.TS_SELENIUM_BASE_URL);
await this.waitPage();
Logger.debug('Dashboard.openDashboard');

await this.driverHelper.getDriver().navigate().to(TestConstants.TS_SELENIUM_BASE_URL);
await this.waitPage();

}

async waitPage(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('Dashboard.waitPage');

await this.driverHelper.waitVisibility(By.css(Dashboard.DASHBOARD_BUTTON_CSS), timeout);
await this.driverHelper.waitVisibility(By.css(Dashboard.WORKSPACES_BUTTON_CSS), timeout);
await this.driverHelper.waitVisibility(By.css(Dashboard.STACKS_BUTTON_CSS), timeout);
await this.driverHelper.waitVisibility(By.css(Dashboard.FACTORIES_BUTTON_CSS), timeout);
}

async clickDashboardButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.clickDashboardButton');

await this.driverHelper.waitAndClick(By.css(Dashboard.DASHBOARD_BUTTON_CSS), timeout);
}

async clickWorkspacesButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.clickWorkspacesButton');

await this.driverHelper.waitAndClick(By.css(Dashboard.WORKSPACES_BUTTON_CSS), timeout);
}

async clickStacksdButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.clickStacksdButton');

await this.driverHelper.waitAndClick(By.css(Dashboard.STACKS_BUTTON_CSS), timeout);
}

async clickFactoriesButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.clickFactoriesButton');

await this.driverHelper.waitAndClick(By.css(Dashboard.FACTORIES_BUTTON_CSS), timeout);
}

async waitLoader(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.waitLoader');

await this.driverHelper.waitVisibility(By.css(Dashboard.LOADER_PAGE_CSS), timeout);
}

async waitLoaderDisappearance(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Dashboard.waitLoaderDisappearance');

await this.driverHelper.waitDisappearance(By.css(Dashboard.LOADER_PAGE_CSS), timeout);
}

Expand Down
45 changes: 45 additions & 0 deletions e2e/pageobjects/dashboard/NewWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Dashboard } from './Dashboard';
import { Workspaces } from './Workspaces';
import { WorkspaceDetails } from './workspace-details/WorkspaceDetails';
import { ITestWorkspaceUtil, Ide, WorkspaceStatus } from '../..';
import { Logger } from '../../utils/Logger';


@injectable()
Expand All @@ -40,6 +41,8 @@ export class NewWorkspace {
@inject(CLASSES.WorkspaceDetails) private readonly workspaceDetails: WorkspaceDetails) { }

async createAndRunWorkspace(namespace: string, workspaceName: string, dataStackId: string) {
Logger.debug(`NewWorkspace.createAndRunWorkspace "${namespace}/${workspaceName}" stackID: "${dataStackId}"`);

await this.prepareWorkspace(workspaceName, dataStackId);
await this.clickOnCreateAndOpenButton();

Expand All @@ -49,45 +52,61 @@ export class NewWorkspace {
}

async waitPageAbsence(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('NewWorkspace.waitPageAbsence');

await this.driverHelper.waitDisappearanceWithTimeout(By.css(NewWorkspace.NAME_FIELD_CSS), timeout);
await this.driverHelper.waitDisappearanceWithTimeout(By.css(NewWorkspace.TITLE_CSS), timeout);
}

async createWorkspaceAndProceedEditing(workspaceName: string, dataStackId: string) {
Logger.debug(`NewWorkspace.createWorkspaceAndProceedEditing "${workspaceName}" stackID: "${dataStackId}"`);

await this.prepareWorkspace(workspaceName, dataStackId);
await this.selectCreateWorkspaceAndProceedEditing();

await this.workspaceDetails.waitPage(workspaceName);
}

async createAndOpenWorkspace(workspaceName: string, dataStackId: string) {
Logger.debug(`NewWorkspace.createAndOpenWorkspace "${workspaceName}" stackID: "${dataStackId}"`);

await this.prepareWorkspace(workspaceName, dataStackId);
await this.clickOnCreateAndOpenButton();
}

async confirmProjectAdding(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.confirmProjectAdding "${sampleName}"`);

await this.clickOnAddButton(timeout);
await this.waitProjectAdding(sampleName, timeout);
}

async waitProjectSourceForm(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.waitProjectSourceForm');

await this.driverHelper.waitVisibility(By.css(NewWorkspace.PROJECT_SOURCE_FORM_CSS), timeout);
}

async selectStack(dataStackId: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.selectStack datastackID: "${dataStackId}"`);

const stackLocator: By = By.css(this.getStackCssLocator(dataStackId));

await this.driverHelper.waitAndClick(stackLocator, timeout);
await this.waitStackSelection(dataStackId, timeout);
}

async waitStackSelection(dataStackId: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.waitStackSelection datastackID: "${dataStackId}"`);

const selectedStackLocator: By = By.css(this.getSelectedStackCssLocator(dataStackId));

await this.driverHelper.waitAndClick(selectedStackLocator, timeout);
}

async openPageByUI() {
Logger.debug('NewWorkspace.openPageByUI');

await this.dashboard.waitPage();
await this.dashboard.clickWorkspacesButton();
await this.workspaces.clickAddWorkspaceButton();
Expand All @@ -96,16 +115,22 @@ export class NewWorkspace {
}

async waitPage(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('NewWorkspace.waitPage');

await this.driverHelper.waitVisibility(By.css(NewWorkspace.NAME_FIELD_CSS), timeout);
await this.driverHelper.waitVisibility(By.css(NewWorkspace.TITLE_CSS), timeout);
await this.waitLoaderAbsence(timeout);
}

async waitLoaderAbsence(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('NewWorkspace.waitLoaderAbsence');

await this.driverHelper.waitPresence(By.css(NewWorkspace.HIDDEN_LOADER_CSS), timeout);
}

async selectCreateWorkspaceAndProceedEditing(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.selectCreateWorkspaceAndProceedEditing');

const createAndProceedEditingButtonLocator: By = By.xpath('//span[text()=\'Create & Proceed Editing\']');

// open drop down list
Expand All @@ -116,25 +141,33 @@ export class NewWorkspace {
}

async typeWorkspaceName(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.typeWorkspaceName "${workspaceName}"`);

const workspaceNameFieldLocator: By = By.css(NewWorkspace.NAME_FIELD_CSS);

await this.driverHelper.enterValue(workspaceNameFieldLocator, workspaceName, timeout);
}

async clickOnChe7Stack(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.clickOnChe7Stack');

const che7StackLocator: By = By.css(NewWorkspace.CHE_7_STACK_CSS);

await this.driverHelper.waitAndClick(che7StackLocator, timeout);
await this.waitChe7StackSelected(timeout);
}

async waitChe7StackSelected(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.waitChe7StackSelected');

const che7SelectedStackLocator: By = By.css(NewWorkspace.SELECTED_CHE_7_STACK_CSS);

await this.driverHelper.waitVisibility(che7SelectedStackLocator, timeout);
}

async clickOnCreateAndOpenButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.clickOnCreateAndOpenButton');

const ideFrameLocator: By = By.xpath('//ide-iframe[@id=\'ide-iframe-window\' and @aria-hidden=\'false\']');

await this.driverHelper.waitAndClick(By.xpath(NewWorkspace.CREATE_AND_OPEN_BUTTON_XPATH), timeout);
Expand All @@ -144,38 +177,50 @@ export class NewWorkspace {
}

async clickOnAddOrImportProjectButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.clickOnAddOrImportProjectButton');

const addOrImportProjectButtonLocator: By = By.css(NewWorkspace.ADD_OR_IMPORT_PROJECT_BUTTON_CSS);

await this.driverHelper.waitAndClick(addOrImportProjectButtonLocator, timeout);
await this.waitProjectSourceForm(timeout);
}

async waitSampleCheckboxEnabling(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.waitSampleCheckboxEnabling "${sampleName}"`);

const enabledSampleCheckboxLocator: By = By.css(`#sample-${sampleName}>md-checkbox[aria-checked='true']`);

await this.driverHelper.waitVisibility(enabledSampleCheckboxLocator, timeout);
}

async enableSampleCheckbox(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.enableSampleCheckbox "${sampleName}"`);

const sampleCheckboxLocator: By = By.xpath(`(//*[@id='sample-${sampleName}']//md-checkbox//div)[1]`);

await this.driverHelper.waitAndClick(sampleCheckboxLocator, timeout);
await this.waitSampleCheckboxEnabling(sampleName, timeout);
}

async waitProjectAdding(projectName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.waitProjectAdding "${projectName}"`);

const addedProjectLocator: By = By.css(`#project-source-selector toggle-single-button#${projectName}`);

await this.driverHelper.waitVisibility(addedProjectLocator, timeout);
}

async waitProjectAbsence(projectName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`NewWorkspace.waitProjectAbsence "${projectName}"`);

const addedProjectLocator: By = By.css(`#project-source-selector toggle-single-button#${projectName}`);

await this.driverHelper.waitDisappearance(addedProjectLocator, timeout);
}

async clickOnAddButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('NewWorkspace.clickOnAddButton');

await this.driverHelper.waitAndClick(By.css(NewWorkspace.ADD_BUTTON_CSS), timeout);
}

Expand Down
25 changes: 23 additions & 2 deletions e2e/pageobjects/dashboard/Workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { injectable, inject } from 'inversify';
import { DriverHelper } from '../../utils/DriverHelper';
import { CLASSES } from '../../inversify.types';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';


@injectable()
Expand All @@ -22,58 +23,78 @@ export class Workspaces {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }

async waitPage(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Workspaces.waitPage');

await this.driverHelper.waitVisibility(By.css(Workspaces.ADD_WORKSPACE_BUTTON_CSS), timeout);
}

async clickAddWorkspaceButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('Workspaces.clickAddWorkspaceButton');

await this.driverHelper.waitAndClick(By.css(Workspaces.ADD_WORKSPACE_BUTTON_CSS), timeout);
}

async waitWorkspaceListItem(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceListItem "${workspaceName}"`);

const workspaceListItemLocator: By = By.css(this.getWorkspaceListItemLocator(workspaceName));

await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
}

async clickOnStopWorkspaceButton(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`Workspaces.clickOnStopWorkspaceButton "${workspaceName}"`);

const stopWorkspaceButtonLocator: By = By.css(`#ws-name-${workspaceName} .workspace-status[uib-tooltip="Stop workspace"]`);

await this.driverHelper.waitAndClick(stopWorkspaceButtonLocator, timeout);
}

async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceWithRunningStatus "${workspaceName}"`);

const runningStatusLocator: By = By.css(this.getWorkspaceStatusCssLocator(workspaceName, 'RUNNING'));

await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
}

async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceWithStoppedStatus "${workspaceName}"`);

const stoppedStatusLocator: By = By.css(this.getWorkspaceStatusCssLocator(workspaceName, 'STOPPED'));

await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
}

async clickWorkspaceListItem(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
var namespace : string = TestConstants.TS_SELENIUM_USERNAME;
Logger.debug(`Workspaces.clickWorkspaceListItem "${workspaceName}"`);

var namespace: string = TestConstants.TS_SELENIUM_USERNAME;
const workspaceListItemLocator: By = By.css(`div[id='ws-full-name-${namespace}/${workspaceName}']`);

await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
}

async clickDeleteButtonOnWorkspaceDetails(timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug('Workspaces.clickDeleteButtonOnWorkspaceDetails');

const deleteButtonOnWorkspaceDetailsLocator: By = By.css('che-button-danger[che-button-title=\'Delete\']');

await this.driverHelper.waitAndClick(deleteButtonOnWorkspaceDetailsLocator, timeout);
}

async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
var namespace : string = TestConstants.TS_SELENIUM_USERNAME;
Logger.debug(`Workspaces.waitWorkspaceListItemAbcence "${workspaceName}"`);

var namespace: string = TestConstants.TS_SELENIUM_USERNAME;
const workspaceListItemLocator: By = By.css(`div[id='ws-full-name-${namespace}/${workspaceName}']`);

await this.driverHelper.waitDisappearance(workspaceListItemLocator, timeout);
}

async clickConfirmDeletionButton(timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug('Workspaces.clickConfirmDeletionButton');

await this.driverHelper.waitAndClick(By.css('#ok-dialog-button'), timeout);
}

Expand Down
Loading