Remove default timeout (#17506)

* Removing default timeouts

* Stabilising suggestion invoking test

* Change reporter printing info, lint

* Unify the way of waiting for the workspace to be ready

* Add TimeoutConstants.ts to Readme.md

* Applying some refactoring changes gotten in review.

* Removing reundant timeouts set when calling methods

* Reverting of removal 'waitTab' method from Terminal class
7.20.x
Katerina Foniok 2020-09-15 14:54:48 +02:00 committed by GitHub
parent a505c8bff7
commit 46db144260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 693 additions and 621 deletions

View File

@ -21,6 +21,7 @@
## Custom launch
- Use environment variables which described in the **```'TestConstants.ts'```** file
- Use environment variables for setting timeouts if needed. You can see the list in **```'TimeoutConstants.ts'```**. You can see the list of those variables and their value if you set the ```'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'```
## Docker launch

View File

@ -48,31 +48,6 @@ export const TestConstants = {
*/
TS_SELENIUM_RESOLUTION_HEIGHT: Number(process.env.TS_SELENIUM_RESOLUTION_HEIGHT) || 1080,
/**
* Timeout in milliseconds waiting for install Eclipse Che by OperatorHub UI, "600 000" by default.
*/
TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT: Number(process.env.TS_SELENIUM_START_WORKSPACE_TIMEOUT) || 600000,
/**
* Timeout in milliseconds waiting for workspace start, "240 000" by default.
*/
TS_SELENIUM_START_WORKSPACE_TIMEOUT: Number(process.env.TS_SELENIUM_START_WORKSPACE_TIMEOUT) || 360000,
/**
* Timeout in milliseconds waiting for page load, "120 000" by default.
*/
TS_SELENIUM_LOAD_PAGE_TIMEOUT: Number(process.env.TS_SELENIUM_LOAD_PAGE_TIMEOUT) || 180000,
/**
* Timeout in milliseconds waiting for language server initialization, "180 000" by default.
*/
TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT: Number(process.env.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) || 180000,
/**
* Default timeout for most of the waitings, "20 000" by default.
*/
TS_SELENIUM_DEFAULT_TIMEOUT: Number(process.env.TS_SELENIUM_DEFAULT_TIMEOUT) || 60000,
/**
* Default ammount of tries, "5" by default.
*/
@ -257,6 +232,11 @@ export const TestConstants = {
/**
* The name of project in the Openshidt plugin tree
*/
TS_TEST_OPENSHIFT_PLUGIN_PROJECT: process.env.TS_TEST_OPENSHIFT_PLUGIN_PROJECT || ''
TS_TEST_OPENSHIFT_PLUGIN_PROJECT: process.env.TS_TEST_OPENSHIFT_PLUGIN_PROJECT || '',
/**
* Print all timeout variables when tests launch, defaulte to false
*/
TS_SELENIUM_PRINT_TIMEOUT_VARIABLES: process.env.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES || false
};

View File

@ -0,0 +1,219 @@
/*********************************************************************
* Copyright (c) 2020 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
export const TimeoutConstants = {
// -------------------------------------------- INSTALLING AND STARTUP --------------------------------------------
/**
* Timeout in milliseconds waiting for install Eclipse Che by OperatorHub UI, "600 000" by default.
*/
TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT: Number(process.env.TS_SELENIUM_START_WORKSPACE_TIMEOUT) || 600_000,
/**
* Wait between workspace started and IDE ready to be used, "20 000" by default.
*/
TS_IDE_LOAD_TIMEOUT: Number(process.env.TS_IDE_LOAD_TIMEOUT) || 20_000,
/**
* Timeout in milliseconds waiting for workspace start, "360 000" by default.
*/
TS_SELENIUM_START_WORKSPACE_TIMEOUT: Number(process.env.TS_SELENIUM_START_WORKSPACE_TIMEOUT) || 360_000,
/**
* Timeout in milliseconds waiting for page load, "20 000" by default.
*/
TS_SELENIUM_LOAD_PAGE_TIMEOUT: Number(process.env.TS_SELENIUM_LOAD_PAGE_TIMEOUT) || 20_000,
/**
* Wait for loader absence, "60 000" by default.
*/
TS_WAIT_LOADER_ABSENCE_TIMEOUT: Number(process.env.TS_WAIT_LOADER_ABSENCE_TIMEOUT) || 60_000,
/**
* Wait for loader absence, "60 000" by default.
*/
TS_WAIT_LOADER_PRESENCE_TIMEOUT: Number(process.env.TS_WAIT_LOADER_PRESENCE_TIMEOUT) || 60_000,
/**
* Timeout waiting for URL, "5 000" by default.
*/
TS_WAIT_URL_TIMEOUT: Number(process.env.TS_WAIT_URL_TIMEOUT) || 5_000,
// -------------------------------------------- DASHBOARD --------------------------------------------
/**
* Common timeout for dashboard items, "5 000" by default
*/
TS_COMMON_DASHBOARD_WAIT_TIMEOUT: Number(process.env.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) || 5_000,
/**
* Timeout for clicking on dashboard menu items, "2 000" by default
*/
TS_CLICK_DASHBOARD_ITEM_TIMEOUT: Number(process.env.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) || 2_000,
// -------------------------------------------- LANGUAGE SERVER VALIDATION --------------------------------------------
/**
* Timeout in milliseconds waiting for language server initialization, "180 000" by default.
*/
TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT: Number(process.env.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) || 180_000,
/**
* Timeout for suggestion invoking, "30 000" by default.
*/
TS_SUGGESTION_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 30_000,
/**
* Timeout for error highlighting presence, "10 000" by default
*/
TS_ERROR_HIGHLIGHTING_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 10_000,
// -------------------------------------------- PROJECT TREE --------------------------------------------
/**
* Wait for IDE showing project tree tab, "20 000" by default.
*/
TS_PROJECT_TREE_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 20_000,
/**
* Click on item timeout (project tree), "10 000" by default.
*/
TS_PROJECT_TREE_CLICK_ON_ITEM_TIMEOUT: Number(process.env.TS_PROJECT_TREE_CLICK_ON_ITEM_TIMEOUT) || 10_000,
/**
* Expand item in project tree, "5 000" by default.
*/
TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT: Number(process.env.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT) || 5_000,
// -------------------------------------------- EDITOR --------------------------------------------
/**
* Timeout for inetractions with editor tab - wait, click, select, "5 000" by default.
*/
TS_EDITOR_TAB_INTERACTION_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 5_000,
/**
* Wait for file to be opened in editor, "30 000" by default.
*/
TS_OPEN_EDITOR_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 30_000,
/**
* Wait for suggestion container closure, "3 000" by default.
*/
TS_CLOSE_SUGGESTION_CONTAINER_TIMEOUT: Number(process.env.TS_CLOSE_SUGGESTION_CONTAINER_TIMEOUT) || 3_000,
// -------------------------------------------- IDE --------------------------------------------
/**
* Timeout for context menu manipulation, "10 000" by default
*/
TS_CONTEXT_MENU_TIMEOUT: Number(process.env.TS_CONTEXT_MENU_TIMEOUT) || 10_000,
/**
* Timeout for interactions with Notification center - open, close, "10 000" by default.
*/
TS_NOTIFICATION_CENTER_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 10_000,
/**
* Timeout for debugger to connect, "30 000" by default
*/
TS_DEBUGGER_CONNECTION_TIMEOUT: Number(process.env.TS_DEBUGGER_CONNECTION_TIMEOUT) || 30_000,
/**
* Timeout for context menu manipulation, "10 000" by default
*/
TS_DIALOG_WINDOW_DEFAULT_TIMEOUT: Number(process.env.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT) || 10_000,
/**
* Timeout for breakpoint interactions, "20 000" by default
*/
TS_BREAKPOINT_DEFAULT_TIMEOUT: Number(process.env.TS_BREAKPOINT_DEFAULT_TIMEOUT) || 20_000,
/**
* Timeout for interactions with Git Plugin container, "20 000" by default
*/
TS_GIT_CONAINER_INTERACTION_TIMEOUT: Number(process.env.TS_GIT_CONAINER_INTERACTION_TIMEOUT) || 20_000,
/**
* Timeout for toolbars interaction, "20 000" by default
*/
TS_SELENIUM_TOOLBAR_TIMEOUT: Number(process.env.TS_SELENIUM_TOOLBAR_TIMEOUT) || 20_000,
/**
* Timeout for clicking on visible item, "3 000" by default
*/
TS_SELENIUM_CLICK_ON_VISIBLE_ITEM: Number(process.env.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) || 3_000,
/**
* Timeout for OpenDialogWidget class, "5 000" by default
*/
TS_SELENIUM_DIALOG_WIDGET_TIMEOUT: Number(process.env.TS_SELENIUM_DIALOG_WIDGET_TIMEOUT) || 5_000,
/**
* Default timeout for interaction with terminal, "3 000" by default
*/
TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT: Number(process.env.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) || 5_000,
/**
* Default timeout for preview widget, "10 000" by default
*/
TS_SELENIUM_PREVIEW_WIDGET_DEFAULT_TIMEOUT: Number(process.env.TS_SELENIUM_PREVIEW_WIDGET_DEFAULT_TIMEOUT) || 10_000,
/**
* Timeout for opening quick menu from top panel, "10 000" by default
*/
TS_SELENIUM_TOP_MENU_QUICK_CONTAINER_TIMEOUT: Number(process.env.TS_SELENIUM_TOP_MENU_QUICK_CONTAINER_TIMEOUT) || 10_000,
/**
* Timeout waiting for url, "10 000" by default
*/
TS_SELENIUM_WAIT_FOR_URL: Number(process.env.TS_SELENIUM_WAIT_FOR_URL) || 10_000,
// ------------------------------------ OCP WEB CONSOLE PAGE ------------------------------------
/**
* Timeout for OcpWebConsolePage.waitOverviewCsvEclipseCheOperator, "20 000" by default
*/
TS_SELENIUM_CSV_OPERATOR_TIMEOUT: Number(process.env.TS_SELENIUM_CSV_OPERATOR_TIMEOUT) || 20_000,
/**
* Timeout for listing the namespaces on subscription in OcpWebConsolePage, "10 000" by default
*/
TS_SELENIUM_LIST_NAMESPACES_ON_SUBSCRIPTION_TIMEOUT: Number(process.env.TS_SELENIUM_LIST_NAMESPACES_ON_SUBSCRIPTION_TIMEOUT) || 10_000,
/**
* Timeout for Che cluster title visibility in OcpWebConsolePage, "10 000" by default.
*/
TS_SELENIUM_RESOURCES_CHE_CLUSTER_TITLE_TIMEOUT: Number(process.env.TS_SELENIUM_RESOURCES_CHE_CLUSTER_TITLE_TIMEOUT) || 10_000,
// ------------------------------------ OPENSHIFT RELATED ------------------------------------
/**
* Timeout for obtaining cluster IP, "10 000" by default.
*/
TS_GET_CLUSTER_IP_TIMEOUT: Number(process.env.TS_GET_CLUSTER_IP_TIMEOUT) || 10_000,
/**
* Timeout for waiting fr openshift connector tree, "10 000" by default.
*/
TS_WAIT_OPENSHIFT_CONNECTOR_TREE_TIMEOUT: Number(process.env.TS_WAIT_OPENSHIFT_CONNECTOR_TREE_TIMEOUT) || 10_000,
/**
* Timeout for creating CheCluster yaml, "10 000" by default.
*/
TS_CREATE_CHECLUSTER_YAML_TIMEOUT: Number(process.env.TS_CREATE_CHECLUSTER_YAML_TIMEOUT) || 10_000,
};

View File

@ -20,6 +20,7 @@ import { ScreenCatcher } from '../utils/ScreenCatcher';
import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
import { PreferencesHandler, AskForConfirmationType } from '../utils/PreferencesHandler';
import { CheApiRequestHandler } from '../utils/requestHandlers/CheApiRequestHandler';
import { TimeoutConstants } from '../TimeoutConstants';
const e2eContainer = inversifyConfig.e2eContainer;
const driver: IDriver = e2eContainer.get(TYPES.Driver);
@ -35,26 +36,16 @@ class CheReporter extends mocha.reporters.Spec {
super(runner, options);
runner.on('start', async (test: mocha.Test) => {
const launchInformation: string =
let launchInformation: string =
`################## Launch Information ##################
TS_SELENIUM_BASE_URL: ${TestConstants.TS_SELENIUM_BASE_URL}
TS_SELENIUM_HEADLESS: ${TestConstants.TS_SELENIUM_HEADLESS}
TS_SELENIUM_DEFAULT_ATTEMPTS: ${TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS}
TS_SELENIUM_DEFAULT_POLLING: ${TestConstants.TS_SELENIUM_DEFAULT_POLLING}
TS_SELENIUM_DEFAULT_TIMEOUT: ${TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT}
TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT: ${TestConstants.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT}
TS_SELENIUM_LOAD_PAGE_TIMEOUT: ${TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT}
TS_SELENIUM_START_WORKSPACE_TIMEOUT: ${TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT}
TS_SELENIUM_WORKSPACE_STATUS_ATTEMPTS: ${TestConstants.TS_SELENIUM_WORKSPACE_STATUS_ATTEMPTS}
TS_SELENIUM_WORKSPACE_STATUS_POLLING: ${TestConstants.TS_SELENIUM_WORKSPACE_STATUS_POLLING}
TS_SELENIUM_PLUGIN_PRECENCE_ATTEMPTS: ${TestConstants.TS_SELENIUM_PLUGIN_PRECENCE_ATTEMPTS}
TS_SELENIUM_PLUGIN_PRECENCE_POLLING: ${TestConstants.TS_SELENIUM_DEFAULT_POLLING}
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${TestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME}
TS_SELENIUM_USERNAME: ${TestConstants.TS_SELENIUM_USERNAME}
TS_SELENIUM_PASSWORD: ${TestConstants.TS_SELENIUM_PASSWORD}
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${TestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME}
TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: ${TestConstants.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS}
TS_SELENIUM_REPORT_FOLDER: ${TestConstants.TS_SELENIUM_REPORT_FOLDER}
TS_SELENIUM_EXECUTION_SCREENCAST: ${TestConstants.TS_SELENIUM_EXECUTION_SCREENCAST}
@ -62,9 +53,18 @@ class CheReporter extends mocha.reporters.Spec {
TS_SELENIUM_REMOTE_DRIVER_URL: ${TestConstants.TS_SELENIUM_REMOTE_DRIVER_URL}
DELETE_WORKSPACE_ON_FAILED_TEST: ${TestConstants.DELETE_WORKSPACE_ON_FAILED_TEST}
TS_SELENIUM_LOG_LEVEL: ${TestConstants.TS_SELENIUM_LOG_LEVEL}
`;
if ( TestConstants.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES ) {
launchInformation += `\n TS_SELENIUM_PRINT_TIMEOUT_VARIABLES is set to true: \n`;
Object.entries(TimeoutConstants).forEach(
([key, value]) => launchInformation += `\n ${key}: ${value}`);
} else {
launchInformation += `\n to output timeout variables, set TS_SELENIUM_PRINT_TIMEOUT_VARIABLES to true`;
}
launchInformation += `\n ######################################################## \n`;
########################################################
`;
console.log(launchInformation);
rm.sync(TestConstants.TS_SELENIUM_REPORT_FOLDER);

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ import { CLASSES } from '../../inversify.types';
import { By } from 'selenium-webdriver';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
import { Workspaces } from './Workspaces';
import { Logger } from '../../utils/Logger';
@ -62,7 +63,7 @@ export class Dashboard {
}
async waitPage(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('Dashboard.waitPage');
await this.driverHelper.waitVisibility(By.css(Dashboard.WORKSPACES_BUTTON_CSS), timeout);
@ -70,49 +71,49 @@ export class Dashboard {
await this.driverHelper.waitVisibility(By.xpath(Dashboard.GET_STARTED_BUTTON_XPATH), timeout);
}
async clickDashboardButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickDashboardButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_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) {
async clickWorkspacesButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_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) {
async clickStacksdButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug('Dashboard.clickStacksdButton');
await this.driverHelper.waitAndClick(By.css(Dashboard.STACKS_BUTTON_CSS), timeout);
}
async clickGetStartedButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickGetStartedButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug('Dashboard.clickGetStartedButton');
await this.driverHelper.waitAndClick(By.xpath(Dashboard.GET_STARTED_BUTTON_XPATH), timeout);
}
async clickFactoriesButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickFactoriesButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_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) {
async waitLoader(timeout: number = TimeoutConstants.TS_WAIT_LOADER_PRESENCE_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) {
async waitLoaderDisappearance(timeout: number = TimeoutConstants.TS_WAIT_LOADER_ABSENCE_TIMEOUT) {
Logger.debug('Dashboard.waitLoaderDisappearance');
await this.driverHelper.waitDisappearance(By.css(Dashboard.LOADER_PAGE_CSS), timeout);
}
async waitDisappearanceNavigationMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitDisappearanceNavigationMenu(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug('Dashboard.waitDisappearanceNavigationMenu');
await this.driverHelper.waitDisappearance(By.id('chenavmenu'), timeout);

View File

@ -11,15 +11,15 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class GetStarted {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitTitleContains(expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTitleContains(expectedText: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`GetStarted.waitTitleContains text: "${expectedText}"`);
const pageTitleLocator: By = By.xpath(`//div[contains(@title, '${expectedText}')]`);
@ -27,13 +27,13 @@ export class GetStarted {
await this.driverHelper.waitVisibility(pageTitleLocator, timeout);
}
async waitPage(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('GetStarted.waitPage');
await this.waitTitleContains('Getting Started', timeout);
}
async waitSample(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitSample(sampleName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`GetStarted.waitSample sampleName: "${sampleName}"`);
const sampleLocator: By = this.getSampleLocator(sampleName);
@ -41,7 +41,7 @@ export class GetStarted {
await this.driverHelper.waitVisibility(sampleLocator, timeout);
}
async clickOnSample(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnSample(sampleName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug(`GetStarted.clickOnSample sampleName: "${sampleName}"`);
const sampleLocator: By = this.getSampleLocator(sampleName);
@ -49,7 +49,7 @@ export class GetStarted {
await this.driverHelper.waitAndClick(sampleLocator, timeout);
}
async waitSampleSelected(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitSampleSelected(sampleName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`GetStarted.waitSampleSelected sampleName: "${sampleName}"`);
const selectedSampleLocator: By =
@ -58,7 +58,7 @@ export class GetStarted {
await this.driverHelper.waitVisibility(selectedSampleLocator, timeout);
}
async waitSampleUnselected(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitSampleUnselected(sampleName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`GetStarted.waitSampleUnselected sampleName: "${sampleName}"`);
const unselectedSampleLocator: By =
@ -67,7 +67,7 @@ export class GetStarted {
await this.driverHelper.waitVisibility(unselectedSampleLocator, timeout);
}
async clickCreateAndOpenButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickCreateAndOpenButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug('GetStarted.clickCreateAndOpenButton');
const createAndOpenButtonLocator: By =

View File

@ -14,6 +14,7 @@ import { DriverHelper } from '../../utils/DriverHelper';
import { CLASSES } from '../../inversify.types';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
@ -22,19 +23,19 @@ export class Workspaces {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitPage(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_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) {
async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_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) {
async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceListItem "${workspaceName}"`);
const workspaceListItemLocator: By = By.css(this.getWorkspaceListItemLocator(workspaceName));
@ -42,7 +43,7 @@ export class Workspaces {
await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
}
async clickOnStopWorkspaceButton(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnStopWorkspaceButton(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug(`Workspaces.clickOnStopWorkspaceButton "${workspaceName}"`);
const stopWorkspaceButtonLocator: By = By.css(`#ws-name-${workspaceName} .workspace-status[uib-tooltip="Stop workspace"]`);
@ -50,7 +51,7 @@ export class Workspaces {
await this.driverHelper.waitAndClick(stopWorkspaceButtonLocator, timeout);
}
async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceWithRunningStatus "${workspaceName}"`);
const runningStatusLocator: By = By.css(this.getWorkspaceStatusCssLocator(workspaceName, 'RUNNING'));
@ -58,7 +59,7 @@ export class Workspaces {
await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
}
async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceWithStoppedStatus "${workspaceName}"`);
const stoppedStatusLocator: By = By.css(this.getWorkspaceStatusCssLocator(workspaceName, 'STOPPED'));
@ -66,7 +67,7 @@ export class Workspaces {
await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
}
async clickWorkspaceListItem(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug(`Workspaces.clickWorkspaceListItem "${workspaceName}"`);
let namespace: string = TestConstants.TS_SELENIUM_USERNAME;
@ -75,7 +76,7 @@ export class Workspaces {
await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
}
async clickDeleteButtonOnWorkspaceDetails(timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async clickDeleteButtonOnWorkspaceDetails(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug('Workspaces.clickDeleteButtonOnWorkspaceDetails');
const deleteButtonOnWorkspaceDetailsLocator: By = By.css('che-button-danger[che-button-title=\'Delete\']');
@ -83,7 +84,7 @@ export class Workspaces {
await this.driverHelper.waitAndClick(deleteButtonOnWorkspaceDetailsLocator, timeout);
}
async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`Workspaces.waitWorkspaceListItemAbcence "${workspaceName}"`);
let namespace: string = TestConstants.TS_SELENIUM_USERNAME;
@ -92,7 +93,7 @@ export class Workspaces {
await this.driverHelper.waitDisappearance(workspaceListItemLocator, timeout);
}
async confirmWorkspaceDeletion(timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async confirmWorkspaceDeletion(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
Logger.debug('Workspaces.confirmWorkspaceDeletion');
const checkbox: By = By.xpath(`//che-popup//input[@id='enable-button' and contains(@class, 'ng-empty')]`);

View File

@ -17,6 +17,7 @@ import { Ide } from '../../ide/Ide';
import { ITestWorkspaceUtil } from '../../../utils/workspace/ITestWorkspaceUtil';
import { WorkspaceStatus } from '../../../utils/workspace/WorkspaceStatus';
import { Logger } from '../../../utils/Logger';
import { TimeoutConstants } from '../../../TimeoutConstants';
@injectable()
@ -44,7 +45,7 @@ export class WorkspaceDetails {
await this.waitSaveButtonDisappearance();
}
async waitPage(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitPage(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug(`WorkspaceDetails.saveChanges workspace: "${workspaceName}"`);
await this.waitWorkspaceTitle(workspaceName, timeout);
@ -54,7 +55,7 @@ export class WorkspaceDetails {
await this.waitLoaderDisappearance(timeout);
}
async waitWorkspaceTitle(workspaceName: string, timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitWorkspaceTitle(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`WorkspaceDetails.waitWorkspaceTitle title: "${workspaceName}"`);
const workspaceTitleLocator: By = By.css(this.getWorkspaceTitleCssLocator(workspaceName));
@ -62,33 +63,33 @@ export class WorkspaceDetails {
await this.driverHelper.waitVisibility(workspaceTitleLocator, timeout);
}
async waitRunButton(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitRunButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_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) {
async clickOnRunButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_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) {
async waitOpenButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_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) {
async openWorkspace(namespace: string, workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug(`WorkspaceDetails.openWorkspace "${namespace}/${workspaceName}"`);
await this.clickOnOpenButton(timeout);
await this.driverHelper.waitVisibility(By.css(Ide.ACTIVATED_IDE_IFRAME_CSS));
await this.driverHelper.waitVisibility(By.css(Ide.ACTIVATED_IDE_IFRAME_CSS), TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT);
await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.STARTING);
}
async waitTabsPresence(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitTabsPresence(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug('WorkspaceDetails.waitTabsPresence');
const workspaceDetailsTabs: Array<string> = ['Overview', 'Projects', 'Containers', 'Servers',
@ -101,7 +102,7 @@ export class WorkspaceDetails {
}
}
async selectTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectTab(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
Logger.debug(`WorkspaceDetails.selectTab ${tabTitle}`);
await this.clickOnTab(tabTitle, timeout);
@ -120,7 +121,7 @@ export class WorkspaceDetails {
return `//md-tabs-canvas[@role='tablist']//md-tab-item[@aria-selected='true']//span[text()='${tabTitle}']`;
}
private async waitSaveButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async waitSaveButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
}
@ -128,22 +129,22 @@ export class WorkspaceDetails {
await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.SAVE_BUTTON_CSS), attempts, polling);
}
private async clickOnSaveButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async clickOnSaveButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
}
private async clickOnOpenButton(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
private async clickOnOpenButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout);
}
private async clickOnTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
const workspaceDetailsTabLocator: By = By.xpath(this.getTabXpathLocator(tabTitle));
await this.driverHelper.waitAndClick(workspaceDetailsTabLocator, timeout);
}
private async waitTabSelected(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async waitTabSelected(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
const selectedTabLocator: By = By.xpath(this.getSelectedTabXpathLocator(tabTitle));
await this.driverHelper.waitVisibility(selectedTabLocator, timeout);

View File

@ -11,12 +11,12 @@ import { DriverHelper } from '../../../utils/DriverHelper';
import { injectable, inject } from 'inversify';
import 'reflect-metadata';
import { CLASSES, TYPES } from '../../../inversify.types';
import { TestConstants } from '../../../TestConstants';
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';
import { TimeoutConstants } from '../../../TimeoutConstants';
@injectable()
@ -25,28 +25,28 @@ export class WorkspaceDetailsPlugins {
@inject(CLASSES.WorkspaceDetails) private readonly workspaceDetails: WorkspaceDetails,
@inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil) { }
async waitPluginListItem(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitPluginListItem(pluginName: string) {
Logger.debug(`WorkspaceDetailsPlugins.waitPluginListItem ${pluginName}`);
const pluginListItemLocator: By = By.css(this.getPluginListItemCssLocator(pluginName));
await this.driverHelper.waitVisibility(pluginListItemLocator, timeout);
await this.driverHelper.waitVisibility(pluginListItemLocator, TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT);
}
async enablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async enablePlugin(pluginName: string, pluginVersion?: string) {
Logger.debug(`WorkspaceDetailsPlugins.enablePlugin ${pluginName}:${pluginVersion}`);
await this.waitPluginDisabling(pluginName, pluginVersion, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout);
await this.waitPluginEnabling(pluginName, pluginVersion, timeout);
await this.waitPluginDisabling(pluginName, pluginVersion);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion);
await this.waitPluginEnabling(pluginName, pluginVersion);
}
async disablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async disablePlugin(pluginName: string, pluginVersion?: string) {
Logger.debug(`WorkspaceDetailsPlugins.disablePlugin ${pluginName}:${pluginVersion}`);
await this.waitPluginEnabling(pluginName, pluginVersion, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout);
await this.waitPluginDisabling(pluginName, pluginVersion, timeout);
await this.waitPluginEnabling(pluginName, pluginVersion);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion);
await this.waitPluginDisabling(pluginName, pluginVersion);
}
async addPluginAndOpenWorkspace(namespace: string, workspaceName: string, pluginName: string, pluginId: string, pluginVersion?: string) {
@ -74,20 +74,20 @@ export class WorkspaceDetailsPlugins {
private async clickOnPluginListItemSwitcher(pluginName: string,
pluginVersion?: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
const pluginListItemSwitcherLocator = By.css(this.getPluginListItemSwitcherCssLocator(pluginName, pluginVersion));
await this.driverHelper.waitAndClick(pluginListItemSwitcherLocator, timeout);
}
private async waitPluginEnabling(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async waitPluginEnabling(pluginName: string, pluginVersion?: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
const enabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='true']`);
await this.driverHelper.waitVisibility(enabledPluginSwitcherLocator, timeout);
}
private async waitPluginDisabling(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
private async waitPluginDisabling(pluginName: string, pluginVersion?: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
const disabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='false']`);
await this.driverHelper.waitVisibility(disabledPluginSwitcherLocator, timeout);

View File

@ -3,8 +3,8 @@ import { injectable, inject } from 'inversify';
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';
import { TimeoutConstants } from '../../TimeoutConstants';
@ -15,33 +15,33 @@ export class ContextMenu {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async invokeContextMenuOnTheElementWithMouse(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async invokeContextMenuOnTheElementWithMouse(elementLocator: By) {
Logger.debug(`ContextMenu.invokeContextMenuOnTheElementWithMouse ${elementLocator}`);
const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, timeout);
const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT);
await this.driverHelper.getAction().click(webElement, Button.RIGHT).perform();
this.waitContextMenu(timeout);
this.waitContextMenu();
}
async invokeContextMenuOnActiveElementWithKeys(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async invokeContextMenuOnActiveElementWithKeys() {
Logger.debug('ContextMenu.invokeContextMenuOnActiveElementWithKeys');
this.driverHelper.getDriver().switchTo().activeElement().sendKeys(Key.SHIFT + Key.F10);
this.waitContextMenu(timeout);
this.waitContextMenu();
}
async waitContextMenuAndClickOnItem(nameOfItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitContextMenuAndClickOnItem(nameOfItem: string) {
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);
await this.driverHelper.waitAndClick(By.xpath(itemLocator), TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT);
}
async waitContextMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitContextMenu() {
Logger.debug(`ContextMenu.waitContextMenu`);
await this.driverHelper.waitVisibility(By.css(ContextMenu.SUGGESTION_WIDGET_BODY_CSS), timeout);
await this.driverHelper.waitVisibility(By.css(ContextMenu.SUGGESTION_WIDGET_BODY_CSS), TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT);
}
}

View File

@ -13,7 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper';
import { By, Key, WebElement } from 'selenium-webdriver';
import { Ide } from './Ide';
import { Logger } from '../../utils/Logger';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
@ -41,7 +41,7 @@ export class DebugView {
const runDebugButtonLocator: By = By.xpath('//span[@title=\'Start Debugging\']');
await this.driverHelper.waitAndClick(runDebugButtonLocator);
await this.driverHelper.waitAndClick(runDebugButtonLocator, TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
}
/**
@ -49,7 +49,7 @@ export class DebugView {
*
* @param timeout
*/
async waitForDebuggerToConnect(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitForDebuggerToConnect(timeout: number = TimeoutConstants.TS_DEBUGGER_CONNECTION_TIMEOUT) {
await this.driverHelper.getDriver().wait(async () => {
Logger.debug(`Waiting for debugger to connect (threads to appear in "Threads" view)`);
const threadElements: WebElement[] = await this.driverHelper.getDriver().findElements(By.xpath(`//div[contains(@class, 'theia-debug-thread')]`));

View File

@ -12,8 +12,8 @@ import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TestConstants } from '../../TestConstants';
import { Ide } from './Ide';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class DialogWindow {
@ -28,37 +28,37 @@ export class DialogWindow {
return await this.driverHelper.isVisible(By.xpath(DialogWindow.DIALOG_BODY_XPATH_LOCATOR));
}
async waitAndCloseIfAppear(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitAndCloseIfAppear() {
Logger.debug('DialogWindow.waitAndCloseIfAppear');
const dialogDisplayes: boolean = await this.driverHelper.waitVisibilityBoolean(By.xpath(DialogWindow.DIALOG_BODY_XPATH_LOCATOR));
if (dialogDisplayes) {
await this.closeDialog(timeout);
await this.waitDialogDissappearance(timeout);
await this.closeDialog();
await this.waitDialogDissappearance();
}
}
async clickToButton(buttonText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickToButton(buttonText: string) {
Logger.debug('DialogWindow.clickToButton');
const buttonLocator: By = By.xpath(`${DialogWindow.DIALOG_BODY_XPATH_LOCATOR}//button[text()='${buttonText}']`);
await this.driverHelper.waitAndClick(buttonLocator, timeout);
await this.driverHelper.waitAndClick(buttonLocator, TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
}
async closeDialog(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async closeDialog() {
Logger.debug('DialogWindow.closeDialog');
await this.clickToButton('close', timeout);
await this.clickToButton('close');
}
async clickToOpenLinkButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickToOpenLinkButton() {
Logger.debug('DialogWindow.clickToOpenLinkButton');
await this.clickToButton('Open Link', timeout);
await this.clickToButton('Open Link');
}
async waitDialog(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, dialogText: string = '') {
async waitDialog(dialogText: string = '', timeout: number = TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT) {
Logger.debug('DialogWindow.waitDialog');
// if dialog text is provided uses xpath with this text
@ -69,19 +69,19 @@ export class DialogWindow {
await this.driverHelper.waitVisibility(By.xpath(dialogXpathLocator), timeout);
}
async waitDialogAndOpenLink(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT, dialogText: string = '') {
async waitDialogAndOpenLink(dialogText: string = '', applicationReaddyTimeout: number) {
Logger.debug('DialogWindow.waitDialogAndOpenLink');
await this.waitDialog(timeout, dialogText);
await this.ide.waitApllicationIsReady(await this.getApplicationUrlFromDialog(dialogText), timeout);
await this.clickToOpenLinkButton(timeout);
await this.waitDialogDissappearance(timeout);
await this.waitDialog(dialogText);
await this.ide.waitApllicationIsReady(await this.getApplicationUrlFromDialog(dialogText), applicationReaddyTimeout);
await this.clickToOpenLinkButton();
await this.waitDialogDissappearance();
}
async waitDialogDissappearance(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitDialogDissappearance() {
Logger.debug('DialogWindow.waitDialogDissappearance');
await this.driverHelper.waitDisappearanceWithTimeout(By.xpath(DialogWindow.CLOSE_BUTTON_XPATH_LOCATOR));
await this.driverHelper.waitDisappearanceWithTimeout(By.xpath(DialogWindow.CLOSE_BUTTON_XPATH_LOCATOR), TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
}
async getApplicationUrlFromDialog(dialogWindowText: string) {

View File

@ -14,6 +14,7 @@ import { CLASSES } from '../../inversify.types';
import { TestConstants } from '../../TestConstants';
import { By, Key, error, ActionSequence, Button } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
@ -26,13 +27,13 @@ export class Editor {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
public async waitSuggestionContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitSuggestionContainer(timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT) {
Logger.debug('Editor.waitSuggestionContainer');
await this.driverHelper.waitVisibility(By.css(Editor.SUGGESTION_WIDGET_BODY_CSS), timeout);
}
public async waitSuggestionContainerClosed(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitSuggestionContainerClosed(timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT) {
Logger.debug('Editor.waitSuggestionContainerClosed');
await this.driverHelper.waitDisappearanceWithTimeout(By.css(Editor.SUGGESTION_WIDGET_BODY_CSS), timeout);
@ -40,7 +41,7 @@ export class Editor {
public async waitSuggestion(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT,
timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT,
lineNumber?: number,
charNumber?: number) {
@ -61,7 +62,7 @@ export class Editor {
}
public async closeSuggestionContainer(editorTabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async closeSuggestionContainer(editorTabTitle: string, timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT) {
Logger.debug(`Editor.closeSuggestionContainer tabTitle: "${editorTabTitle}"`);
await this.driverHelper.getDriver().wait(async () => {
@ -96,7 +97,7 @@ export class Editor {
public async waitSuggestionWithScrolling(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT) {
Logger.debug(`Editor.waitSuggestion tabTitle: "${editorTabTitle}" suggestion: "${suggestionText}"`);
@ -104,14 +105,14 @@ export class Editor {
await this.driverHelper.getDriver().wait(async () => {
try {
await this.scrollAndSearchSuggestion(editorTabTitle, suggestionLocator, 40000);
await this.scrollAndSearchSuggestion(editorTabTitle, suggestionLocator, timeout / 3);
return true;
} catch (err) {
if (!(err instanceof error.TimeoutError)) {
throw err;
}
await this.closeSuggestionContainer(editorTabTitle, timeout);
await this.closeSuggestionContainer(editorTabTitle, TimeoutConstants.TS_CLOSE_SUGGESTION_CONTAINER_TIMEOUT);
await this.pressControlSpaceCombination(editorTabTitle);
}
}, timeout);
@ -129,13 +130,13 @@ export class Editor {
await this.performKeyCombination(editorTabTitle, Key.ESCAPE);
}
public async clickOnSuggestion(suggestionText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clickOnSuggestion(suggestionText: string, timeout: number = TimeoutConstants.TS_SUGGESTION_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) {
public async waitTab(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.waitTab "${tabTitle}"`);
await this.driverHelper.waitVisibility(By.xpath(this.getTabXpathLocator(tabTitle)), timeout);
@ -150,13 +151,13 @@ export class Editor {
await this.driverHelper.waitDisappearance(By.xpath(this.getTabXpathLocator(tabTitle)), attempt, polling);
}
public async clickOnTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.clickOnTab "${tabTitle}"`);
await this.driverHelper.waitAndClick(By.xpath(this.getTabXpathLocator(tabTitle)), timeout);
}
public async waitTabFocused(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitTabFocused(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_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}']`);
@ -164,15 +165,15 @@ export class Editor {
await this.driverHelper.waitVisibility(focusedTabLocator, timeout);
}
public async selectTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async selectTab(tabTitle: string) {
Logger.debug(`Editor.selectTab "${tabTitle}"`);
await this.waitTab(tabTitle, timeout);
await this.clickOnTab(tabTitle, timeout);
await this.waitTabFocused(tabTitle, timeout);
await this.waitTab(tabTitle);
await this.clickOnTab(tabTitle);
await this.waitTabFocused(tabTitle);
}
async closeTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async closeTab(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.closeTab "${tabTitle}"`);
const tabCloseButtonLocator: By = By.xpath(`//div[text()='${tabTitle}']/parent::li//div[contains(@class, 'p-TabBar-tabCloseIcon')]`);
@ -180,7 +181,7 @@ export class Editor {
await this.driverHelper.waitAndClick(tabCloseButtonLocator, timeout);
}
async waitTabWithUnsavedStatus(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTabWithUnsavedStatus(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.waitTabWithUnsavedStatus "${tabTitle}"`);
const unsavedTabLocator: By = this.getTabWithUnsavedStatus(tabTitle);
@ -188,7 +189,7 @@ export class Editor {
await this.driverHelper.waitVisibility(unsavedTabLocator, timeout);
}
async waitTabWithSavedStatus(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTabWithSavedStatus(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.waitTabWithSavedStatus "${tabTitle}"`);
const unsavedTabLocator: By = this.getTabWithUnsavedStatus(tabTitle);
@ -209,7 +210,7 @@ export class Editor {
}
async waitEditorOpened(editorTabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitEditorOpened(editorTabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.waitEditorOpened "${editorTabTitle}"`);
const firstEditorLineLocator: By = By.xpath(this.getEditorLineXpathLocator(1));
@ -218,7 +219,7 @@ export class Editor {
await this.driverHelper.waitPresence(firstEditorLineLocator, timeout);
}
async waitEditorAvailable(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitEditorAvailable(tabTitle: string, timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT) {
Logger.debug(`Editor.waitEditorAvailable "${tabTitle}"`);
await this.waitTab(tabTitle, timeout);
@ -246,7 +247,7 @@ export class Editor {
}
async waitText(tabTitle: string, expectedText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT,
timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT,
polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
Logger.debug(`Editor.waitText "${tabTitle}"`);
@ -265,12 +266,12 @@ export class Editor {
async followAndWaitForText(editorTabTitle: string,
expectedText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT,
timeout: number = TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT,
polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
Logger.debug(`Editor.followAndWaitForText title: "${editorTabTitle}" text: "${expectedText}"`);
await this.selectTab(editorTabTitle, timeout);
await this.selectTab(editorTabTitle);
await this.driverHelper.getDriver().wait(async () => {
await this.performKeyCombination(editorTabTitle, Key.chord(Key.CONTROL, Key.END));
const editorText: string = await this.getEditorVisibleText(editorTabTitle);
@ -317,33 +318,33 @@ export class Editor {
await this.performKeyCombination(editorTabTitle, text);
}
async waitErrorInLine(lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitErrorInLine(lineNumber: number, timeout: number = TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT) {
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) {
async waitErrorInLineDisappearance(lineNumber: number, timeout: number = TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT) {
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) {
async waitStoppedDebugBreakpoint(tabTitle: string, lineNumber: number, timeout: number = TimeoutConstants.TS_BREAKPOINT_DEFAULT_TIMEOUT) {
Logger.debug(`Editor.waitStoppedDebugBreakpoint title: "${tabTitle}" line: "${lineNumber}"`);
await this.driverHelper.waitUntilTrue(() => this.isBreakpointPresent(tabTitle, lineNumber, true), timeout);
}
async waitBreakpoint(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitBreakpoint(tabTitle: string, lineNumber: number, timeout: number = TimeoutConstants.TS_BREAKPOINT_DEFAULT_TIMEOUT) {
Logger.debug(`Editor.waitBreakpoint title: "${tabTitle}" line: "${lineNumber}"`);
await this.driverHelper.waitUntilTrue(() => this.isBreakpointPresent(tabTitle, lineNumber), timeout);
}
async waitBreakpointAbsence(tabTitle: string, lineNumber: number, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitBreakpointAbsence(tabTitle: string, lineNumber: number, timeout: number = TimeoutConstants.TS_BREAKPOINT_DEFAULT_TIMEOUT) {
Logger.debug(`Editor.waitBreakpointAbsence title: "${tabTitle}" line: "${lineNumber}"`);
await this.driverHelper.waitUntilTrue(() => !this.isBreakpointPresent(tabTitle, lineNumber), timeout);
}
@ -379,7 +380,7 @@ export class Editor {
const lineNumberLocator: By = By.xpath(`//div[contains(@class, 'line-numbers') and text()='${lineNumber}']` +
`//parent::div[contains(@style, 'position')]`);
let elementStyleValue: string = await this.driverHelper.waitAndGetElementAttribute(lineNumberLocator, 'style');
let elementStyleValue: string = await this.driverHelper.waitAndGetElementAttribute(lineNumberLocator, 'style', TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
elementStyleValue = elementStyleValue.replace('position: absolute; top: ', '');
elementStyleValue = elementStyleValue.replace('px; width: 100%; height: 19px;', '');
@ -482,7 +483,7 @@ export class Editor {
private async waitSuggestionWithResettingCursor(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT,
timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT,
lineNumber: number,
charNumber: number) {
@ -514,7 +515,7 @@ export class Editor {
private async waitSuggestionWithoutResettingCursor(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number = TimeoutConstants.TS_SUGGESTION_TIMEOUT) {
Logger.debug(`Editor.waitSuggestion tabTitle: "${editorTabTitle}" suggestion: "${suggestionText}"`);

View File

@ -1,9 +1,9 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
@ -21,7 +21,7 @@ export class GitPlugin {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async openGitPluginContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async openGitPluginContainer(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.openGitPluginContainer');
const sourceControlGitBtnXpathLocator: string = '//li[@id=\'shell-tab-scm-view-container\' and contains(@style, \'height\')]';
@ -29,67 +29,68 @@ export class GitPlugin {
await this.waitViewOfContainer(timeout);
}
async waitViewOfContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitViewOfContainer(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.waitViewOfContainer');
const gitHubContainerIdLocator: By = By.id('scm-view-container--scm-view');
await this.driverHelper.waitVisibility(gitHubContainerIdLocator, timeout);
}
async waitCommitMessageTextArea(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitCommitMessageTextArea(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.waitCommitMessageTextArea');
const textAreaCssLocator: By = By.css(GitPlugin.COMMIT_MESSAGE_TEXTAREA_CSS);
await this.driverHelper.waitVisibility(textAreaCssLocator, timeout);
}
async typeCommitMessage(commitMessage: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async typeCommitMessage(commitMessage: string, timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.typeCommitMessage');
await this.waitCommitMessageTextArea(timeout);
await this.driverHelper.type(By.css(GitPlugin.COMMIT_MESSAGE_TEXTAREA_CSS), commitMessage, timeout);
}
async selectCommandInMoreActionsMenu(commandName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectCommandInMoreActionsMenu(commandName: string, timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.selectCommandInMoreActionsMenu');
await this.clickOnMoreActions(timeout);
await this.driverHelper.waitAndClick(By.xpath(`//li[@data-command]/div[text()=\'${commandName}\']`), timeout);
}
async clickOnMoreActions(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnMoreActions(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.clickOnMoreActions');
await this.driverHelper.waitAndClick(By.id('__more__'), timeout);
}
async waitChangedFileInChagesList(expectedItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitChangedFileInChagesList(expectedItem: string, timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.waitChangedFileInChagesList');
await this.driverHelper.waitPresence(By.xpath(`//span[@class='name' and text()=\'${expectedItem}\']`), timeout);
}
async waitStagedFileInStagedChanges(expectedStagedItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitStagedFileInStagedChanges(expectedStagedItem: string, timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.waitStagedFileInStagedChanges');
await this.driverHelper.waitPresence(By.xpath(`//div[text()='Staged Changes']/parent::div/parent::div/parent::div/following-sibling::div//span[text()=\'${expectedStagedItem}\']`), timeout);
}
async commitFromScmView(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async commitFromScmView(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.commitFromScmView');
await this.driverHelper.waitAndClick(By.id('__scm-view-container_title:__plugin.scm.title.action.git.commit'), timeout);
}
async stageAllChanges(expectedStagedItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async stageAllChanges(expectedStagedItem: string, timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.stageAllChanges');
await this.driverHelper.scrollTo(By.xpath('//div[@class=\'noWrapInfo theia-TreeNodeSegmentGrow\' and text()=\'Changes\']'), timeout);
await this.driverHelper.waitVisibility(By.xpath('//div[@class=\'noWrapInfo theia-TreeNodeSegmentGrow\' and text()=\'Changes\']'), timeout);
await this.driverHelper.scrollTo(By.xpath('//div[@class=\'noWrapInfo theia-TreeNodeSegmentGrow\' and text()=\'Changes\']'));
await this.driverHelper.waitAndClick(By.xpath('//a[@title=\'Stage All Changes\']'), timeout);
await this.waitStagedFileInStagedChanges(expectedStagedItem);
}
async waitDataIsSynchronized(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitDataIsSynchronized(timeout: number = TimeoutConstants.TS_GIT_CONAINER_INTERACTION_TIMEOUT) {
Logger.debug('GitPlugin.waitDataIsSynchronized');
await this.driverHelper.waitDisappearance(By.xpath(`//div[contains(@title,'Synchronize Changes')]//span[contains(.,' 0↓')]`), timeout);
}

View File

@ -15,6 +15,7 @@ import { TestConstants } from '../../TestConstants';
import { By, error } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { NotificationCenter } from './NotificationCenter';
import { TimeoutConstants } from '../../TimeoutConstants';
export enum LeftToolbarButton {
Explorer = 'Explorer',
@ -39,7 +40,7 @@ export class Ide {
@inject(CLASSES.NotificationCenter) private readonly notificationCenter: NotificationCenter
) { }
async waitAndSwitchToIdeFrame(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitAndSwitchToIdeFrame(timeout: number = TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug('Ide.waitAndSwitchToIdeFrame');
try {
await this.driverHelper.waitAndSwitchToFrame(By.css(Ide.IDE_IFRAME_CSS), timeout);
@ -52,7 +53,7 @@ export class Ide {
}
}
async waitNotification(notificationText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitNotification(notificationText: string, timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`Ide.waitNotification "${notificationText}"`);
const notificationLocator: By = By.xpath(this.getNotificationXpathLocator(notificationText));
@ -61,7 +62,7 @@ export class Ide {
async waitNotificationAndClickOnButton(notificationText: string,
buttonText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`Ide.waitNotificationAndClickOnButton "${notificationText}" buttonText: "${buttonText}"`);
@ -85,15 +86,14 @@ export class Ide {
}, timeout);
}
async waitNotificationAndConfirm(notificationText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitNotificationAndConfirm(notificationText: string, timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`Ide.waitNotificationAndConfirm "${notificationText}"`);
await this.waitNotificationAndClickOnButton(notificationText, 'yes', timeout);
}
async waitNotificationAndOpenLink(notificationText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitNotificationAndOpenLink(notificationText: string, timeout: number) {
Logger.debug(`Ide.waitNotificationAndOpenLink "${notificationText}"`);
await this.waitNotification(notificationText, timeout);
await this.waitApllicationIsReady(await this.getApplicationUrlFromNotification(notificationText), timeout);
await this.waitNotificationAndClickOnButton(notificationText, 'Open Link', timeout);
@ -123,7 +123,7 @@ export class Ide {
await this.driverHelper.waitAndClick(By.xpath(yesButtonLocator));
}
async waitWorkspaceAndIde(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitWorkspaceAndIde(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
Logger.debug('Ide.waitWorkspaceAndIde');
@ -131,7 +131,7 @@ export class Ide {
await this.waitIde(timeout);
}
async waitIde(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitIde(timeout: number = TimeoutConstants.TS_IDE_LOAD_TIMEOUT) {
Logger.debug('Ide.waitIde');
const mainIdeParts: Array<By> = [By.css(Ide.TOP_MENU_PANEL_CSS), By.css(Ide.LEFT_CONTENT_PANEL_CSS), By.id(Ide.EXPLORER_BUTTON_ID)];
@ -147,33 +147,33 @@ export class Ide {
}
}
async waitLeftToolbarButton(buttonTitle: LeftToolbarButton, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitLeftToolbarButton(buttonTitle: LeftToolbarButton, timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('Ide.waitLeftToolbarButton');
const buttonLocator: By = this.getLeftToolbarButtonLocator(buttonTitle);
await this.driverHelper.waitVisibility(buttonLocator, timeout);
}
async waitAndClickLeftToolbarButton(buttonTitle: LeftToolbarButton, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitAndClickLeftToolbarButton(buttonTitle: LeftToolbarButton, timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('Ide.waitAndClickLeftToolbarButton');
const buttonLocator: By = this.getLeftToolbarButtonLocator(buttonTitle);
await this.driverHelper.waitAndClick(buttonLocator, timeout);
}
async waitTopMenuPanel(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTopMenuPanel(timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('Ide.waitTopMenuPanel');
await this.driverHelper.waitVisibility(By.css(Ide.TOP_MENU_PANEL_CSS), timeout);
}
async waitLeftContentPanel(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitLeftContentPanel(timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('Ide.waitLeftContentPanel');
await this.driverHelper.waitVisibility(By.css(Ide.LEFT_CONTENT_PANEL_CSS));
await this.driverHelper.waitVisibility(By.css(Ide.LEFT_CONTENT_PANEL_CSS), timeout);
}
async waitPreloaderAbsent(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitPreloaderAbsent(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = timeout / polling;
Logger.debug('Ide.waitPreloaderAbsent');
@ -181,13 +181,13 @@ export class Ide {
await this.driverHelper.waitDisappearance(By.css(Ide.PRELOADER_CSS), attempts, polling);
}
async waitPreloaderVisible(timeout: number = TestConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
async waitPreloaderVisible(timeout: number = TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT) {
Logger.debug('Ide.waitPreloaderVisible');
await this.driverHelper.waitVisibility(By.css(Ide.PRELOADER_CSS), timeout);
}
async waitStatusBarContains(expectedText: string, timeout: number = TestConstants.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) {
async waitStatusBarContains(expectedText: string, timeout: number = TimeoutConstants.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) {
const statusBarLocator: By = By.css('div[id=\'theia-statusBar\']');
Logger.debug(`Ide.waitStatusBarContains "${expectedText}"`);
@ -205,7 +205,7 @@ export class Ide {
}, timeout);
}
async waitStatusBarTextAbsence(expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitStatusBarTextAbsence(expectedText: string, timeout: number = TimeoutConstants.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) {
const statusBarLocator: By = By.css('div[id=\'theia-statusBar\']');
Logger.debug(`Ide.waitStatusBarTextAbsence "${expectedText}"`);
@ -233,21 +233,21 @@ export class Ide {
await this.waitStatusBarContains(expectedTextInStatusBar, 20000);
}
async performKeyCombination(keyCombination: string) {
async performKeyCombination(keyCombination: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`Ide.performKeyCombination "${keyCombination}"`);
const bodyLocator: By = By.tagName('body');
await this.driverHelper.type(bodyLocator, keyCombination);
await this.driverHelper.type(bodyLocator, keyCombination, timeout);
}
async waitRightToolbarButtonSelection(buttonTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitRightToolbarButtonSelection(buttonTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('Ide.waitRightToolbarButtonSelection');
const selectedRightToolbarButtonLocator: By = this.getSelectedRightToolbarButtonLocator(buttonTitle);
await this.driverHelper.waitVisibility(selectedRightToolbarButtonLocator, timeout);
}
async getApplicationUrlFromNotification(notificationText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async getApplicationUrlFromNotification(notificationText: string, timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`Ide.getApplicationUrlFromNotification ${notificationText}`);
const notificationTextLocator: By = By.xpath(`//div[@class='theia-notification-message']/span[contains(.,'${notificationText}')]`);
@ -261,11 +261,11 @@ export class Ide {
return notification.split(regexp)[1];
}
async closeAllNotifications(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async closeAllNotifications(timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`Ide.closeAllNotifications`);
for (let i: number = 0; i < 5; i++) {
await this.notificationCenter.open(timeout);
await this.notificationCenter.open();
try {
await this.notificationCenter.closeAll(timeout);
break;
@ -284,7 +284,7 @@ export class Ide {
}
async waitApllicationIsReady(url: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number) {
Logger.debug(`Ide.waitApllicationIsReady ${url}`);

View File

@ -10,9 +10,9 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@ -20,13 +20,13 @@ import { Logger } from '../../utils/Logger';
export class LeftToolbar {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitToolbar(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitToolbar(timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_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) {
async clickOnToolIcon(iconTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`RightToolbar.clickOnToolIcon "${iconTitle}"`);
const toolIconLocator: By = By.css(`div.theia-app-right .p-TabBar-content li[title='${iconTitle}']`);

View File

@ -11,9 +11,9 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { Logger } from '../../utils/Logger';
import { By } from 'selenium-webdriver';
import { TimeoutConstants } from '../../TimeoutConstants';
@ -21,13 +21,13 @@ import { By } from 'selenium-webdriver';
export class NotificationCenter {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitOpening(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitOpening(timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug('NotificationCenter.waitOpening');
await this.driverHelper.waitVisibility(By.css('div.theia-notification-center-header'), timeout);
}
async clickIconOnStatusBar(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickIconOnStatusBar(timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug('NotificationCenter.clickIconOnStatusBar');
const statusBarNotificationsLocator: By =
@ -36,14 +36,14 @@ export class NotificationCenter {
await this.driverHelper.waitAndClick(statusBarNotificationsLocator, timeout);
}
async open(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async open() {
Logger.debug(`NotificationCenter.open`);
await this.clickIconOnStatusBar(timeout);
await this.waitOpening(timeout);
await this.clickIconOnStatusBar(TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
await this.waitOpening(TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT);
}
async clickCloseAllNotificationsButton(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickCloseAllNotificationsButton(timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`NotificationCenter.clickCloseAllNotificationsButton`);
const closeAllButtonLocator: By = By.css('.theia-notification-center-header-actions .clear-all');
@ -51,7 +51,7 @@ export class NotificationCenter {
await this.driverHelper.waitAndClick(closeAllButtonLocator, timeout);
}
async waitClosing(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitClosing(timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`NotificationCenter.waitClosing`);
const notificationCenterClosedLocator: By = By.css('.theia-notification-center.closed');
@ -59,7 +59,7 @@ export class NotificationCenter {
await this.driverHelper.waitPresence(notificationCenterClosedLocator, timeout);
}
async waitClearNotificationsList(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitClearNotificationsList(timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug(`NotificationCenter.waitClearNotificationsList`);
const notificationLocator: By = By.css('.theia-notification-center .theia-notification-list > *');
@ -67,7 +67,7 @@ export class NotificationCenter {
await this.driverHelper.waitDisappearance(notificationLocator, timeout);
}
async closeAll(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async closeAll(timeout: number = TimeoutConstants.TS_NOTIFICATION_CENTER_TIMEOUT) {
Logger.debug('NotificationCenter.closeAll');
await this.clickCloseAllNotificationsButton(timeout);

View File

@ -10,11 +10,11 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { Logger } from '../../utils/Logger';
import { DialogWindow } from '../ide/DialogWindow';
import { OpenWorkspaceWidget } from '../ide/OpenWorkspaceWidget';
import { By } from 'selenium-webdriver';
import { TimeoutConstants } from '../../TimeoutConstants';
export enum Locations {
Theia = 'theia',
@ -36,36 +36,31 @@ export class OpenDialogWidget {
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper
) { }
async waitOpenDialogWindow(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`OpenDialogWidget.waitOpenDialogWindow`);
await this.dialogWindow.waitDialog(timeout);
}
async selectLocation(location: Locations, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectLocation(location: Locations, timeout: number = TimeoutConstants.TS_SELENIUM_DIALOG_WIDGET_TIMEOUT) {
Logger.debug(`OpenDialogWidget.selectLocation`);
await this.driverHelper.type(By.css('div.theia-NavigationPanel select'), location, timeout);
}
async selectItemInTree(pathToItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectItemInTree(pathToItem: string) {
Logger.debug(`OpenDialogWidget.selectItemInTree "${pathToItem}"`);
await this.openWorkspaceWidget.selectItemInTree(pathToItem);
}
async expandItemInTreeToPath(pathToItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async expandItemInTreeToPath(pathToItem: string, timeout: number = TimeoutConstants.TS_SELENIUM_DIALOG_WIDGET_TIMEOUT) {
Logger.debug(`OpenDialogWidget.expandItemInTreeToPath "${pathToItem}"`);
await this.openWorkspaceWidget.expandTreeToPath(pathToItem, timeout);
}
async clickOnButton(button: Buttons, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnButton(button: Buttons) {
Logger.debug(`OpenDialogWidget.clickOnButton ${button}`);
await this.dialogWindow.clickToButton(button);
}
async selectLocationAndAddContextFolder(location: Locations, path: string, button: Buttons, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.selectLocation(location, timeout);
await this.expandItemInTreeToPath(path, timeout);
await this.clickOnButton(button, timeout);
async selectLocationAndAddContextFolder(location: Locations, path: string, button: Buttons) {
await this.selectLocation(location);
await this.expandItemInTreeToPath(path);
await this.clickOnButton(button);
await this.dialogWindow.waitDialogDissappearance();
}

View File

@ -11,50 +11,22 @@ import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { By } from 'selenium-webdriver';
import { TestConstants } from '../../TestConstants';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class OpenWorkspaceWidget {
private static readonly OPEN_WORKSPACE_MAIN_VIEW_XPATH = '//div[@class=\'dialogTitle\']/div[text()=\'Open Workspace\']';
private static readonly OPEN_WORKSPACE_OPEN_BTN_CSS = 'div.dialogControl>button.main';
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
}
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) {
async selectItemInTree(pathToItem: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
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, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<any> {
async expandTreeToPath(path: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<any> {
Logger.debug(`OpenWorkspaceWidget.expandTreeToPath "${path}"`);
const pathNodes: string[] = path.split('/');
let buildPath: string = '';

View File

@ -11,10 +11,10 @@ import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { Ide, LeftToolbarButton } from './Ide';
import { TestConstants } from '../../TestConstants';
import { Logger } from '../../utils/Logger';
import { By } from 'selenium-webdriver';
import { ContextMenu } from './ContextMenu';
import { TimeoutConstants } from '../../TimeoutConstants';
export enum OpenshiftAppExplorerToolbar {
ReportExtensionIssueOnGitHub = 'Report Extension Issue on GitHub',
@ -39,43 +39,43 @@ export class OpenshiftPlugin {
}
async clickOnOpenshiftToollBarIcon(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnOpenshiftToollBarIcon(timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`OpenshiftPlugin.clickOnOpenshiftTollBar`);
await this.ide.waitAndClickLeftToolbarButton(LeftToolbarButton.Openshift, timeout);
}
async waitOpenshiftConnectorTree(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitOpenshiftConnectorTree(timeout: number = TimeoutConstants.TS_WAIT_OPENSHIFT_CONNECTOR_TREE_TIMEOUT) {
Logger.debug(`OpenshiftPlugin.waitOpenshiftConnectorTree`);
await this.driverHelper.waitPresence(By.id('openshiftProjectExplorer'), timeout);
}
async clickOnApplicationToolbarItem(item: OpenshiftAppExplorerToolbar, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnApplicationToolbarItem(item: OpenshiftAppExplorerToolbar, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`OpenshiftPlugin.clickOnApplicationToolbarItem`);
await this.driverHelper.waitAndClick(By.css(`div [title='${item}']`), timeout);
}
async getClusterIP(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
async getClusterIP(timeout: number = TimeoutConstants.TS_GET_CLUSTER_IP_TIMEOUT): Promise<string> {
Logger.debug(`OpenshiftPlugin.getClusterIP`);
return await this.driverHelper.waitAndGetText(By.xpath('//div[@id=\'openshiftProjectExplorer\']//div[@title [contains(text(), https)]]'), timeout);
}
async waitItemInTree(item: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitItemInTree(item: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`OpenshiftPlugin.waitItemInTree`);
await this.driverHelper.waitPresence(By.xpath(`//div[contains(@id, ':${item}')]`), timeout);
}
async clickOnItemInTree(item: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnItemInTree(item: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`OpenshiftPlugin.clickOnItemInTree`);
await this.driverHelper.waitAndClick(By.xpath(`//div[contains(@id, ':${item}')]`), timeout);
}
async invokeContextMenuOnItem(treeItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`OpenshiftPlugin.clickOnItemInTree`);
await this.contextMenu.invokeContextMenuOnTheElementWithMouse(By.xpath(`//div[contains(@id, ':${treeItem}')]`), timeout);
async invokeContextMenuOnItem(treeItem: string) {
Logger.debug(`OpenshiftPlugin.invokeContextMenuOnItem`);
await this.contextMenu.invokeContextMenuOnTheElementWithMouse(By.xpath(`//div[contains(@id, ':${treeItem}')]`));
}
async invokeContextMenuCommandOnItem(treeItem: string, menuItem: OpenshiftContextMenuItems, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async invokeContextMenuCommandOnItem(treeItem: string, menuItem: OpenshiftContextMenuItems) {
Logger.debug(`OpenshiftPlugin.clickOnItemInTree`);
await this.contextMenu.invokeContextMenuOnTheElementWithMouse(By.xpath(`//div[contains(@id, ':${treeItem}')]`), timeout);
await this.contextMenu.invokeContextMenuOnTheElementWithMouse(By.xpath(`//div[contains(@id, ':${treeItem}')]`));
await this.contextMenu.waitContextMenuAndClickOnItem(menuItem);
}
}

View File

@ -14,6 +14,7 @@ import { By, error, Key } from 'selenium-webdriver';
import { TestConstants } from '../../TestConstants';
import { Ide } from './Ide';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class PreviewWidget {
@ -22,33 +23,33 @@ export class PreviewWidget {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
@inject(CLASSES.Ide) private readonly ide: Ide) { }
async waitUrl(expectedUrl: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitUrl(expectedUrl: string, timeout: number = TimeoutConstants.TS_WAIT_URL_TIMEOUT) {
Logger.debug(`PreviewWidget.waitUrl ${expectedUrl}`);
await this.driverHelper.waitAttributeValue(PreviewWidget.WIDGET_URL_LOCATOR, 'value', expectedUrl, timeout);
}
async typeUrl(url: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async typeUrl(url: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`PreviewWidget.typeUrl ${url}`);
await this.driverHelper.type(PreviewWidget.WIDGET_URL_LOCATOR, url, timeout);
}
async clearUrl(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clearUrl() {
Logger.debug('PreviewWidget.clearUrl');
await this.typeUrl(Key.chord(Key.CONTROL, 'a', Key.DELETE));
await this.waitUrl('', timeout);
await this.waitUrl('');
}
async typeAndApplyUrl(url: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async typeAndApplyUrl(url: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`PreviewWidget.typeAndApplyUrl ${url}`);
await this.clearUrl(timeout);
await this.clearUrl();
await this.typeUrl(Key.chord(url, Key.ENTER), timeout);
}
async waitApplicationOpened(expectedUrl: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitApplicationOpened(expectedUrl: string, timeout: number) {
Logger.debug(`PreviewWidget.waitApplicationOpened ${expectedUrl}`);
await this.driverHelper.getDriver().wait(async () => {
@ -69,16 +70,10 @@ export class PreviewWidget {
Logger.debug('PreviewWidget.waitAndSwitchToWidgetFrame');
const iframeLocator: By = By.css('div.theia-mini-browser iframe');
await this.driverHelper.waitAndSwitchToFrame(iframeLocator);
await this.driverHelper.waitAndSwitchToFrame(iframeLocator, TimeoutConstants.TS_SELENIUM_PREVIEW_WIDGET_DEFAULT_TIMEOUT);
}
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');
@ -86,7 +81,7 @@ export class PreviewWidget {
}
async waitContentAvailable(contentLocator: By,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT,
timeout: number,
polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING * 5) {
Logger.debug(`PreviewWidget.waitContentAvailable ${contentLocator}`);
@ -107,34 +102,13 @@ export class PreviewWidget {
}, timeout);
}
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);
if (isApplicationTitleVisible) {
await this.driverHelper.getDriver().switchTo().defaultContent();
return true;
}
await this.driverHelper.getDriver().switchTo().defaultContent();
await this.refreshPage();
await this.waitAndSwitchToWidgetFrame();
await this.driverHelper.wait(polling);
}, timeout);
}
async waitVisibility(element: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitVisibility(element: By, timeout: number) {
Logger.debug(`PreviewWidget.waitVisibility ${element}`);
await this.driverHelper.waitVisibility(element, timeout);
}
async waitAndClick(element: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitAndClick(element: By, timeout: number = TimeoutConstants.TS_SELENIUM_PREVIEW_WIDGET_DEFAULT_TIMEOUT) {
Logger.debug(`PreviewWidget.waitAndClick ${element}`);
await this.driverHelper.waitAndClick(element, timeout);

View File

@ -16,6 +16,7 @@ import { TestConstants } from '../../TestConstants';
import { By, error } from 'selenium-webdriver';
import { Editor } from './Editor';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class ProjectTree {
@ -37,7 +38,7 @@ export class ProjectTree {
Logger.debug(`ProjectTree.waitTreeCollapsed project: "${projectName}", subitem: "${rootSubItem}"`);
const rootSubitemLocator: By = By.css(this.getTreeItemCssLocator(`${projectName}/${rootSubItem}`));
await this.driverHelper.waitDisappearanceWithTimeout(rootSubitemLocator);
await this.driverHelper.waitDisappearanceWithTimeout(rootSubitemLocator, TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
}
async collapseProjectTree(projectName: string, rootSubItem: string) {
@ -54,14 +55,7 @@ export class ProjectTree {
await this.waitItemCollapsed(`${projectName}/${expandedRootItem}`);
}
async collapseAssociatedWorkspaceProjectTree(projectName: string, rootSubItem: string) {
Logger.debug(`ProjectTree.collapseProjectTree project: "${projectName}", subitem: "${rootSubItem}"`);
await this.clickCollapseAllButton();
await this.waitTreeCollapsed(projectName, rootSubItem);
}
async openProjectTreeContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async openProjectTreeContainer(timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug('ProjectTree.openProjectTreeContainer');
const explorerButtonActiveLocator: By = this.getLeftToolbarButtonActiveLocator(LeftToolbarButton.Explorer);
@ -77,7 +71,7 @@ export class ProjectTree {
await this.waitProjectTreeContainer();
}
async waitItemExpanded(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitItemExpanded(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug(`ProjectTree.waitItemExpanded "${itemPath}"`);
const locator: string = await this.getExpandedItemCssLocator(itemPath);
@ -85,7 +79,7 @@ export class ProjectTree {
await this.driverHelper.waitVisibility(expandedItemLocator, timeout);
}
async waitItemCollapsed(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitItemCollapsed(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug(`ProjectTree.waitItemCollapsed "${itemPath}"`);
const locator: string = await this.getCollapsedItemCssLocator(itemPath);
@ -94,7 +88,7 @@ export class ProjectTree {
await this.driverHelper.waitVisibility(collapsedItemLocator, timeout);
}
async waitProjectTreeContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitProjectTreeContainer(timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug('ProjectTree.waitProjectTreeContainer');
await this.driverHelper.waitPresence(By.css(ProjectTree.PROJECT_TREE_CONTAINER_CSS), timeout);
@ -108,7 +102,7 @@ export class ProjectTree {
await this.driverHelper.waitDisappearance(By.css(ProjectTree.PROJECT_TREE_CONTAINER_CSS), attempts, polling);
}
async waitItem(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitItem(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug(`ProjectTree.waitItem "${itemPath}"`);
const locator: string = await this.getItemCss(itemPath);
@ -125,7 +119,7 @@ export class ProjectTree {
await this.driverHelper.waitDisappearance(By.css(locator), attempts, polling);
}
async clickOnItem(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnItem(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_CLICK_ON_ITEM_TIMEOUT) {
Logger.debug(`ProjectTree.clickOnItem "${itemPath}"`);
const locator: string = await this.getItemCss(itemPath);
@ -133,14 +127,14 @@ export class ProjectTree {
await this.waitItemSelected(itemPath, timeout);
}
async waitItemSelected(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitItemSelected(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_TIMEOUT) {
Logger.debug(`ProjectTree.waitItemSelected "${itemPath}"`);
const selectedItemLocator: By = By.css(`div[title='/projects/${itemPath}'].theia-mod-selected.theia-mod-focus`);
await this.driverHelper.waitVisibility(selectedItemLocator, timeout);
}
async expandItem(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async expandItem(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_CLICK_ON_ITEM_TIMEOUT) {
Logger.debug(`ProjectTree.expandItem "${itemPath}"`);
const locator: string = await this.getExpandIconCssLocator(itemPath);
@ -171,7 +165,7 @@ export class ProjectTree {
}, timeout);
}
async collapseItem(itemPath: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async collapseItem(itemPath: string, timeout: number = TimeoutConstants.TS_PROJECT_TREE_CLICK_ON_ITEM_TIMEOUT) {
Logger.debug(`ProjectTree.collapseItem "${itemPath}"`);
const locator: string = await this.getExpandIconCssLocator(itemPath);
@ -188,7 +182,7 @@ export class ProjectTree {
await this.waitItemCollapsed(itemPath, timeout);
}
async expandPath(path: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async expandPath(path: string, timeout: number = TimeoutConstants.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT) {
Logger.debug(`ProjectTree.expandPath "${path}"`);
let items: Array<string> = path.split('/');
@ -209,48 +203,19 @@ export class ProjectTree {
}
}
async expandPathAndOpenFile(pathToItem: string, fileName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
/**
*
* @param pathToItem path to the file that should be opened
* @param fileName file that should be opened
* @param timeoutForSigleItem timeout applied for every item in path to be opened
*/
async expandPathAndOpenFile(pathToItem: string, fileName: string, timeoutForSigleItem: number = TimeoutConstants.TS_OPEN_EDITOR_TIMEOUT) {
Logger.debug(`ProjectTree.expandPathAndOpenFile "${pathToItem}" filename: ${fileName}`);
await this.expandPath(pathToItem, timeout);
await this.clickOnItem(`${pathToItem}/${fileName}`, timeout);
await this.expandPath(pathToItem, timeoutForSigleItem);
await this.clickOnItem(`${pathToItem}/${fileName}`, timeoutForSigleItem);
await this.editor.waitEditorOpened(fileName, timeout);
await this.editor.waitTab(fileName);
}
async expandPathAndOpenFileInAssociatedWorkspace(pathToItem: string, fileName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`ProjectTree.expandPathAndOpenFileInAssociatedWorkspace "${pathToItem}"`);
let projectName: string = pathToItem.split('/')[0];
let pathEntry = `${projectName}`;
let pathToItemInAssociatedWorkspace = pathToItem.replace(`${projectName}/`, '');
let paths: Array<string> = new Array();
// if we in the root of project
if (pathToItem.split('/').length < 2) {
Logger.trace(`ProjectTree.expandPathAndOpenFileInAssociatedWorkspace has no subpaths, expanding root folder "${projectName}"`);
await this.expandItem(projectName);
Logger.trace(`ProjectTree.expandPathAndOpenFileInAssociatedWorkspace clicking on file "${projectName}/${fileName}"`);
await this.clickOnItem(`${projectName}/${fileName}`, timeout);
return;
}
// make direct path for each project tree item
pathToItemInAssociatedWorkspace.split('/')
.forEach(item => {
pathEntry = pathEntry + `/${item}`;
paths.push(pathEntry);
});
// expand each project tree item
for (const path of paths) {
await this.expandItem(path, timeout);
}
// open file
await this.clickOnItem(`${projectName}/${pathToItemInAssociatedWorkspace}/${fileName}`, timeout);
// check file appearance in the editor
await this.editor.waitEditorOpened(fileName, timeout);
await this.editor.waitEditorOpened(fileName);
await this.editor.waitTab(fileName);
}
@ -334,7 +299,7 @@ export class ProjectTree {
private async getWorkspacePathEntry(): Promise<string> {
const nodeAttribute: string = 'data-node-id';
const splitDelimeter = ':';
const attribute: string = await this.driverHelper.waitAndGetElementAttribute(By.css(`div[${nodeAttribute}]`), nodeAttribute);
const attribute: string = await this.driverHelper.waitAndGetElementAttribute(By.css(`div[${nodeAttribute}]`), nodeAttribute, TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
return attribute.split(splitDelimeter)[0] + splitDelimeter;
}

View File

@ -1,9 +1,9 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
@ -19,7 +19,7 @@ import { Logger } from '../../utils/Logger';
export class QuickOpenContainer {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
public async waitContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitContainer(timeout: number = TimeoutConstants.TS_SELENIUM_TOP_MENU_QUICK_CONTAINER_TIMEOUT) {
Logger.debug('QuickOpenContainer.waitContainer');
const monacoQuickOpenContainerLocator: By = By.xpath('//div[@class=\'monaco-quick-open-widget\']');
@ -33,7 +33,7 @@ export class QuickOpenContainer {
await this.driverHelper.waitDisappearance(monacoQuickOpenContainerLocator);
}
public async clickOnContainerItem(itemText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clickOnContainerItem(itemText: string, timeout: number = TimeoutConstants.TS_SELENIUM_TOP_MENU_QUICK_CONTAINER_TIMEOUT) {
Logger.debug(`QuickOpenContainer.clickOnContainerItem "${itemText}"`);
const quickContainerItemLocator: By = By.css(`div[aria-label="${itemText}, picker"]`);

View File

@ -11,23 +11,23 @@ import { injectable, inject } from 'inversify';
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';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class Terminal {
private static readonly TERMINAL_ROWS_XPATH_LOCATOR_PREFFIX = '(//div[contains(@class, \'terminal-container\')]//div[contains(@class, \'terminal\')]//div[contains(@class, \'xterm-rows\')])';
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTab(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_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) {
async waitTabAbsence(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.waitTabAbsence "${tabTitle}"`);
const terminalTabLocator: By = By.css(this.getTerminalTabCssLocator(tabTitle));
@ -35,7 +35,7 @@ export class Terminal {
await this.driverHelper.waitDisappearanceWithTimeout(terminalTabLocator, timeout);
}
async clickOnTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.clickOnTab "${tabTitle}"`);
const terminalTabLocator: By = By.css(this.getTerminalTabCssLocator(tabTitle));
@ -43,7 +43,7 @@ export class Terminal {
await this, this.driverHelper.waitAndClick(terminalTabLocator, timeout);
}
async waitTabFocused(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitTabFocused(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.waitTabFocused "${tabTitle}"`);
const focusedTerminalTabLocator: By = this.getFocusedTerminalTabLocator(tabTitle);
@ -51,14 +51,14 @@ export class Terminal {
await this.driverHelper.waitVisibility(focusedTerminalTabLocator, timeout);
}
async selectTerminalTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectTerminalTab(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_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) {
async clickOnTabCloseIcon(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.clickOnTabCloseIcon "${tabTitle}"`);
const terminalTabCloseIconLocator: By =
@ -67,7 +67,7 @@ export class Terminal {
await this.driverHelper.waitAndClick(terminalTabCloseIconLocator, timeout);
}
async closeTerminalTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async closeTerminalTab(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.closeTerminalTab "${tabTitle}"`);
await this.clickOnTabCloseIcon(tabTitle, timeout);
@ -83,14 +83,14 @@ export class Terminal {
await this.driverHelper.typeToInvisible(terminalInteractionContainer, text);
}
async rejectTerminalProcess(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async rejectTerminalProcess(tabTitle: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.rejectTerminalProcess "${tabTitle}"`);
await this.selectTerminalTab(tabTitle, timeout);
await this.type(tabTitle, Key.chord(Key.CONTROL, 'c'));
}
async getText(terminalTab: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
async getText(terminalTab: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT): Promise<string> {
Logger.debug(`Terminal.getText tab: ${terminalTab}`);
const terminalIndex: number = await this.getTerminalIndex(terminalTab);
@ -98,7 +98,7 @@ export class Terminal {
return await this.driverHelper.waitAndGetText(By.xpath(Terminal.TERMINAL_ROWS_XPATH_LOCATOR_PREFFIX + `[${terminalIndex}]`), timeout);
}
async selectTabByPrefixAndWaitText(terminalTab: string, expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async selectTabByPrefixAndWaitText(terminalTab: string, expectedText: string, timeout: number = TimeoutConstants.TS_SELENIUM_TERMINAL_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.selectTabByPrefixAndWaitText tab: ${terminalTab} text: ${expectedText}`);
const terminalTabLocatorWithPreffix: string = `//li[contains(@title, '${terminalTab}')]`;
@ -112,7 +112,7 @@ export class Terminal {
}, timeout);
}
async waitText(terminalTab: string, expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
async waitText(terminalTab: string, expectedText: string, timeout: number) {
Logger.debug(`Terminal.waitText tab: ${terminalTab} text: ${expectedText}`);
await this.selectTerminalTab(terminalTab, timeout);

View File

@ -1,11 +1,11 @@
import { injectable, inject } from 'inversify';
import { CLASSES } from '../../inversify.types';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { By, error } from 'selenium-webdriver';
import { Ide } from './Ide';
import { Logger } from '../../utils/Logger';
import { QuickOpenContainer } from './QuickOpenContainer';
import { TimeoutConstants } from '../../TimeoutConstants';
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
@ -25,7 +25,7 @@ export class TopMenu {
@inject(CLASSES.Ide) private readonly ide: Ide,
@inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer) { }
public async waitTopMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitTopMenu(timeout: number = TimeoutConstants.TS_SELENIUM_TOOLBAR_TIMEOUT) {
Logger.debug('TopMenu.waitTopMenu');
for (const buttonText of TopMenu.TOP_MENU_BUTTONS) {
@ -41,7 +41,7 @@ export class TopMenu {
await this.clickOnSubmenuItem(submenuItemtext);
}
public async clickOnTopMenuButton(buttonText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clickOnTopMenuButton(buttonText: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`TopMenu.clickOnTopMenuButton "${buttonText}"`);
const buttonLocator: By = this.getTopMenuButtonLocator(buttonText);
@ -50,7 +50,7 @@ export class TopMenu {
await this.driverHelper.waitAndClick(buttonLocator, timeout);
}
public async clickOnSubmenuItem(itemText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clickOnSubmenuItem(itemText: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.debug(`TopMenu.clickOnSubmenuItem "${itemText}"`);
const submenuItemLocator: By = this.getSubmenuItemLocator(itemText);

View File

@ -10,13 +10,12 @@
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) {
async login() {
Logger.debug('SingleUserLoginPage.login');
// do nothing

View File

@ -13,6 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper';
import { CLASSES } from '../../inversify.types';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class CheLoginPage {
@ -23,7 +24,7 @@ export class CheLoginPage {
async waitEclipseCheLoginFormPage() {
Logger.debug('CheLoginPage.waitEclipseCheLoginFormPage');
await this.driverHelper.waitVisibility(By.id('kc-form-login'));
await this.driverHelper.waitVisibility(By.id('kc-form-login'), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async inputUserNameEclipseCheLoginPage(userName: string) {
@ -53,7 +54,7 @@ export class CheLoginPage {
async waitFirstBrokerLoginPage() {
Logger.debug('CheLoginPage.waitFirstBrokerLoginPage');
await this.driverHelper.waitVisibility(By.id('kc-update-profile-form'));
await this.driverHelper.waitVisibility(By.id('kc-update-profile-form'), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async enterEmailFirstBrokerLoginPage(email: string) {

View File

@ -14,6 +14,7 @@ import { CLASSES } from '../../inversify.types';
import { By } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class OcpLoginPage {
@ -32,7 +33,7 @@ export class OcpLoginPage {
async waitOpenShiftLoginWelcomePage() {
Logger.debug('OcpLoginPage.waitOpenShiftLoginWelcomePage');
await this.driverHelper.waitVisibility(By.xpath(OcpLoginPage.LOGIN_PAGE_OPENSHIFT_XPATH));
await this.driverHelper.waitVisibility(By.xpath(OcpLoginPage.LOGIN_PAGE_OPENSHIFT_XPATH), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnLoginProviderTitle() {
@ -60,7 +61,7 @@ export class OcpLoginPage {
Logger.debug('OcpLoginPage.waitAuthorizeOpenShiftIdentityProviderPage');
const authorizeOpenshiftIdentityProviderPageLocator: By = By.xpath('//h1[text()=\'Authorize Access\']');
await this.driverHelper.waitVisibility(authorizeOpenshiftIdentityProviderPageLocator);
await this.driverHelper.waitVisibility(authorizeOpenshiftIdentityProviderPageLocator, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnApproveAuthorizeAccessButton() {

View File

@ -14,6 +14,7 @@ import { CLASSES } from '../../inversify.types';
import { TestConstants } from '../../TestConstants';
import { By, Key } from 'selenium-webdriver';
import { Logger } from '../../utils/Logger';
import { TimeoutConstants } from '../../TimeoutConstants';
@injectable()
export class OcpWebConsolePage {
@ -28,13 +29,7 @@ export class OcpWebConsolePage {
async waitNavpanelOpenShift() {
Logger.debug('OcpWebConsolePage.waitNavpanelOpenShift');
await this.driverHelper.waitVisibility(By.css(OcpWebConsolePage.NAV_PANEL_OPENSHIFT_CSS));
}
async waitDisappearanceNavpanelOpenShift() {
Logger.debug('OcpWebConsolePage.waitDisappearanceNavpanelOpenShift');
await this.driverHelper.waitDisappearanceWithTimeout(By.css(OcpWebConsolePage.NAV_PANEL_OPENSHIFT_CSS));
await this.driverHelper.waitVisibility(By.css(OcpWebConsolePage.NAV_PANEL_OPENSHIFT_CSS), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async openOperatorHubMainPageByUrl(url: string) {
@ -47,14 +42,14 @@ export class OcpWebConsolePage {
Logger.debug('OcpWebConsolePage.waitOperatorHubMainPage');
const catalogOperatorHubPageLocator: By = By.xpath('//span[text()=\'OperatorHub\']');
await this.driverHelper.waitVisibility(catalogOperatorHubPageLocator);
await this.driverHelper.waitVisibility(catalogOperatorHubPageLocator, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnCatalogOperatorIcon() {
Logger.debug('OcpWebConsolePage.clickOnCatalogOperatorIcon');
const catalogTileOperatorNameLocator: By = By.css(`a[data-test^=${TestConstants.TS_SELENIUM_CATALOG_TILE_OPERATOR_NAME}]`);
await this.driverHelper.waitAndClick(catalogTileOperatorNameLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await this.driverHelper.waitAndClick(catalogTileOperatorNameLocator, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnInstallButton() {
Logger.debug('OcpWebConsolePage.clickOnInstallButton');
@ -67,14 +62,14 @@ export class OcpWebConsolePage {
Logger.debug('OcpWebConsolePage.waitCreateOperatorSubscriptionPage');
const createOperatorSubscriptionPageLocator: By = By.xpath('//h1[text()=\'Create Operator Subscription\']');
await this.driverHelper.waitVisibility(createOperatorSubscriptionPageLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await this.driverHelper.waitVisibility(createOperatorSubscriptionPageLocator, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async selectUpdateChannelOnSubscriptionPage() {
Logger.debug('OcpWebConsolePage.selectUpdateChannelOnSubscriptionPage');
const updateChannelOperatorLocator: By = By.css(`input[value=${TestConstants.TS_OCP_OPERATOR_UPDATE_CHANNEL}]`);
await this.driverHelper.waitAndClick(updateChannelOperatorLocator, TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await this.driverHelper.waitAndClick(updateChannelOperatorLocator, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnDropdownNamespaceListOnSubscriptionPage() {
@ -88,7 +83,7 @@ export class OcpWebConsolePage {
Logger.debug('OcpWebConsolePage.waitListBoxNamespacesOnSubscriptionPage');
const listBoxNamespaceLocator: By = By.css('ul[class^=dropdown-menu]');
await this.driverHelper.waitVisibility(listBoxNamespaceLocator);
await this.driverHelper.waitVisibility(listBoxNamespaceLocator, TimeoutConstants.TS_SELENIUM_LIST_NAMESPACES_ON_SUBSCRIPTION_TIMEOUT);
}
async selectDefinedNamespaceOnSubscriptionPage() {
@ -116,7 +111,7 @@ export class OcpWebConsolePage {
async waitInstalledOperatorLogoName() {
Logger.debug('OcpWebConsolePage.waitInstalledOperatorLogoName');
await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.OPERATOR_LOGO_NAME_XPATH), TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.OPERATOR_LOGO_NAME_XPATH), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}
async clickOnInstalledOperatorLogoName() {
@ -128,7 +123,7 @@ export class OcpWebConsolePage {
async waitOverviewCsvOperator() {
Logger.debug('OcpWebConsolePage.waitOverviewCsvEclipseCheOperator');
await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.OPERATOR_LOGO_NAME_XPATH));
await this.driverHelper.waitVisibility(By.xpath(OcpWebConsolePage.OPERATOR_LOGO_NAME_XPATH), TimeoutConstants.TS_SELENIUM_CSV_OPERATOR_TIMEOUT);
}
async clickCreateNewCheClusterLink() {
@ -138,13 +133,15 @@ export class OcpWebConsolePage {
await this.driverHelper.waitAndClick(createNewCheLusterLinkLocator);
}
async waitCreateCheClusterYaml() {
async waitCreateCheClusterYaml(timeout: number = TimeoutConstants.TS_CREATE_CHECLUSTER_YAML_TIMEOUT) {
Logger.debug('OcpWebConsolePage.waitCreateCheClusterYaml');
const headerTextCheClusterLocator: By = By.xpath('//h1[contains(text(), \'Cluster\')]');
const createCheClusterYamlLocator: By = By.css('div[class=yaml-editor]');
await this.driverHelper.waitVisibility(headerTextCheClusterLocator);
await this.driverHelper.waitVisibility(createCheClusterYamlLocator);
await this.driverHelper.waitVisibility(headerTextCheClusterLocator, timeout);
await this.driverHelper.waitVisibility(createCheClusterYamlLocator, timeout);
}
async openEditorReplaceWidget() {
@ -173,7 +170,7 @@ export class OcpWebConsolePage {
Logger.debug('OcpWebConsolePage.waitResourcesCheClusterTitle');
const resourcesCheClusterTitleLocator: By = By.xpath('//*[contains(text(), \'Clusters\')]');
await this.driverHelper.waitVisibility(resourcesCheClusterTitleLocator);
await this.driverHelper.waitVisibility(resourcesCheClusterTitleLocator, TimeoutConstants.TS_SELENIUM_RESOURCES_CHE_CLUSTER_TITLE_TIMEOUT);
}
async clickOnCheClusterResourcesName() {
@ -187,14 +184,14 @@ export class OcpWebConsolePage {
Logger.debug('OcpWebConsolePage.waitKeycloakAdminConsoleUrl');
const keyCloakAdminWebConsoleUrl: By = By.partialLinkText(`keycloak-${TestConstants.TS_SELENIUM_INSTALL_PROJECT_NAME}`);
await this.driverHelper.waitVisibility(keyCloakAdminWebConsoleUrl, TestConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT);
await this.driverHelper.waitVisibility(keyCloakAdminWebConsoleUrl, TimeoutConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT);
}
async waitInstalledAppUrl() {
Logger.debug('OcpWebConsolePage.waitInstalledAppUrl');
const installedAppUrlLocator: By = By.partialLinkText(`${OcpWebConsolePage.INSTALLED_APP_URL_XPATH}`);
await this.driverHelper.waitVisibility(installedAppUrlLocator, TestConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT);
await this.driverHelper.waitVisibility(installedAppUrlLocator, TimeoutConstants.TS_SELENIUM_INSTALL_ECLIPSE_CHE_TIMEOUT);
}
async logoutFromWebConsole() {
@ -204,7 +201,7 @@ export class OcpWebConsolePage {
const dropdownMenuLocator: By = By.css('*[role=menu]');
const dropdownMenuItemLocator: By = By.xpath('//a[text()=\'Log out\']');
await this.driverHelper.waitAndClick(userDropdownLocator);
await this.driverHelper.waitVisibility(dropdownMenuLocator);
await this.driverHelper.waitVisibility(dropdownMenuLocator, TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
await this.driverHelper.waitAndClick(dropdownMenuItemLocator);
}

View File

@ -117,7 +117,7 @@ suite('Openshift connector user story', async () => {
await quickOpenContainer.clickOnContainerItem(TestConstants.TS_TEST_OPENSHIFT_PLUGIN_PROJECT);
await quickOpenContainer.clickOnContainerItem('node-js-app');
await quickOpenContainer.clickOnContainerItem('component-node-js');
await terminal.selectTabByPrefixAndWaitText('OpenShift: Push', 'Changes successfully pushed to component', TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await terminal.selectTabByPrefixAndWaitText('OpenShift: Push', 'Changes successfully pushed to component', 30_000);
});
});

View File

@ -25,6 +25,7 @@ import { Terminal } from '../../pageobjects/ide/Terminal';
import { ICheLoginPage } from '../../pageobjects/login/ICheLoginPage';
import * as fs from 'fs';
import { ContextMenu } from '../../pageobjects/ide/ContextMenu';
import * as projectAndFileTests from '../../testsLibrary/ProjectAndFileTests';
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const ide: Ide = e2eContainer.get(CLASSES.Ide);
@ -38,11 +39,12 @@ const terminal: Terminal = e2eContainer.get(CLASSES.Terminal);
const debugView: DebugView = e2eContainer.get(CLASSES.DebugView);
const warningDialog: DialogWindow = e2eContainer.get(CLASSES.DialogWindow);
const projectName: string = 'petclinic';
const workspaceRootFolderName: string = 'src';
const namespace: string = TestConstants.TS_SELENIUM_USERNAME;
const workspaceName: string = TestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME;
const workspaceUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/dashboard/#/ide/${namespace}/${workspaceName}`;
const pathToJavaFolder: string = `${projectName}/src/main/java/org/springframework/samples/petclinic`;
const pathToChangedJavaFileFolder: string = `${projectName}/src/main/java/org/springframework/samples/petclinic/system`;
const pathToJavaFolder: string = `${projectName}/${workspaceRootFolderName}/main/java/org/springframework/samples/petclinic`;
const pathToChangedJavaFileFolder: string = `${projectName}/${workspaceRootFolderName}/main/java/org/springframework/samples/petclinic/system`;
const classPathFilename: string = '.classpath';
const javaFileName: string = 'PetClinicApplication.java';
const weclomeControllerJavaFileName: string = 'WelcomeController.java';
@ -68,15 +70,7 @@ suite('Validation of workspace start', async () => {
await loginPage.login();
});
test('Wait workspace running state', async () => {
await ide.waitWorkspaceAndIde();
});
test('Wait until project is imported', async () => {
await projectTree.openProjectTreeContainer(10_000);
await projectTree.waitProjectImported(projectName, 'src');
});
await projectAndFileTests.waitWorkspaceReadiness(projectName, workspaceRootFolderName);
});
suite('Language server validation', async () => {
@ -203,16 +197,6 @@ suite('Display source code changes in the running application', async () => {
await projectTree.collapseProjectTree(projectName + '/src', 'main');
await projectTree.expandPathAndOpenFile(projectName, 'result-build.txt', 300_000);
await editor.waitText('result-build.txt', '[INFO] BUILD SUCCESS');
// workaround for issue: https://github.com/eclipse/che/issues/14771
/*await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'build.txt');
await editor.waitEditorAvailable('build.txt');
await editor.clickOnTab('build.txt');
await editor.waitTabFocused('build.txt');
await editor.followAndWaitForText('build.txt', '[INFO] BUILD SUCCESS', 300000, 5000);*/
});
test('Run application with changes', async () => {
@ -288,14 +272,14 @@ async function checkErrorMessageInApplicationController() {
await previewWidget.waitAndClick(SpringAppLocators.springErrorButtonLocator);
try {
await previewWidget.waitVisibility(SpringAppLocators.springErrorMessageLocator);
await previewWidget.waitVisibility(SpringAppLocators.springErrorMessageLocator, 15_000);
} catch (err) {
await driverHelper.getDriver().switchTo().defaultContent();
await ide.waitAndSwitchToIdeFrame();
await previewWidget.waitAndSwitchToWidgetFrame();
await previewWidget.waitVisibility(SpringAppLocators.springErrorMessageLocator);
await previewWidget.waitVisibility(SpringAppLocators.springErrorMessageLocator, 15_000);
}

View File

@ -28,14 +28,14 @@ export function runTask(taskName: string, timeout: number) {
export function runTaskWithDialogShellAndOpenLink(taskName: string, expectedDialogText: string, timeout: number) {
test(`Run command '${taskName}' expecting dialog shell`, async () => {
await topMenu.runTask(taskName);
await dialogWindow.waitDialogAndOpenLink(timeout, expectedDialogText);
await dialogWindow.waitDialogAndOpenLink(expectedDialogText, timeout);
});
}
export function runTaskWithDialogShellDjangoWorkaround(taskName: string, expectedDialogText: string, urlSubPath: string, timeout: number) {
test(`Run command '${taskName}' expecting dialog shell`, async () => {
await topMenu.runTask(taskName);
await dialogWindow.waitDialog(timeout, expectedDialogText);
await dialogWindow.waitDialog(expectedDialogText, timeout);
const dialogRedirectUrl: string = await dialogWindow.getApplicationUrlFromDialog(expectedDialogText);
const augmentedPreviewUrl: string = dialogRedirectUrl + urlSubPath;
await dialogWindow.closeDialog();
@ -52,7 +52,7 @@ export function runTaskWithDialogShellDjangoWorkaround(taskName: string, expecte
export function runTaskWithDialogShellAndClose(taskName: string, expectedDialogText: string, timeout: number) {
test(`Run command '${taskName}' expecting dialog shell`, async () => {
await topMenu.runTask(taskName);
await dialogWindow.waitDialog(timeout, expectedDialogText);
await dialogWindow.waitDialog(expectedDialogText, timeout);
await dialogWindow.closeDialog();
await dialogWindow.waitDialogDissappearance();
});

View File

@ -45,7 +45,7 @@ const ide: Ide = e2eContainer.get(CLASSES.Ide);
await editor.waitTabFocused(openedTab);
await editor.moveCursorToLineAndChar(openedTab, line, char);
await editor.pressControlSpaceCombination(openedTab);
await editor.waitSuggestionWithScrolling(openedTab, suggestionText);
await editor.waitSuggestion(openedTab, suggestionText);
});
}

View File

@ -39,7 +39,6 @@ export function waitWorkspaceReadinessNoSubfolder(sampleName : string) {
export function openFile(filePath: string, fileName: string) {
test('Expand project and open file in editor', async () => {
await projectTree.expandPathAndOpenFileInAssociatedWorkspace(filePath, fileName);
await projectTree.expandPathAndOpenFile(filePath, fileName);
await editor.selectTab(fileName);
});

View File

@ -15,6 +15,7 @@ import 'reflect-metadata';
import { ThenableWebDriver, By, until, WebElement } from 'selenium-webdriver';
import { TestConstants } from '../TestConstants';
import { Logger } from './Logger';
import { TimeoutConstants } from '../TimeoutConstants';
@injectable()
@ -87,7 +88,7 @@ export class DriverHelper {
return false;
}
public async waitVisibility(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<WebElement> {
public async waitVisibility(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -145,7 +146,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum visibility checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
}
public async waitPresence(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<WebElement> {
public async waitPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -174,7 +175,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
}
public async waitAllPresence(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<Array<WebElement>> {
public async waitAllPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<Array<WebElement>> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -203,7 +204,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
}
public async waitAllVisibility(locators: Array<By>, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitAllVisibility(locators: Array<By>, timeout: number) {
Logger.trace(`DriverHelper.waitAllVisibility ${locators}`);
for (const elementLocator of locators) {
@ -224,7 +225,7 @@ export class DriverHelper {
}
}
public async waitDisappearanceWithTimeout(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitDisappearanceWithTimeout(elementLocator: By, timeout: number) {
Logger.trace(`DriverHelper.waitDisappearanceWithTimeout ${elementLocator}`);
await this.getDriver().wait(async () => {
@ -247,7 +248,7 @@ export class DriverHelper {
}
}
public async waitAndClick(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -292,7 +293,7 @@ export class DriverHelper {
}
public async waitAndGetElementAttribute(elementLocator: By, attribute: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -335,7 +336,7 @@ export class DriverHelper {
}
public async waitAndGetCssValue(elementLocator: By, cssAttribute: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -380,7 +381,7 @@ export class DriverHelper {
public async waitAttributeValue(elementLocator: By,
attribute: string,
expectedValue: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
timeout: number) {
Logger.trace(`DriverHelper.waitAttributeValue ${elementLocator}`);
@ -393,7 +394,7 @@ export class DriverHelper {
`The '${attribute}' attribute value doesn't match with expected value '${expectedValue}'`);
}
public async type(elementLocator: By, text: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async type(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -435,7 +436,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
}
public async typeToInvisible(elementLocator: By, text: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async typeToInvisible(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -477,7 +478,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
}
public async clear(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clear(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -519,7 +520,7 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
}
public async clearInvisible(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async clearInvisible(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -561,23 +562,23 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
}
public async enterValue(elementLocator: By, text: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async enterValue(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
Logger.trace(`DriverHelper.enterValue ${elementLocator} text: ${text}`);
await this.waitVisibility(elementLocator, timeout);
await this.clear(elementLocator, timeout);
await this.clear(elementLocator);
await this.waitAttributeValue(elementLocator, 'value', '', timeout);
await this.type(elementLocator, text, timeout);
await this.waitAttributeValue(elementLocator, 'value', text, timeout);
}
public async waitAndSwitchToFrame(iframeLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitAndSwitchToFrame(iframeLocator: By, timeout: number) {
Logger.trace(`DriverHelper.waitAndSwitchToFrame ${iframeLocator}`);
await this.driver.wait(until.ableToSwitchToFrame(iframeLocator), timeout);
}
public async waitAndGetText(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
public async waitAndGetText(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -619,14 +620,14 @@ export class DriverHelper {
throw new error.TimeoutError(`Exceeded maximum text obtaining attempts, from the '${elementLocator}' element`);
}
public async waitAndGetValue(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT): Promise<string> {
public async waitAndGetValue(elementLocator: By, timeout: number): Promise<string> {
Logger.trace(`DriverHelper.waitAndGetValue ${elementLocator}`);
const elementValue: string = await this.waitAndGetElementAttribute(elementLocator, 'value', timeout);
return elementValue;
}
public async waitUntilTrue(callback: any, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitUntilTrue(callback: any, timeout: number) {
Logger.trace('DriverHelper.waitUntilTrue');
await this.driver.wait(callback, timeout);
@ -638,11 +639,11 @@ export class DriverHelper {
await this.driver.navigate().refresh();
}
public async navigateAndWaitToUrl(url: string) {
public async navigateAndWaitToUrl(url: string, timeout: number = TimeoutConstants.TS_SELENIUM_WAIT_FOR_URL) {
Logger.trace(`DriverHelper.navigateAndWaitToUrl ${url}`);
await this.navigateToUrl(url);
await this.waitURL(url);
await this.waitURL(url, timeout);
}
public async navigateToUrl(url: string) {
@ -651,7 +652,7 @@ export class DriverHelper {
await this.driver.navigate().to(url);
}
public async waitURL(expectedUrl: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async waitURL(expectedUrl: string, timeout: number) {
Logger.trace(`DriverHelper.waitURL ${expectedUrl}`);
await this.getDriver().wait(async () => {
@ -664,7 +665,7 @@ export class DriverHelper {
}, timeout);
}
public async scrollTo(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
public async scrollTo(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
const attempts: number = Math.ceil(timeout / polling);
@ -715,25 +716,4 @@ export class DriverHelper {
return this.driver;
}
async waitOpenningSecondWindow(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.trace('DriverHelper.waitOpenningSecondWindow');
await this.driver.wait(async () => {
const handles: string[] = await this.driver.getAllWindowHandles();
if (handles.length > 1) {
return true;
}
}, timeout);
}
async switchToSecondWindow(mainWindowHandle: string) {
Logger.debug('DriverHelper.switchToSecondWindow');
await this.waitOpenningSecondWindow();
const handles: string[] = await this.driver.getAllWindowHandles();
handles.splice(handles.indexOf(mainWindowHandle), 1);
await this.driver.switchTo().window(handles[0]);
}
}