From 0c68ea248dbabbc527e9298d8d5b850b1f0c38fb Mon Sep 17 00:00:00 2001 From: Igor Ohrimenko Date: Fri, 27 Sep 2019 14:20:37 +0300 Subject: [PATCH] [TS_SELENIUM] Increase logging of tests steps (#14686) Signed-off-by: Ihor Okhrimenko --- e2e/pageobjects/dashboard/Dashboard.ts | 25 +++- e2e/pageobjects/dashboard/NewWorkspace.ts | 45 ++++++ e2e/pageobjects/dashboard/Workspaces.ts | 25 +++- .../workspace-details/WorkspaceDetails.ts | 22 ++- .../WorkspaceDetailsPlugins.ts | 9 ++ e2e/pageobjects/ide/ContextMenu.ts | 9 ++ e2e/pageobjects/ide/DebugView.ts | 7 + e2e/pageobjects/ide/Editor.ts | 81 +++++++++-- e2e/pageobjects/ide/GitHubPlugin.ts | 11 +- e2e/pageobjects/ide/OpenWorkspaceWidget.ts | 16 ++- e2e/pageobjects/ide/PreviewWidget.ts | 25 +++- e2e/pageobjects/ide/QuickOpenContainer.ts | 9 ++ e2e/pageobjects/ide/RightToolbar.ts | 5 + e2e/pageobjects/ide/Terminal.ts | 19 +++ e2e/pageobjects/ide/TopMenu.ts | 9 ++ e2e/pageobjects/ide/WarningDialog.ts | 8 ++ e2e/pageobjects/login/MultiUserLoginPage.ts | 11 ++ e2e/pageobjects/login/OcpLoginByTempAdmin.ts | 3 + e2e/pageobjects/login/SingleUserLoginPage.ts | 3 + e2e/pageobjects/openshift/OcpLoginPage.ts | 31 ++-- .../openshift/OcpWebConsolePage.ts | 134 +++++++++++++----- e2e/tests/e2e_happy_path/HappyPath.spec.ts | 2 +- 22 files changed, 450 insertions(+), 59 deletions(-) diff --git a/e2e/pageobjects/dashboard/Dashboard.ts b/e2e/pageobjects/dashboard/Dashboard.ts index 089ca570351..dda069fd539 100644 --- a/e2e/pageobjects/dashboard/Dashboard.ts +++ b/e2e/pageobjects/dashboard/Dashboard.ts @@ -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 { @@ -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(); @@ -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(); @@ -49,12 +54,16 @@ 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); @@ -62,26 +71,38 @@ export class Dashboard { } 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); } diff --git a/e2e/pageobjects/dashboard/NewWorkspace.ts b/e2e/pageobjects/dashboard/NewWorkspace.ts index 5a32ed245b9..cd63615ad33 100644 --- a/e2e/pageobjects/dashboard/NewWorkspace.ts +++ b/e2e/pageobjects/dashboard/NewWorkspace.ts @@ -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() @@ -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(); @@ -49,11 +52,15 @@ 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(); @@ -61,20 +68,28 @@ export class NewWorkspace { } 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); @@ -82,12 +97,16 @@ export class NewWorkspace { } 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(); @@ -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 @@ -116,12 +141,16 @@ 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); @@ -129,12 +158,16 @@ export class NewWorkspace { } 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); @@ -144,6 +177,8 @@ 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); @@ -151,12 +186,16 @@ export class NewWorkspace { } 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); @@ -164,18 +203,24 @@ export class NewWorkspace { } 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); } diff --git a/e2e/pageobjects/dashboard/Workspaces.ts b/e2e/pageobjects/dashboard/Workspaces.ts index 62e838528ec..c18b588c2b3 100644 --- a/e2e/pageobjects/dashboard/Workspaces.ts +++ b/e2e/pageobjects/dashboard/Workspaces.ts @@ -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() @@ -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); } diff --git a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts index 8c0ab2b1edd..da685ec1a7c 100644 --- a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +++ b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts @@ -16,6 +16,7 @@ import { By } from 'selenium-webdriver'; import { Ide } from '../../ide/Ide'; import { ITestWorkspaceUtil } from '../../../utils/workspace/ITestWorkspaceUtil'; import { WorkspaceStatus } from '../../../utils/workspace/WorkspaceStatus'; +import { Logger } from '../../../utils/Logger'; @injectable() @@ -30,16 +31,22 @@ export class WorkspaceDetails { @inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil) { } async waitLoaderDisappearance(attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) { + Logger.debug('WorkspaceDetails.waitLoaderDisappearance'); + await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.WORKSPACE_DETAILS_LOADER_CSS), attempts, polling); } async saveChanges() { + Logger.debug('WorkspaceDetails.saveChanges'); + await this.waitSaveButton(); await this.clickOnSaveButton(); await this.waitSaveButtonDisappearance(); } async waitPage(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug(`WorkspaceDetails.saveChanges workspace: "${workspaceName}"`); + await this.waitWorkspaceTitle(workspaceName, timeout); await this.waitOpenButton(timeout); await this.waitRunButton(timeout); @@ -48,31 +55,42 @@ export class WorkspaceDetails { } async waitWorkspaceTitle(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug(`WorkspaceDetails.waitWorkspaceTitle title: "${workspaceName}"`); + const workspaceTitleLocator: By = By.css(this.getWorkspaceTitleCssLocator(workspaceName)); await this.driverHelper.waitVisibility(workspaceTitleLocator, timeout); } async waitRunButton(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug('WorkspaceDetails.waitRunButton'); + await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout); } async clickOnRunButton(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug('WorkspaceDetails.clickOnRunButton'); + await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout); } async waitOpenButton(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug('WorkspaceDetails.waitOpenButton'); + await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout); } async openWorkspace(namespace: string, workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { - await this.clickOnOpenButton(timeout); + Logger.debug(`WorkspaceDetails.openWorkspace "${namespace}/${workspaceName}"`); + await this.clickOnOpenButton(timeout); await this.driverHelper.waitVisibility(By.css(Ide.ACTIVATED_IDE_IFRAME_CSS)); await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.STARTING); } async waitTabsPresence(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug('WorkspaceDetails.waitTabsPresence'); + const workspaceDetailsTabs: Array = ['Overview', 'Projects', 'Containers', 'Servers', 'Env Variables', 'Volumes', 'Config', 'SSH', 'Plugins', 'Editors']; @@ -84,6 +102,8 @@ export class WorkspaceDetails { } async selectTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`WorkspaceDetails.selectTab ${tabTitle}`); + await this.clickOnTab(tabTitle, timeout); await this.waitTabSelected(tabTitle, timeout); } diff --git a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts index ebfbdc427a8..83583753d2c 100644 --- a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +++ b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts @@ -16,6 +16,7 @@ import { By } from 'selenium-webdriver'; import { WorkspaceDetails } from './WorkspaceDetails'; import { ITestWorkspaceUtil } from '../../../utils/workspace/ITestWorkspaceUtil'; import { WorkspaceStatus } from '../../../utils/workspace/WorkspaceStatus'; +import { Logger } from '../../../utils/Logger'; @injectable() @@ -25,24 +26,32 @@ export class WorkspaceDetailsPlugins { @inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil) { } async waitPluginListItem(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`WorkspaceDetailsPlugins.waitPluginListItem ${pluginName}`); + const pluginListItemLocator: By = By.css(this.getPluginListItemCssLocator(pluginName)); await this.driverHelper.waitVisibility(pluginListItemLocator, timeout); } async enablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`WorkspaceDetailsPlugins.enablePlugin ${pluginName}:${pluginVersion}`); + await this.waitPluginDisabling(pluginName, pluginVersion, timeout); await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout); await this.waitPluginEnabling(pluginName, pluginVersion, timeout); } async disablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`WorkspaceDetailsPlugins.disablePlugin ${pluginName}:${pluginVersion}`); + await this.waitPluginEnabling(pluginName, pluginVersion, timeout); await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout); await this.waitPluginDisabling(pluginName, pluginVersion, timeout); } async addPluginAndOpenWorkspace(namespace: string, workspaceName: string, pluginName: string, pluginId: string, pluginVersion?: string) { + Logger.debug(`WorkspaceDetailsPlugins.addPluginAndOpenWorkspace ${namespace}/${workspaceName} plugin: ${pluginName}:${pluginVersion}`); + await this.workspaceDetails.selectTab('Plugins'); await this.enablePlugin(pluginName, pluginVersion); await this.workspaceDetails.saveChanges(); diff --git a/e2e/pageobjects/ide/ContextMenu.ts b/e2e/pageobjects/ide/ContextMenu.ts index b02713c6960..6caa706e0a9 100644 --- a/e2e/pageobjects/ide/ContextMenu.ts +++ b/e2e/pageobjects/ide/ContextMenu.ts @@ -4,6 +4,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { CLASSES } from '../../inversify.types'; import { WebElement, Button, By, Key } from 'selenium-webdriver'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @@ -15,23 +16,31 @@ export class ContextMenu { async invokeContextMenuOnTheElementWithMouse(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`ContextMenu.invokeContextMenuOnTheElementWithMouse ${elementLocator}`); + const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, timeout); await this.driverHelper.getAction().click(webElement, Button.RIGHT).perform(); this.waitContextMenu(timeout); } async invokeContextMenuOnActiveElementWithKeys(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('ContextMenu.invokeContextMenuOnActiveElementWithKeys'); + this.driverHelper.getDriver().switchTo().activeElement().sendKeys(Key.SHIFT + Key.F10); this.waitContextMenu(timeout); } async waitContextMenuAndClickOnItem(nameOfItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`ContextMenu.waitContextMenuAndClickOnItem "${nameOfItem}"`); + const itemLocator: string = `//div[@class='p-Menu-itemLabel' and text()='${nameOfItem}']`; await this.waitContextMenu(); await this.driverHelper.waitAndClick(By.xpath(itemLocator), timeout); } async waitContextMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`ContextMenu.waitContextMenu`); + await this.driverHelper.waitVisibility(By.css(ContextMenu.SUGGESTION_WIDGET_BODY_CSS), timeout); } diff --git a/e2e/pageobjects/ide/DebugView.ts b/e2e/pageobjects/ide/DebugView.ts index 152c13d503d..feafe5fea4b 100644 --- a/e2e/pageobjects/ide/DebugView.ts +++ b/e2e/pageobjects/ide/DebugView.ts @@ -12,6 +12,7 @@ import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { By, Key } from 'selenium-webdriver'; import { Ide } from './Ide'; +import { Logger } from '../../utils/Logger'; @injectable() @@ -20,10 +21,14 @@ export class DebugView { @inject(CLASSES.Ide) private readonly ide: Ide) { } async clickOnDebugConfigurationDropDown() { + Logger.debug('DebugView.clickOnDebugConfigurationDropDown'); + await this.driverHelper.waitAndClick(By.css('select.debug-configuration')); } async clickOnDebugConfigurationItem(itemText: string) { + Logger.debug(`DebugView.clickOnDebugConfigurationItem "${itemText}"`); + const configurationItemLocator: By = By.xpath(`//select[@class='debug-configuration']//option[text()=\'${itemText}\']`); await this.driverHelper.waitAndClick(configurationItemLocator); @@ -31,6 +36,8 @@ export class DebugView { } async clickOnRunDebugButton() { + Logger.debug('DebugView.clickOnRunDebugButton'); + const runDebugButtonLocator: By = By.xpath('//span[@title=\'Start Debugging\']'); await this.driverHelper.waitAndClick(runDebugButtonLocator); diff --git a/e2e/pageobjects/ide/Editor.ts b/e2e/pageobjects/ide/Editor.ts index 3bac3ff1fe5..1055e5bb041 100644 --- a/e2e/pageobjects/ide/Editor.ts +++ b/e2e/pageobjects/ide/Editor.ts @@ -14,6 +14,7 @@ import { CLASSES } from '../../inversify.types'; import { TestConstants } from '../../TestConstants'; import { By, Key, error, ActionSequence, Button } from 'selenium-webdriver'; import { Ide } from './Ide'; +import { Logger } from '../../utils/Logger'; @injectable() @@ -28,10 +29,14 @@ export class Editor { @inject(CLASSES.Ide) private readonly ide: Ide) { } public async waitSuggestionContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('Editor.waitSuggestionContainer'); + await this.driverHelper.waitVisibility(By.css(Editor.SUGGESTION_WIDGET_BODY_CSS), timeout); } public async waitSuggestionContainerClosed() { + Logger.debug('Editor.waitSuggestionContainerClosed'); + await this.driverHelper.waitDisappearanceWithTimeout(By.css(Editor.SUGGESTION_WIDGET_BODY_CSS)); } @@ -50,11 +55,13 @@ export class Editor { suggestionText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitSuggestion tabTitle: "${editorTabTitle}" suggestion: "${suggestionText}"`); + const suggestionLocator: By = this.getSuggestionLineXpathLocator(suggestionText); await this.driverHelper.getDriver().wait(async () => { try { - await this.scrollAndSearchSuggestion(editorTabTitle, suggestionLocator); + await this.scrollAndSearchSuggestion(editorTabTitle, suggestionLocator, 40000); return true; } catch (err) { if (!(err instanceof error.TimeoutError)) { @@ -69,39 +76,56 @@ export class Editor { } public async pressControlSpaceCombination(editorTabTitle: string) { + Logger.debug(`Editor.pressControlSpaceCombination "${editorTabTitle}"`); + await this.performKeyCombination(editorTabTitle, Key.chord(Key.CONTROL, Key.SPACE)); } public async pressEscapeButton(editorTabTitle: string) { + Logger.debug(`Editor.pressEscapeButton "${editorTabTitle}"`); + await this.performKeyCombination(editorTabTitle, Key.ESCAPE); } public async clickOnSuggestion(suggestionText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.clickOnSuggestion "${suggestionText}"`); + await this.driverHelper.waitAndClick(this.getSuggestionLineXpathLocator(suggestionText), timeout); } public async waitTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitTab "${tabTitle}"`); + await this.driverHelper.waitVisibility(By.xpath(this.getTabXpathLocator(tabTitle)), timeout); } public async waitTabDisappearance(tabTitle: string, attempt: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) { + + Logger.debug(`Editor.waitTabDisappearance "${tabTitle}"`); + await this.driverHelper.waitDisappearance(By.xpath(this.getTabXpathLocator(tabTitle)), attempt, polling); } public async clickOnTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.clickOnTab "${tabTitle}"`); + await this.ide.closeAllNotifications(); await this.driverHelper.waitAndClick(By.xpath(this.getTabXpathLocator(tabTitle)), timeout); } public async waitTabFocused(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitTabFocused "${tabTitle}"`); + const focusedTabLocator: By = By.xpath(`//li[contains(@class, 'p-TabBar-tab') and contains(@class, 'theia-mod-active')]//div[text()='${tabTitle}']`); await this.driverHelper.waitVisibility(focusedTabLocator, timeout); } public async selectTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.selectTab "${tabTitle}"`); + await this.ide.closeAllNotifications(); await this.waitTab(tabTitle, timeout); await this.clickOnTab(tabTitle, timeout); @@ -109,18 +133,24 @@ export class Editor { } async closeTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.closeTab "${tabTitle}"`); + const tabCloseButtonLocator: By = By.xpath(`//div[text()='${tabTitle}']/parent::li//div[contains(@class, 'p-TabBar-tabCloseIcon')]`); await this.driverHelper.waitAndClick(tabCloseButtonLocator, timeout); } async waitTabWithUnsavedStatus(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitTabWithUnsavedStatus "${tabTitle}"`); + const unsavedTabLocator: By = this.getTabWithUnsavedStatus(tabTitle); await this.driverHelper.waitVisibility(unsavedTabLocator, timeout); } async waitTabWithSavedStatus(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitTabWithSavedStatus "${tabTitle}"`); + const unsavedTabLocator: By = this.getTabWithUnsavedStatus(tabTitle); await this.driverHelper.getDriver().wait(async () => { @@ -140,6 +170,8 @@ export class Editor { } async waitEditorOpened(editorTabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitEditorOpened "${editorTabTitle}"`); + const firstEditorLineLocator: By = By.xpath(this.getEditorLineXpathLocator(1)); await this.driverHelper.waitPresence(this.getEditorBodyLocator(editorTabTitle), timeout); @@ -147,11 +179,15 @@ export class Editor { } async waitEditorAvailable(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitEditorAvailable "${tabTitle}"`); + await this.waitTab(tabTitle, timeout); await this.waitEditorOpened(tabTitle, timeout); } async getLineText(tabTitle: string, lineNumber: number): Promise { + Logger.debug(`Editor.getLineText "${tabTitle}"`); + const lineIndex: number = lineNumber - 1; const editorText: string = await this.getEditorVisibleText(tabTitle); const editorLines: string[] = editorText.split('\n'); @@ -161,6 +197,8 @@ export class Editor { } async getEditorVisibleText(tabTitle: string): Promise { + Logger.debug(`Editor.getEditorVisibleText "${tabTitle}"`); + const editorBodyLocator: By = By.xpath(`//div[contains(@data-uri, \'${tabTitle}')]//div[@class=\'view-lines\']`); // const editorBodyLocator: By = By.xpath('//div[@class=\'view-lines\']'); const editorText: string = await this.driverHelper.waitAndGetText(editorBodyLocator); @@ -170,6 +208,9 @@ export class Editor { async waitText(tabTitle: string, expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) { + + Logger.debug(`Editor.waitText "${tabTitle}"`); + await this.driverHelper.getDriver().wait(async () => { const editorText: string = await this.getEditorVisibleText(tabTitle); const isEditorContainText: boolean = editorText.includes(expectedText); @@ -187,6 +228,8 @@ export class Editor { timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) { + Logger.debug(`Editor.followAndWaitForText title: "${editorTabTitle}" text: "${expectedText}"`); + await this.selectTab(editorTabTitle, timeout); await this.driverHelper.getDriver().wait(async () => { await this.performKeyCombination(editorTabTitle, Key.chord(Key.CONTROL, Key.END)); @@ -203,6 +246,8 @@ export class Editor { } async moveCursorToLineAndChar(editorTabTitle: string, line: number, char: number) { + Logger.debug(`Editor.moveCursorToLineAndChar title: "${editorTabTitle}" line: "${line}" char: "${char}"`); + // set cursor to the 1:1 position await this.performKeyCombination(editorTabTitle, Key.chord(Key.CONTROL, Key.HOME)); @@ -218,59 +263,71 @@ export class Editor { } async performKeyCombination(editorTabTitle: string, text: string) { - const interactionContainerLocator: By = this.getEditorActionArreaLocator(editorTabTitle); + Logger.debug(`Editor.performKeyCombination title: "${editorTabTitle}" text: "${text}"`); + const interactionContainerLocator: By = this.getEditorActionArreaLocator(editorTabTitle); await this.driverHelper.type(interactionContainerLocator, text); } async type(editorTabTitle: string, text: string, line: number) { + Logger.debug(`Editor.type title: "${editorTabTitle}" text: "${text}"`); + await this.selectTab(editorTabTitle); await this.moveCursorToLineAndChar(editorTabTitle, line, 1); await this.performKeyCombination(editorTabTitle, text); } async waitErrorInLine(lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const errorInLineLocator: By = await this.getErrorInLineLocator(lineNumber); + Logger.debug(`Editor.waitErrorInLine line: "${lineNumber}"`); + const errorInLineLocator: By = await this.getErrorInLineLocator(lineNumber); await this.driverHelper.waitVisibility(errorInLineLocator, timeout); } async waitErrorInLineDisappearance(lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const errorInLineLocator: By = await this.getErrorInLineLocator(lineNumber); + Logger.debug(`Editor.waitErrorInLineDisappearance line: "${lineNumber}"`); + const errorInLineLocator: By = await this.getErrorInLineLocator(lineNumber); await this.driverHelper.waitDisappearanceWithTimeout(errorInLineLocator, timeout); } async waitStoppedDebugBreakpoint(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Editor.waitStoppedDebugBreakpoint title: "${tabTitle}" line: "${lineNumber}"`); + const stoppedDebugBreakpointLocator: By = By.xpath(await this.getStoppedDebugBreakpointXpathLocator(tabTitle, lineNumber)); await this.driverHelper.waitVisibility(stoppedDebugBreakpointLocator, timeout); } async waitBreakpoint(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const debugBreakpointLocator: By = await this.getDebugBreakpointLocator(tabTitle, lineNumber); + Logger.debug(`Editor.waitBreakpoint title: "${tabTitle}" line: "${lineNumber}"`); + const debugBreakpointLocator: By = await this.getDebugBreakpointLocator(tabTitle, lineNumber); await this.driverHelper.waitVisibility(debugBreakpointLocator, timeout); } async waitBreakpointAbsence(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const debugBreakpointLocator: By = await this.getDebugBreakpointLocator(tabTitle, lineNumber); + Logger.debug(`Editor.waitBreakpointAbsence title: "${tabTitle}" line: "${lineNumber}"`); + const debugBreakpointLocator: By = await this.getDebugBreakpointLocator(tabTitle, lineNumber); await this.driverHelper.waitDisappearanceWithTimeout(debugBreakpointLocator, timeout); } async waitBreakpointHint(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const debugBreakpointHintLocator: By = await this.getDebugBreakpointHintLocator(tabTitle, lineNumber); + Logger.debug(`Editor.waitBreakpointHint title: "${tabTitle}" line: "${lineNumber}"`); + const debugBreakpointHintLocator: By = await this.getDebugBreakpointHintLocator(tabTitle, lineNumber); await this.driverHelper.waitVisibility(debugBreakpointHintLocator, timeout); } async waitBreakpointHintDisappearance(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { - const debugBreakpointHintLocator: By = await this.getDebugBreakpointHintLocator(tabTitle, lineNumber); + Logger.debug(`Editor.waitBreakpointHintDisappearance title: "${tabTitle}" line: "${lineNumber}"`); + const debugBreakpointHintLocator: By = await this.getDebugBreakpointHintLocator(tabTitle, lineNumber); await this.driverHelper.waitDisappearanceWithTimeout(debugBreakpointHintLocator, timeout); } async activateBreakpoint(tabTitle: string, lineNumber: number) { + Logger.debug(`Editor.activateBreakpoint title: "${tabTitle}" line: "${lineNumber}"`); const attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS; const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING; @@ -295,6 +352,8 @@ export class Editor { async getLineYCoordinates(lineNumber: number): Promise { + Logger.debug(`Editor.getLineYCoordinates line: "${lineNumber}"`); + const lineNumberLocator: By = By.xpath(`//div[contains(@class, 'line-numbers') and text()='${lineNumber}']` + `//parent::div[contains(@style, 'position')]`); @@ -313,6 +372,8 @@ export class Editor { } async clickOnLineAndChar(line: number, char: number) { + Logger.debug(`Editor.clickOnLineAndChar line: "${line}" char: "${char}"`); + const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y; const xPosition: number = char + Editor.ADDITIONAL_SHIFTING_TO_X; @@ -323,6 +384,8 @@ export class Editor { } async goToDefinitionWithMouseClicking(line: number, char: number) { + Logger.debug(`Editor.goToDefinitionWithMouseClicking line: "${line}" char: "${char}"`); + const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y; new ActionSequence(this.driverHelper.getDriver()). @@ -334,6 +397,8 @@ export class Editor { } async mouseRightButtonClick(line: number, char: number) { + Logger.debug(`Editor.mouseRightButtonClick line: "${line}" char: "${char}"`); + const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y; new ActionSequence(this.driverHelper.getDriver()). diff --git a/e2e/pageobjects/ide/GitHubPlugin.ts b/e2e/pageobjects/ide/GitHubPlugin.ts index c53aa2df56e..312941f32a6 100644 --- a/e2e/pageobjects/ide/GitHubPlugin.ts +++ b/e2e/pageobjects/ide/GitHubPlugin.ts @@ -4,6 +4,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { TestConstants } from '../../TestConstants'; import { By, WebElement } from 'selenium-webdriver'; import { Ide, RightToolbarButton } from './Ide'; +import { Logger } from '../../utils/Logger'; /********************************************************************* * Copyright (c) 2019 Red Hat, Inc. @@ -21,6 +22,8 @@ export class GitHubPlugin { @inject(CLASSES.Ide) private readonly ide: Ide) { } async openGitHubPluginContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('GitHubPlugin.openGitHubPluginContainer'); + const selectedGitButtonLocator: By = By.xpath(Ide.SELECTED_GIT_BUTTON_XPATH); await this.ide.waitRightToolbarButton(RightToolbarButton.Git, timeout); @@ -34,12 +37,16 @@ export class GitHubPlugin { } async waitGitHubContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('GitHubPlugin.waitGitHubContainer'); + const githubContainerLocator: By = By.css('#theia-gitContainer .theia-git-main-container'); await this.driverHelper.waitVisibility(githubContainerLocator, timeout); } async getChangesList(): Promise { + Logger.debug('GitHubPlugin.getChangesList'); + const gitHubChangesLocator: By = By.xpath('//div[@id=\'theia-gitContainer\']//div[@id=\'unstagedChanges\']//div[contains(@class, \'gitItem\')]'); const changesElements: WebElement[] = await this.driverHelper.waitAllPresence(gitHubChangesLocator); const changesCount: number = changesElements.length; @@ -56,6 +63,8 @@ export class GitHubPlugin { } async waitChangesPresence(changesText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`GitHubPlugin.waitChangesPresence "${changesText}"`); + await this.driverHelper .getDriver() .wait(async () => { @@ -69,7 +78,7 @@ export class GitHubPlugin { }, timeout); } - getGitHubChangesItemXpathLocator(index: number): string { + private getGitHubChangesItemXpathLocator(index: number): string { return `(//div[@id='theia-gitContainer']//div[@id='unstagedChanges']//div[contains(@class, 'gitItem')])[${index + 1}]`; } diff --git a/e2e/pageobjects/ide/OpenWorkspaceWidget.ts b/e2e/pageobjects/ide/OpenWorkspaceWidget.ts index 728b6273c73..3bbfc0e0be7 100644 --- a/e2e/pageobjects/ide/OpenWorkspaceWidget.ts +++ b/e2e/pageobjects/ide/OpenWorkspaceWidget.ts @@ -12,6 +12,7 @@ import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { By } from 'selenium-webdriver'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @injectable() export class OpenWorkspaceWidget { @@ -23,28 +24,40 @@ export class OpenWorkspaceWidget { } async waitOpenWorkspaceWidget(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('OpenWorkspaceWidget.waitOpenWorkspaceWidget'); + await this.driverHelper.waitVisibility(By.xpath(OpenWorkspaceWidget.OPEN_WORKSPACE_MAIN_VIEW_XPATH), timeout); } async waitWidgetIsClosed(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('OpenWorkspaceWidget.waitWidgetIsClosed'); + await this.driverHelper.waitDisappearance(By.xpath(OpenWorkspaceWidget.OPEN_WORKSPACE_MAIN_VIEW_XPATH), timeout); } async selectItemInTree(pathToItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`OpenWorkspaceWidget.selectItemInTree "${pathToItem}"`); + await this.driverHelper.waitAndClick(By.id(pathToItem), timeout); } async clickOnOpenButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('OpenWorkspaceWidget.clickOnOpenButton'); + await this.driverHelper.waitAndClick(By.css(OpenWorkspaceWidget.OPEN_WORKSPACE_OPEN_BTN_CSS), timeout); } async selectItemInTreeAndOpenWorkspace(item: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`OpenWorkspaceWidget.selectItemInTreeAndOpenWorkspace "${item}"`); + await this.selectItemInTree(item, timeout); await this.clickOnOpenButton(); await this.waitWidgetIsClosed(); } async expandTreeToPath(path: string) { + Logger.debug(`OpenWorkspaceWidget.expandTreeToPath "${path}"`); + const pathNodes: string[] = path.split('/'); for (let currentPath of pathNodes) { await this.driverHelper.waitAndClick(By.id(`/${currentPath}`)); @@ -52,9 +65,10 @@ export class OpenWorkspaceWidget { } async selectRootWorkspaceItemInDropDawn(rootProject: string) { + Logger.debug(`OpenWorkspaceWidget.selectRootWorkspaceItemInDropDawn "${rootProject}"`); + await this.driverHelper.waitAndClick(By.css(OpenWorkspaceWidget.THEIA_LOCATION_LIST_CSS)); await this.driverHelper.waitAndClick(By.css(`option[value=\'file:///${rootProject}']`)); } - } diff --git a/e2e/pageobjects/ide/PreviewWidget.ts b/e2e/pageobjects/ide/PreviewWidget.ts index 59d0b310e6c..cc4230e155a 100644 --- a/e2e/pageobjects/ide/PreviewWidget.ts +++ b/e2e/pageobjects/ide/PreviewWidget.ts @@ -13,6 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { By } from 'selenium-webdriver'; import { TestConstants } from '../../TestConstants'; import { Ide } from './Ide'; +import { Logger } from '../../utils/Logger'; @injectable() export class PreviewWidget { @@ -20,22 +21,31 @@ export class PreviewWidget { @inject(CLASSES.Ide) private readonly ide: Ide) { } async waitAndSwitchToWidgetFrame() { + Logger.debug('PreviewWidget.waitAndSwitchToWidgetFrame'); + const iframeLocator: By = By.css('div.theia-mini-browser iframe'); await this.driverHelper.waitAndSwitchToFrame(iframeLocator); } async waitPreviewWidget(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('PreviewWidget.waitPreviewWidget'); + await this.driverHelper.waitVisibility(By.css('div.theia-mini-browser'), timeout); } async waitPreviewWidgetAbsence() { + Logger.debug('PreviewWidget.waitPreviewWidgetAbsence'); + await this.driverHelper.waitDisappearance(By.css('div.theia-mini-browser')); } async waitContentAvailable(contentLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING * 5) { + + Logger.debug(`PreviewWidget.waitContentAvailable ${contentLocator}`); + await this.waitAndSwitchToWidgetFrame(); await this.driverHelper.getDriver().wait(async () => { const isApplicationTitleVisible: boolean = await this.driverHelper.isVisible(contentLocator); @@ -55,9 +65,12 @@ export class PreviewWidget { async waitContentAvailableInAssociatedWorkspace(contentLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING * 5) { + + Logger.debug(`PreviewWidget.waitContentAvailableInAssociatedWorkspace ${contentLocator}`); + await this.waitAndSwitchToWidgetFrame(); await this.driverHelper.getDriver().wait(async () => { - const isApplicationTitleVisible: boolean = await this.driverHelper.isVisible(contentLocator); + const isApplicationTitleVisible: boolean = await this.driverHelper.isVisible(contentLocator); if (isApplicationTitleVisible) { await this.driverHelper.getDriver().switchTo().defaultContent(); return true; @@ -67,23 +80,31 @@ export class PreviewWidget { await this.refreshPage(); await this.waitAndSwitchToWidgetFrame(); await this.driverHelper.wait(polling); - }, timeout); + }, timeout); } async waitVisibility(element: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`PreviewWidget.waitVisibility ${element}`); + await this.driverHelper.waitVisibility(element, timeout); } async waitAndClick(element: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`PreviewWidget.waitAndClick ${element}`); + await this.driverHelper.waitAndClick(element, timeout); } async refreshPage() { + Logger.debug('PreviewWidget.refreshPage'); + const refreshButtonLocator: By = By.css('.theia-mini-browser .theia-mini-browser-refresh'); await this.driverHelper.waitAndClick(refreshButtonLocator); } async switchBackToIdeFrame() { + Logger.debug('PreviewWidget.switchBackToIdeFrame'); + await this.driverHelper.getDriver().switchTo().defaultContent(); await this.ide.waitAndSwitchToIdeFrame(); } diff --git a/e2e/pageobjects/ide/QuickOpenContainer.ts b/e2e/pageobjects/ide/QuickOpenContainer.ts index 3fb503e30c0..d865f180dfe 100644 --- a/e2e/pageobjects/ide/QuickOpenContainer.ts +++ b/e2e/pageobjects/ide/QuickOpenContainer.ts @@ -3,6 +3,7 @@ import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { TestConstants } from '../../TestConstants'; import { By } from 'selenium-webdriver'; +import { Logger } from '../../utils/Logger'; /********************************************************************* * Copyright (c) 2019 Red Hat, Inc. @@ -19,16 +20,22 @@ export class QuickOpenContainer { constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } public async waitContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('QuickOpenContainer.waitContainer'); + const monacoQuickOpenContainerLocator: By = By.xpath('//div[@class=\'monaco-quick-open-widget\']'); await this.driverHelper.waitVisibility(monacoQuickOpenContainerLocator, timeout); } public async waitContainerDisappearance() { + Logger.debug('QuickOpenContainer.waitContainerDisappearance'); + const monacoQuickOpenContainerLocator: By = By.xpath('//div[@class=\'monaco-quick-open-widget\' and @aria-hidden=\'true\']'); await this.driverHelper.waitDisappearance(monacoQuickOpenContainerLocator); } public async clickOnContainerItem(itemText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`QuickOpenContainer.clickOnContainerItem "${itemText}"`); + const quickContainerItemLocator: By = By.xpath(`//div[@class='quick-open-entry']//span[text()='${itemText}']`); await this.waitContainer(timeout); @@ -37,6 +44,8 @@ export class QuickOpenContainer { } public async type(text: string) { + Logger.debug(`QuickOpenContainer.type "${text}"`); + await this.driverHelper.enterValue(By.css('.quick-open-input input'), text); } diff --git a/e2e/pageobjects/ide/RightToolbar.ts b/e2e/pageobjects/ide/RightToolbar.ts index 0108f1f6478..914cdabfc49 100644 --- a/e2e/pageobjects/ide/RightToolbar.ts +++ b/e2e/pageobjects/ide/RightToolbar.ts @@ -12,16 +12,21 @@ import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { TestConstants } from '../../TestConstants'; import { By } from 'selenium-webdriver'; +import { Logger } from '../../utils/Logger'; @injectable() export class RightToolbar { constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async waitToolbar(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('RightToolbar.waitToolbar'); + await this.driverHelper.waitVisibility(By.css('div.theia-app-right'), timeout); } async clickOnToolIcon(iconTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`RightToolbar.clickOnToolIcon "${iconTitle}"`); + const toolIconLocator: By = By.css(`div.theia-app-right .p-TabBar-content li[title='${iconTitle}']`); await this.driverHelper.waitAndClick(toolIconLocator, timeout); diff --git a/e2e/pageobjects/ide/Terminal.ts b/e2e/pageobjects/ide/Terminal.ts index dcdf996de6a..a6cf815037c 100644 --- a/e2e/pageobjects/ide/Terminal.ts +++ b/e2e/pageobjects/ide/Terminal.ts @@ -12,41 +12,54 @@ import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { By, Key, WebElement, error } from 'selenium-webdriver'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @injectable() export class Terminal { constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async waitTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.waitTab "${tabTitle}"`); + const terminalTabLocator: By = By.css(this.getTerminalTabCssLocator(tabTitle)); await this.driverHelper.waitVisibility(terminalTabLocator, timeout); } async waitTabAbsence(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.waitTabAbsence "${tabTitle}"`); + const terminalTabLocator: By = By.css(this.getTerminalTabCssLocator(tabTitle)); await this.driverHelper.waitDisappearanceWithTimeout(terminalTabLocator, timeout); } async clickOnTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.clickOnTab "${tabTitle}"`); + const terminalTabLocator: By = By.css(this.getTerminalTabCssLocator(tabTitle)); await this, this.driverHelper.waitAndClick(terminalTabLocator, timeout); } async waitTabFocused(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.waitTabFocused "${tabTitle}"`); + const focusedTerminalTabLocator: By = this.getFocusedTerminalTabLocator(tabTitle); await this.driverHelper.waitVisibility(focusedTerminalTabLocator, timeout); } async selectTerminalTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.selectTerminalTab "${tabTitle}"`); + await this.clickOnTab(tabTitle, timeout); await this.waitTabFocused(tabTitle, timeout); } async clickOnTabCloseIcon(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.clickOnTabCloseIcon "${tabTitle}"`); + const terminalTabCloseIconLocator: By = By.css(`${this.getTerminalTabCssLocator(tabTitle)} div.p-TabBar-tabCloseIcon`); @@ -54,11 +67,15 @@ export class Terminal { } async closeTerminalTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.closeTerminalTab "${tabTitle}"`); + await this.clickOnTabCloseIcon(tabTitle, timeout); await this.waitTabAbsence(tabTitle, timeout); } async type(terminalTabTitle: string, text: string) { + Logger.debug(`Terminal.type "${terminalTabTitle}"`); + const terminalIndex: number = await this.getTerminalIndex(terminalTabTitle); const terminalInteractionContainer: By = this.getTerminalEditorInteractionEditorLocator(terminalIndex); @@ -66,6 +83,8 @@ export class Terminal { } async rejectTerminalProcess(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`Terminal.rejectTerminalProcess "${tabTitle}"`); + await this.selectTerminalTab(tabTitle, timeout); await this.type(tabTitle, Key.chord(Key.CONTROL, 'c')); } diff --git a/e2e/pageobjects/ide/TopMenu.ts b/e2e/pageobjects/ide/TopMenu.ts index 5cdb25a46e6..a6728128417 100644 --- a/e2e/pageobjects/ide/TopMenu.ts +++ b/e2e/pageobjects/ide/TopMenu.ts @@ -4,6 +4,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { TestConstants } from '../../TestConstants'; import { By } from 'selenium-webdriver'; import { Ide } from './Ide'; +import { Logger } from '../../utils/Logger'; /********************************************************************* * Copyright (c) 2019 Red Hat, Inc. @@ -23,6 +24,8 @@ export class TopMenu { @inject(CLASSES.Ide) private readonly ide: Ide) { } public async waitTopMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug('TopMenu.waitTopMenu'); + for (const buttonText of TopMenu.TOP_MENU_BUTTONS) { const buttonLocator: By = this.getTopMenuButtonLocator(buttonText); await this.driverHelper.waitVisibility(buttonLocator, timeout); @@ -30,11 +33,15 @@ export class TopMenu { } public async selectOption(topMenuButtonText: string, submenuItemtext: string) { + Logger.debug(`TopMenu.selectOption "${topMenuButtonText}"`); + await this.clickOnTopMenuButton(topMenuButtonText); await this.clickOnSubmenuItem(submenuItemtext); } public async clickOnTopMenuButton(buttonText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`TopMenu.clickOnTopMenuButton "${buttonText}"`); + const buttonLocator: By = this.getTopMenuButtonLocator(buttonText); await this.ide.closeAllNotifications(); @@ -42,6 +49,8 @@ export class TopMenu { } public async clickOnSubmenuItem(itemText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { + Logger.debug(`TopMenu.clickOnSubmenuItem "${itemText}"`); + const submenuItemLocator: By = this.getSubmenuItemLocator(itemText); await this.driverHelper.waitAndClick(submenuItemLocator, timeout); } diff --git a/e2e/pageobjects/ide/WarningDialog.ts b/e2e/pageobjects/ide/WarningDialog.ts index c76b4976a26..fb2af8de5bf 100644 --- a/e2e/pageobjects/ide/WarningDialog.ts +++ b/e2e/pageobjects/ide/WarningDialog.ts @@ -11,6 +11,7 @@ import { injectable, inject } from 'inversify'; import { CLASSES } from '../../inversify.types'; import { DriverHelper } from '../../utils/DriverHelper'; import { By } from 'selenium-webdriver'; +import { Logger } from '../../utils/Logger'; @injectable() export class WarningDialog { @@ -20,11 +21,14 @@ export class WarningDialog { constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async dialogDisplayes(): Promise { + Logger.debug('WarningDialog.dialogDisplayes'); return await this.driverHelper.isVisible(By.xpath(WarningDialog.DIALOG_BODY_XPATH_LOCATOR)); } async waitAndCloseIfAppear() { + Logger.debug('WarningDialog.waitAndCloseIfAppear'); + const dialogDisplayes: boolean = await this.driverHelper.waitVisibilityBoolean(By.xpath(WarningDialog.DIALOG_BODY_XPATH_LOCATOR)); if (dialogDisplayes) { @@ -35,10 +39,14 @@ export class WarningDialog { } async closeDialog() { + Logger.debug('WarningDialog.closeDialog'); + await this.driverHelper.waitAndClick(By.xpath(WarningDialog.CLOSE_BUTTON_XPATH_LOCATOR)); } async waitDialogDissappearance() { + Logger.debug('WarningDialog.waitDialogDissappearance'); + await this.driverHelper.waitDisappearanceWithTimeout(By.xpath(WarningDialog.CLOSE_BUTTON_XPATH_LOCATOR)); } diff --git a/e2e/pageobjects/login/MultiUserLoginPage.ts b/e2e/pageobjects/login/MultiUserLoginPage.ts index fbfe1ad3b0e..688a556810f 100644 --- a/e2e/pageobjects/login/MultiUserLoginPage.ts +++ b/e2e/pageobjects/login/MultiUserLoginPage.ts @@ -14,6 +14,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { CLASSES } from '../../inversify.types'; import { By } from 'selenium-webdriver'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @injectable() export class MultiUserLoginPage implements ICheLoginPage { @@ -22,6 +23,8 @@ export class MultiUserLoginPage implements ICheLoginPage { @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async login() { + Logger.debug('MultiUserLoginPage.login'); + await this.waitEclipseCheLoginFormPage(); await this.inputUserNameEclipseCheLoginPage(TestConstants.TS_SELENIUM_USERNAME); await this.inputPaswordEclipseCheLoginPage(TestConstants.TS_SELENIUM_PASSWORD); @@ -29,18 +32,26 @@ export class MultiUserLoginPage implements ICheLoginPage { } async waitEclipseCheLoginFormPage() { + Logger.debug('MultiUserLoginPage.waitEclipseCheLoginFormPage'); + await this.driverHelper.waitVisibility(By.id('kc-form-login')); } async inputUserNameEclipseCheLoginPage(userName: string) { + Logger.debug(`MultiUserLoginPage.inputUserNameEclipseCheLoginPage username: "${userName}"`); + await this.driverHelper.enterValue(By.id('username'), userName); } async inputPaswordEclipseCheLoginPage(passw: string) { + Logger.debug(`MultiUserLoginPage.inputPaswordEclipseCheLoginPage password: "${passw}"`); + await this.driverHelper.enterValue(By.id('password'), passw); } async clickEclipseCheLoginButton() { + Logger.debug('MultiUserLoginPage.clickEclipseCheLoginButton'); + await this.driverHelper.waitAndClick(By.id('kc-login')); } diff --git a/e2e/pageobjects/login/OcpLoginByTempAdmin.ts b/e2e/pageobjects/login/OcpLoginByTempAdmin.ts index 8947dd06512..cd7b240598b 100644 --- a/e2e/pageobjects/login/OcpLoginByTempAdmin.ts +++ b/e2e/pageobjects/login/OcpLoginByTempAdmin.ts @@ -13,6 +13,7 @@ import { injectable, inject } from 'inversify'; import { OcpLoginPage } from '../openshift/OcpLoginPage'; import { CLASSES } from '../../inversify.types'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @injectable() export class OcpLoginByTempAdmin implements IOcpLoginPage { @@ -21,6 +22,8 @@ export class OcpLoginByTempAdmin implements IOcpLoginPage { @inject(CLASSES.OcpLoginPage) private readonly ocpLogin: OcpLoginPage) { } async login() { + Logger.debug('OcpLoginByTempAdmin.login'); + if (TestConstants.TS_OCP_LOGIN_PAGE_HTPASW) { await this.ocpLogin.clickOnLoginWitnKubeAdmin(); } diff --git a/e2e/pageobjects/login/SingleUserLoginPage.ts b/e2e/pageobjects/login/SingleUserLoginPage.ts index 42e2986aca6..a3369e13fdd 100644 --- a/e2e/pageobjects/login/SingleUserLoginPage.ts +++ b/e2e/pageobjects/login/SingleUserLoginPage.ts @@ -11,11 +11,14 @@ import 'reflect-metadata'; import { ICheLoginPage } from './ICheLoginPage'; import { injectable } from 'inversify'; import { TestConstants } from '../../TestConstants'; +import { Logger } from '../../utils/Logger'; @injectable() export class SingleUserLoginPage implements ICheLoginPage { async login(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) { + Logger.debug('SingleUserLoginPage.login'); + // do nothing } diff --git a/e2e/pageobjects/openshift/OcpLoginPage.ts b/e2e/pageobjects/openshift/OcpLoginPage.ts index 35d79072d39..130a3d00806 100644 --- a/e2e/pageobjects/openshift/OcpLoginPage.ts +++ b/e2e/pageobjects/openshift/OcpLoginPage.ts @@ -13,6 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { CLASSES } from '../../inversify.types'; import { TestConstants } from '../../TestConstants'; import { By } from 'selenium-webdriver'; +import { Logger } from '../../utils/Logger'; @injectable() export class OcpLoginPage { @@ -20,35 +21,49 @@ export class OcpLoginPage { private static readonly LOGIN_PAGE_OPENSHIFT: string = 'div[class=container]'; constructor( - @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } + @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } + + async openLoginPageOpenShift() { + Logger.debug('OcpLoginPage.openLoginPageOpenShift'); - async openLoginPageOpenShift () { await this.driverHelper.navigateToUrl(TestConstants.TS_SELENIUM_BASE_URL); } - async waitOpenShiftLoginPage () { + async waitOpenShiftLoginPage() { + Logger.debug('OcpLoginPage.waitOpenShiftLoginPage'); + await this.driverHelper.waitVisibility(By.css(OcpLoginPage.LOGIN_PAGE_OPENSHIFT)); } - async clickOnLoginWitnKubeAdmin () { + async clickOnLoginWitnKubeAdmin() { + Logger.debug('OcpLoginPage.clickOnLoginWitnKubeAdmin'); + const loginWithKubeAdminLocator: By = By.css('a[title=\'Log in with kube:admin\']'); await this.driverHelper.waitAndClick(loginWithKubeAdminLocator); } - async enterUserNameOpenShift (userName: string) { + async enterUserNameOpenShift(userName: string) { + Logger.debug(`OcpLoginPage.enterUserNameOpenShift "${userName}"`); + await this.driverHelper.enterValue(By.id('inputUsername'), userName); } - async enterPasswordOpenShift (passw: string) { + async enterPasswordOpenShift(passw: string) { + Logger.debug(`OcpLoginPage.enterPasswordOpenShift "${passw}"`); + await this.driverHelper.enterValue(By.id('inputPassword'), passw); } - async clickOnLoginButton () { + async clickOnLoginButton() { + Logger.debug('OcpLoginPage.clickOnLoginButton'); + const loginButtonlocator: By = By.css('button[type=submit]'); await this.driverHelper.waitAndClick(loginButtonlocator); } - async waitDisappearanceLoginPageOpenShift () { + async waitDisappearanceLoginPageOpenShift() { + Logger.debug('OcpLoginPage.waitDisappearanceLoginPageOpenShift'); + await this.driverHelper.waitDisappearance(By.css(OcpLoginPage.LOGIN_PAGE_OPENSHIFT)); } } diff --git a/e2e/pageobjects/openshift/OcpWebConsolePage.ts b/e2e/pageobjects/openshift/OcpWebConsolePage.ts index 34d5de69903..499f10d9080 100644 --- a/e2e/pageobjects/openshift/OcpWebConsolePage.ts +++ b/e2e/pageobjects/openshift/OcpWebConsolePage.ts @@ -13,6 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { CLASSES } from '../../inversify.types'; import { TestConstants } from '../../TestConstants'; import { By, Key } from 'selenium-webdriver'; +import { Logger } from '../../utils/Logger'; @injectable() export class OcpWebConsolePage { @@ -23,162 +24,229 @@ export class OcpWebConsolePage { constructor( @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } - async waitNavpanelOpenShift () { + async waitNavpanelOpenShift() { + Logger.debug('OcpWebConsolePage.waitNavpanelOpenShift'); + const navPanelOpenShiftLocator: By = By.css('nav[class=pf-c-nav]'); await this.driverHelper.waitVisibility(navPanelOpenShiftLocator); } - async clickOnCatalogListNavPanelOpenShift () { + async clickOnCatalogListNavPanelOpenShift() { + Logger.debug('OcpWebConsolePage.clickOnCatalogListNavPanelOpenShift'); + const catalogListLocator: By = By.xpath('//a[text()=\'Catalog\']'); await this.driverHelper.waitAndClick(catalogListLocator); } - async clickOnOperatorHubItemNavPanel () { + async clickOnOperatorHubItemNavPanel() { + Logger.debug('OcpWebConsolePage.clickOnOperatorHubItemNavPanel'); + const operatorHubItemLocator: By = By.xpath('//a[text()=\'OperatorHub\']'); await this.driverHelper.waitAndClick(operatorHubItemLocator); } - async waitOperatorHubMainPage () { + async waitOperatorHubMainPage() { + Logger.debug('OcpWebConsolePage.waitOperatorHubMainPage'); + const catalogOperatorHubPageLocator: By = By.xpath('//span[@id=\'resource-title\' and text()=\'OperatorHub\']'); await this.driverHelper.waitVisibility(catalogOperatorHubPageLocator); } - async clickOnEclipseCheOperatorIcon () { + async clickOnEclipseCheOperatorIcon() { + Logger.debug('OcpWebConsolePage.clickOnEclipseCheOperatorIcon'); + const catalogEclipseCheOperatorTitleLocator: By = By.css('a[data-test^=eclipse-che-preview-openshift]'); await this.driverHelper.waitAndClick(catalogEclipseCheOperatorTitleLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT); } - async clickOnInstallEclipseCheButton () { + async clickOnInstallEclipseCheButton() { + Logger.debug('OcpWebConsolePage.clickOnInstallEclipseCheButton'); + const installEclipsCheOperatorButtonLocator: By = By.xpath('//button[text()=\'Install\']'); await this.driverHelper.waitAndClick(installEclipsCheOperatorButtonLocator); } - async waitCreateOperatorSubscriptionPage () { + async waitCreateOperatorSubscriptionPage() { + Logger.debug('OcpWebConsolePage.waitCreateOperatorSubscriptionPage'); + const createOperatorSubscriptionPageLocator: By = By.xpath('//h1[text()=\'Create Operator Subscription\']'); await this.driverHelper.waitVisibility(createOperatorSubscriptionPageLocator); } - async selectUpdateChannelOnSubscriptionPage (channelName: string) { + async selectUpdateChannelOnSubscriptionPage(channelName: string) { + Logger.debug(`OcpWebConsolePage.selectUpdateChannelOnSubscriptionPage "${channelName}"`); + const updateChannelOperatorLocator: By = By.css(`input[value=${channelName}]`); await this.driverHelper.waitAndClick(updateChannelOperatorLocator); } - async clickOnDropdownNamespaceListOnSubscriptionPage () { + async clickOnDropdownNamespaceListOnSubscriptionPage() { + Logger.debug('OcpWebConsolePage.clickOnDropdownNamespaceListOnSubscriptionPage'); + const selectNamespaceLocator: By = By.id('dropdown-selectbox'); await this.driverHelper.waitAndClick(selectNamespaceLocator); } - async waitListBoxNamespacesOnSubscriptionPage () { + async waitListBoxNamespacesOnSubscriptionPage() { + Logger.debug('OcpWebConsolePage.waitListBoxNamespacesOnSubscriptionPage'); + const listBoxNamespaceLocator: By = By.css('ul[class^=dropdown-menu]'); await this.driverHelper.waitVisibility(listBoxNamespaceLocator); } - async selectDefinedNamespaceOnSubscriptionPage (projectName: string) { + async selectDefinedNamespaceOnSubscriptionPage(projectName: string) { + Logger.debug('OcpWebConsolePage.selectDefinedNamespaceOnSubscriptionPage'); + const namespaceItemInDropDownLocator: By = By.id(`${projectName}-Project-link`); await this.driverHelper.waitAndClick(namespaceItemInDropDownLocator); } - async clickOnSubscribeButtonOnSubscriptionPage () { + async clickOnSubscribeButtonOnSubscriptionPage() { + Logger.debug('OcpWebConsolePage.clickOnSubscribeButtonOnSubscriptionPage'); + const subscribeOperatorButtonLocator: By = By.xpath('//button[text()=\'Subscribe\']'); await this.driverHelper.waitAndClick(subscribeOperatorButtonLocator); } - async waitSubscriptionOverviewPage () { + async waitSubscriptionOverviewPage() { + Logger.debug('OcpWebConsolePage.waitSubscriptionOverviewPage'); + const subscriptionOverviewPageLocator: By = By.xpath('//h2[text()=\'Subscription Overview\']'); await this.driverHelper.waitVisibility(subscriptionOverviewPageLocator); } - async waitChannelNameOnSubscriptionOverviewPage (channelName: string) { + async waitChannelNameOnSubscriptionOverviewPage(channelName: string) { + Logger.debug(`OcpWebConsolePage.waitChannelNameOnSubscriptionOverviewPage "${channelName}"`); + const channelNameOnSubscriptionOverviewLocator: By = By.xpath(`//button[@type='button' and text()='${channelName}']`); await this.driverHelper.waitVisibility(channelNameOnSubscriptionOverviewLocator); } - async waitUpgradeStatusOnSubscriptionOverviewPage () { + async waitUpgradeStatusOnSubscriptionOverviewPage() { + Logger.debug('OcpWebConsolePage.waitUpgradeStatusOnSubscriptionOverviewPage'); + const upgradeStatuslocator: By = By.xpath('//span[text()=\' Up to date\']'); await this.driverHelper.waitVisibility(upgradeStatuslocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT); } - async waitCatalogSourceNameOnSubscriptionOverviewPage (projectName: string) { + async waitCatalogSourceNameOnSubscriptionOverviewPage(projectName: string) { + Logger.debug(`OcpWebConsolePage.waitCatalogSourceNameOnSubscriptionOverviewPage "${projectName}"`); + const catalogSourceNameLolcator: By = By.css(`a[title=\'installed-custom-${projectName}\']`); await this.driverHelper.waitVisibility(catalogSourceNameLolcator); } - async selectInstalledOperatorsOnNavPanel () { + async selectInstalledOperatorsOnNavPanel() { + Logger.debug('OcpWebConsolePage.selectInstalledOperatorsOnNavPanel'); + const installedOperatorsItemNavPanelLocator: By = By.xpath('//a[text()=\'Installed Operators\']'); await this.driverHelper.waitAndClick(installedOperatorsItemNavPanelLocator); } - async waitEclipseCheOperatorLogoName () { + async waitEclipseCheOperatorLogoName() { + Logger.debug('OcpWebConsolePage.waitEclipseCheOperatorLogoName'); + await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.CHE_OPERATOR_LOGO_NAME)); } - async waitStatusInstalledEclipseCheOperator () { + async waitStatusInstalledEclipseCheOperator() { + Logger.debug('OcpWebConsolePage.waitStatusInstalledEclipseCheOperator'); + const statusInstalledCheOperatorLocator: By = By.xpath('//span[text()=\'InstallSucceeded\']'); await this.driverHelper.waitVisibility(statusInstalledCheOperatorLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT); } - async clickOnEclipseCheOperatorLogoName () { + async clickOnEclipseCheOperatorLogoName() { + Logger.debug('OcpWebConsolePage.clickOnEclipseCheOperatorLogoName'); + await this.driverHelper.waitAndClick(By.xpath(OcpWebConsolePage.CHE_OPERATOR_LOGO_NAME)); } - async waitOverviewCsvEclipseCheOperator () { + async waitOverviewCsvEclipseCheOperator() { + Logger.debug('OcpWebConsolePage.waitOverviewCsvEclipseCheOperator'); + await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.CHE_OPERATOR_LOGO_NAME)); } - async clickCreateNewCheClusterLink () { + async clickCreateNewCheClusterLink() { + Logger.debug('OcpWebConsolePage.clickCreateNewCheClusterLink'); + const createNewCheLusterLinkLocator: By = By.xpath('//a[text()=\' Create New\']'); await this.driverHelper.waitAndClick(createNewCheLusterLinkLocator); } - async waitCreateCheClusterYaml () { + async waitCreateCheClusterYaml() { + Logger.debug('OcpWebConsolePage.waitCreateCheClusterYaml'); + const createCheClusterYamlLocator: By = By.xpath('//h1[text()=\'Create Che Cluster\']'); await this.driverHelper.waitVisibility(createCheClusterYamlLocator); } - async selectOpenShiftOAuthFieldInYaml (line: string) { + async selectOpenShiftOAuthFieldInYaml(line: string) { + Logger.debug(`OcpWebConsolePage.selectOpenShiftOAuthFieldInYaml line: "${line}"`); + const openShiftOAuthFieldLocator: By = By.xpath(`//div[@class=\'ace_gutter-cell \' and text()=\'${line}\']`); await this.driverHelper.waitAndClick(openShiftOAuthFieldLocator); } - async changeValueOpenShiftOAuthField () { + async changeValueOpenShiftOAuthField() { + Logger.debug('OcpWebConsolePage.changeValueOpenShiftOAuthField'); + await this.driverHelper.getAction().sendKeys(Key.DELETE.toString()).sendKeys(Key.ENTER.toString()).sendKeys(Key.UP.toString()).perform(); await this.driverHelper.getAction().sendKeys(' openShiftoAuth: false'); } - async clickOnCreateCheClusterButton () { + async clickOnCreateCheClusterButton() { + Logger.debug('OcpWebConsolePage.clickOnCreateCheClusterButton'); + const createCheClusterButtonLocator: By = By.id('save-changes'); await this.driverHelper.waitAndClick(createCheClusterButtonLocator); } - async waitResourcesCheClusterTitle () { + async waitResourcesCheClusterTitle() { + Logger.debug('OcpWebConsolePage.waitResourcesCheClusterTitle'); + const resourcesCheClusterTitleLocator: By = By.id('resource-title'); await this.driverHelper.waitVisibility(resourcesCheClusterTitleLocator); } - async waitResourcesCheClusterTimestamp () { + async waitResourcesCheClusterTimestamp() { + Logger.debug('OcpWebConsolePage.waitResourcesCheClusterTimestamp'); + const resourcesCheClusterTimestampLocator: By = By.xpath('//div[contains(@class, \'timestamp\')]/div[text()=\'a minute ago\']'); await this.driverHelper.waitVisibility(resourcesCheClusterTimestampLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT); } - async clickOnCheClusterResourcesName () { + + async clickOnCheClusterResourcesName() { + Logger.debug('OcpWebConsolePage.clickOnCheClusterResourcesName'); + const cheClusterResourcesNameLocator: By = By.css('a[class=co-resource-item__resource-name]'); await this.driverHelper.waitAndClick(cheClusterResourcesNameLocator); } - async clickCheClusterOverviewExpandButton () { + async clickCheClusterOverviewExpandButton() { + Logger.debug('OcpWebConsolePage.clickCheClusterOverviewExpandButton'); + const cheClusterOverviewExpandButton: By = By.css('label[class=\'btn compaction-btn btn-default\']'); await this.driverHelper.waitAndClick(cheClusterOverviewExpandButton); } - async waitKeycloakAdminConsoleUrl (projectName: string) { + async waitKeycloakAdminConsoleUrl(projectName: string) { + Logger.debug('OcpWebConsolePage.waitKeycloakAdminConsoleUrl'); + const keyCloakAdminWebConsoleUrl: By = By.partialLinkText(`keycloak-${projectName}`); await this.driverHelper.waitVisibility(keyCloakAdminWebConsoleUrl, TestConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT); } - async waitEclipseCheUrl (projectName: string) { + async waitEclipseCheUrl(projectName: string) { + Logger.debug('OcpWebConsolePage.waitEclipseCheUrl'); + const eclipseCheUrlLocator: By = By.partialLinkText(`${OcpWebConsolePage.ECLIPSE_CHE_PREFIX_URL}${projectName}`); await this.driverHelper.waitVisibility(eclipseCheUrlLocator, TestConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT); } - async clickOnEclipseCHeUrl (projectName: string) { + async clickOnEclipseCHeUrl(projectName: string) { + Logger.debug('OcpWebConsolePage.clickOnEclipseCHeUrl'); + const eclipseCheUrlLocator: By = By.partialLinkText(`${OcpWebConsolePage.ECLIPSE_CHE_PREFIX_URL}${projectName}`); await this.driverHelper.waitAndClick(eclipseCheUrlLocator); } diff --git a/e2e/tests/e2e_happy_path/HappyPath.spec.ts b/e2e/tests/e2e_happy_path/HappyPath.spec.ts index d3b02650039..598749a021f 100644 --- a/e2e/tests/e2e_happy_path/HappyPath.spec.ts +++ b/e2e/tests/e2e_happy_path/HappyPath.spec.ts @@ -116,7 +116,7 @@ suite('Language server validation', async () => { test('Suggestion', async () => { await editor.moveCursorToLineAndChar(javaFileName, 32, 27); await editor.pressControlSpaceCombination(javaFileName); - await editor.waitSuggestion(javaFileName, 'run(Class primarySource, String... args) : ConfigurableApplicationContext'); + await editor.waitSuggestion(javaFileName, 'run(Class primarySource, String... args) : ConfigurableApplicationContext', 120000); });