diff --git a/tests/e2e/TestConstants.ts b/tests/e2e/TestConstants.ts index 5e8579f3cc2b..6ec614434059 100644 --- a/tests/e2e/TestConstants.ts +++ b/tests/e2e/TestConstants.ts @@ -17,6 +17,11 @@ function getBaseUrl(): string { return baseUrl.replace(/\/$/, ''); } +export enum EditorType { + THEIA = 'theia', + VSCODE = 'code' +} + export const TestConstants = { /** * Base URL of the application which should be checked @@ -58,7 +63,19 @@ export const TestConstants = { * Editor the tests are running against, "code" by default. * Possible values: "code", "theia" */ - TS_SELENIUM_EDITOR: process.env.TS_SELENIUM_EDITOR || 'code', + TS_SELENIUM_EDITOR: process.env.TS_SELENIUM_EDITOR || EditorType.VSCODE, + + /** + * Base version of VSCode editor for monaco-page-objects, "1.37.0" by default. + */ + TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION: process.env.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION || '1.37.0', + + /** + * Latest compatible version to be used, based on versions available in + * https://github.com/redhat-developer/vscode-extension-tester/tree/master/locators/lib , + * "1.73.0" by default. + */ + TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION: process.env.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION || '1.73.0', /** * Default ammount of tries, "5" by default. diff --git a/tests/e2e/driver/CheReporter.ts b/tests/e2e/driver/CheReporter.ts index 6359e74bb79f..bc0a850f7e6b 100644 --- a/tests/e2e/driver/CheReporter.ts +++ b/tests/e2e/driver/CheReporter.ts @@ -13,7 +13,7 @@ import { inversifyConfig } from '..'; import { TYPES, CLASSES } from '..'; import * as fs from 'fs'; import * as rm from 'rimraf'; -import { TestConstants } from '../TestConstants'; +import { EditorType, TestConstants } from '../TestConstants'; import { logging } from 'selenium-webdriver'; import { DriverHelper } from '../utils/DriverHelper'; import { ScreenCatcher } from '../utils/ScreenCatcher'; @@ -57,6 +57,8 @@ class CheReporter extends mocha.reporters.Spec { TS_SELENIUM_USERNAME: ${TestConstants.TS_SELENIUM_USERNAME} TS_SELENIUM_PASSWORD: ${TestConstants.TS_SELENIUM_PASSWORD} + TS_SELENIUM_EDITOR: ${TestConstants.TS_SELENIUM_EDITOR} + 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} @@ -88,12 +90,13 @@ class CheReporter extends mocha.reporters.Spec { CheApiRequestHandler.enableResponseInterceptor(); } - if (TestConstants.TS_SELENIUM_EDITOR === 'theia') { + if (TestConstants.TS_SELENIUM_EDITOR === EditorType.THEIA) { let preferencesHandler: PreferencesHandlerTheia = e2eContainer.get(CLASSES.PreferencesHandlerTheia); await preferencesHandler.setConfirmExit(AskForConfirmationTypeTheia.never); await preferencesHandler.setTerminalType(TerminalRendererTypeTheia.dom); - } else if (TestConstants.TS_SELENIUM_EDITOR === 'code') { - monacoPageObjects.initPageObjects('1.71.0', '1.37.0', vscodeExtensionTesterLocators.getLocatorsPath(), driver.get(), 'google-chrome'); + } else if (TestConstants.TS_SELENIUM_EDITOR === EditorType.VSCODE) { + // init vscode-extension-tester monaco-page-objects + monacoPageObjects.initPageObjects(TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION, TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION, vscodeExtensionTesterLocators.getLocatorsPath(), driver.get(), 'google-chrome'); } }); diff --git a/tests/e2e/initDevfileTests.sh b/tests/e2e/initDevfileTests.sh index 79ee18c035ac..066e4951aa2c 100755 --- a/tests/e2e/initDevfileTests.sh +++ b/tests/e2e/initDevfileTests.sh @@ -21,21 +21,11 @@ launchSingleUserstory(){ echo "Launching the \"${USERSTORY}\" userstory"; echo "" - if [ "${TS_SELENIUM_EDITOR}" == "theia" ]; then - tsc && mocha --config mocha-single-devfile.json --spec dist/tests/login/Login.spec.js --spec dist/tests/devfiles/theia/${USERSTORY}.spec.js ; - elif [ "${TS_SELENIUM_EDITOR}" == "code" ]; then - tsc && mocha --config mocha-single-devfile.json --spec dist/tests/login/Login.spec.js --spec dist/tests/devfiles/code/${USERSTORY}.spec.js ; - fi - + tsc && mocha --config mocha-single-devfile.json --spec dist/tests/login/Login.spec.js --spec dist/tests/devfiles/${TS_SELENIUM_EDITOR}/${USERSTORY}.spec.js ; } checkUserstoryName(){ - local checkedName; - if [ "${TS_SELENIUM_EDITOR}" == "theia" ]; then - checkedName="$(ls tests/devfiles/theia | grep ${USERSTORY}.spec.ts)"; - elif [ "${TS_SELENIUM_EDITOR}" == "code" ]; then - checkedName="$(ls tests/devfiles/code | grep ${USERSTORY}.spec.ts)"; - fi + local checkedName="$(ls tests/devfiles/${TS_SELENIUM_EDITOR} | grep ${USERSTORY}.spec.ts)"; if [ -z "$checkedName" ]; then echo "" diff --git a/tests/e2e/initPluginTest.sh b/tests/e2e/initPluginTest.sh index 26b20554a853..882eaabf9f25 100755 --- a/tests/e2e/initPluginTest.sh +++ b/tests/e2e/initPluginTest.sh @@ -6,8 +6,4 @@ echo "" echo "Launching the \"${USERSTORY}\" userstory"; echo "" -if [ "${TS_SELENIUM_EDITOR}" == "theia" ]; then - npm run init-mocha-opts -- --spec dist/tests/plugins/theia/${USERSTORY}.spec.js -elif [ "${TS_SELENIUM_EDITOR}" == "code" ]; then - npm run init-mocha-opts -- --spec dist/tests/plugins/code/${USERSTORY}.spec.js -fi +npm run init-mocha-opts -- --spec dist/tests/plugins/${TS_SELENIUM_EDITOR}/${USERSTORY}.spec.js diff --git a/tests/e2e/mocha-wkspc-creation-and-ls-theia.json b/tests/e2e/mocha-ws-creation-and-ls-theia.json similarity index 100% rename from tests/e2e/mocha-wkspc-creation-and-ls-theia.json rename to tests/e2e/mocha-ws-creation-and-ls-theia.json diff --git a/tests/e2e/package.json b/tests/e2e/package.json index ecfa61453d9a..d88c05271366 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -18,7 +18,7 @@ "load-test-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-load-theia.json", "test-happy-path-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-happy-path-theia.json", "test-devworkspace-happy-path-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-devworkspace-happy-path-theia.json", - "test-wkspc-creation-and-ls-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-wkspc-creation-and-ls-theia.json", + "test-ws-creation-and-ls-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-ws-creation-and-ls-theia.json", "test-java-vertx-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-java-vertx-theia.json", "test-java-springboot-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-java-springboot-theia.json", "test-git-ssh-theia": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-git-ssh-theia.json", diff --git a/tests/e2e/pageobjects/ide/theia/ContextMenu.ts b/tests/e2e/pageobjects/ide/theia/ContextMenu.ts index 87bdfafb6a79..572589056d3a 100644 --- a/tests/e2e/pageobjects/ide/theia/ContextMenu.ts +++ b/tests/e2e/pageobjects/ide/theia/ContextMenu.ts @@ -12,7 +12,7 @@ import 'reflect-metadata'; import { injectable, inject } from 'inversify'; import { DriverHelper } from '../../../utils/DriverHelper'; import { CLASSES } from '../../../inversify.types'; -import { By, Key } from 'selenium-webdriver'; +import { By, Key, WebElement } from 'selenium-webdriver'; import { Logger } from '../../../utils/Logger'; import { TimeoutConstants } from '../../../TimeoutConstants'; @@ -26,8 +26,8 @@ export class ContextMenu { async invokeContextMenuOnTheElementWithMouse(elementLocator: By) { Logger.debug(`ContextMenu.invokeContextMenuOnTheElementWithMouse ${elementLocator}`); - // const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT); - // await this.driverHelper.getAction().click(webElement, Button.RIGHT).perform(); + const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT); + await this.driverHelper.getAction().contextClick(webElement).perform(); this.waitContextMenu(); } diff --git a/tests/e2e/tests/devfiles/code/JavaSpringBoot.spec.ts b/tests/e2e/tests/devfiles/code/JavaSpringBoot.spec.ts index e63b8b14b9f4..a19824d3cea1 100644 --- a/tests/e2e/tests/devfiles/code/JavaSpringBoot.spec.ts +++ b/tests/e2e/tests/devfiles/code/JavaSpringBoot.spec.ts @@ -41,7 +41,7 @@ suite(`${stack} test`, async () => { await dashboard.clickCreateWorkspaceButton(); await createWorkspace.waitPage(); workspaceHandlingTests.setWindowHandle(await browserTabsUtil.getCurrentWindowHandle()); - await createWorkspace.startWorkspaceUsingFactory(`https://github.com/devspaces-samples/rest-http-example/tree/devspaces-3-rhel-8?che-editor=che-incubator/che-code/insiders&storageType=persistent`); + await createWorkspace.startWorkspaceUsingFactory(`https://github.com/che-samples/web-java-spring-boot/tree/master?che-editor=che-incubator/che-code/insiders&storageType=persistent`); await browserTabsUtil.waitAndSwitchToAnotherWindow(workspaceHandlingTests.getWindowHandle(), TimeoutConstants.TS_IDE_LOAD_TIMEOUT); }); workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); @@ -61,8 +61,6 @@ suite(`${stack} test`, async () => { let workbench = new Workbench(); let activityBar = workbench.getActivityBar(); let activityBarControls = await activityBar.getViewControls(); - // let sidebarContent = activityBar.getViewControl(); - // let sidebarViewSections = await sidebarContent.getSections(); Logger.debug(`Editor sections:`); activityBarControls.forEach(async control => { Logger.debug(`${await control.getTitle()}`); diff --git a/tests/e2e/tests/e2e_happy_path/theia/DevWorkspaceHappyPath.spec.ts b/tests/e2e/tests/e2e_happy_path/theia/DevWorkspaceHappyPath.spec.ts index ebff360298cf..fc7a2ae899a1 100644 --- a/tests/e2e/tests/e2e_happy_path/theia/DevWorkspaceHappyPath.spec.ts +++ b/tests/e2e/tests/e2e_happy_path/theia/DevWorkspaceHappyPath.spec.ts @@ -57,8 +57,6 @@ const SpringAppLocators = { suite('Workspace creation via factory url', async () => { let factoryUrl : string = `${TestConstants.TS_SELENIUM_DEVWORKSPACE_URL}`; - // const workspaceRootFolderName: string = 'src'; - suite('Open factory URL', async () => { // this is DevWorkspace test specific - we create the test ws. using factory instead of chectl test(`Navigating to factory URL`, async () => {