diff --git a/tests/e2e/configs/inversify.config.ts b/tests/e2e/configs/inversify.config.ts index 2206ae4a4983..7dce0b5ae32c 100644 --- a/tests/e2e/configs/inversify.config.ts +++ b/tests/e2e/configs/inversify.config.ts @@ -9,7 +9,7 @@ **********************************************************************/ import 'reflect-metadata'; -import { Container, decorate, injectable, unmanaged } from 'inversify'; +import { Container } from 'inversify'; import { IDriver } from '../driver/IDriver'; import { ChromeDriver } from '../driver/ChromeDriver'; import { CLASSES, EXTERNAL_CLASSES, TYPES } from './inversify.types'; @@ -52,12 +52,6 @@ import { Main as Generator } from '@eclipse-che/che-devworkspace-generator/lib/m import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../utils/KubernetesCommandLineToolsExecutor'; import { ShellExecutor } from '../utils/ShellExecutor'; -decorate(injectable(), Generator); -decorate(injectable(), LocatorLoader); -decorate(unmanaged(), LocatorLoader, 0); -decorate(unmanaged(), LocatorLoader, 1); -decorate(unmanaged(), LocatorLoader, 2); - const e2eContainer: Container = new Container({ defaultScope: 'Transient', skipBaseClassChecks: true }); e2eContainer.bind(TYPES.Driver).to(ChromeDriver).inSingletonScope(); diff --git a/tests/e2e/configs/mocharc.ts b/tests/e2e/configs/mocharc.ts index 90a19c3da790..4612df90def1 100644 --- a/tests/e2e/configs/mocharc.ts +++ b/tests/e2e/configs/mocharc.ts @@ -11,6 +11,7 @@ 'use strict'; import { MOCHA_CONSTANTS } from '../constants/MOCHA_CONSTANTS'; +import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS'; /** * full available options list https://mochajs.org/api/mocha @@ -18,6 +19,7 @@ import { MOCHA_CONSTANTS } from '../constants/MOCHA_CONSTANTS'; module.exports = { timeout: MOCHA_CONSTANTS.MOCHA_DEFAULT_TIMEOUT, + slow: 60000, reporter: 'mocha-multi-reporters', reporterOptions: 'configFile=configs/reporters-config.json', ui: 'tdd', @@ -25,13 +27,15 @@ module.exports = { bail: MOCHA_CONSTANTS.MOCHA_BAIL, 'full-trace': true, spec: - // variable MOCHA_DIRECTORY uses in command "test-all-devfiles" and sets up automatically. - // you can set it up to run files from specific directory with export environmental variable. - MOCHA_CONSTANTS.MOCHA_DIRECTORY + BASE_TEST_CONSTANTS.TEST_ENVIRONMENT !== '' + ? `dist/suits/${BASE_TEST_CONSTANTS.ARCH_VERSION}/${BASE_TEST_CONSTANTS.OCP_VERSION}/${MOCHA_CONSTANTS.MOCHA_SUITE}.suite.js` + : // variable MOCHA_DIRECTORY uses in command "test-all-devfiles" and sets up automatically. + // you can set it up to run files from specific directory with export environmental variable. + MOCHA_CONSTANTS.MOCHA_DIRECTORY ? // to run one file (name without extension). uses in "test", "test-all-devfiles". MOCHA_CONSTANTS.MOCHA_USERSTORY ? `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js` - : `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/**.spec.js` + : `dist/specs/${process.env.MOCHA_DIRECTORY}/**.spec.js` : MOCHA_CONSTANTS.MOCHA_USERSTORY ? [`dist/specs/**/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`, `dist/specs/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`] : ['dist/specs/**/**.spec.js', 'dist/specs/**.spec.js'], diff --git a/tests/e2e/configs/sh-scripts/regressionTestRun.sh b/tests/e2e/configs/sh-scripts/regressionTestRun.sh new file mode 100755 index 000000000000..1d0cb90ab9ea --- /dev/null +++ b/tests/e2e/configs/sh-scripts/regressionTestRun.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# shellcheck source=/dev/null + +export ARCH_VERSION="x86_64" + +######################################## +############# Methods ################## +######################################## + +launchAPITests() { + export MOCHA_SUITE="APITest" + echo "MOCHA_SUITE = ${MOCHA_SUITE}" + npm run driver-less-test +} + +launchDynamicAPITests() { + export MOCHA_SUITE="DynamicAPITest" + echo "MOCHA_SUITE = ${MOCHA_SUITE}" + npm run delayed-test +} + +launchUITests() { + export MOCHA_SUITE="UITest" + echo "MOCHA_SUITE = ${MOCHA_SUITE}" + npm run test +} + +launchAllTests() { + echo "" + echo "Launching all tests for $ARCH_VERSION $OCP_VERSION" + echo "" + launchDynamicAPITests + launchAPITests + launchUITests +} + +######################################## +############# Launching ################ +######################################## + +#possible values OCP_VERSION="airgap-ocp-413", "ocp4-12" +export OCP_VERSION="ocp4-13" +echo "suits/$ARCH_VERSION/$OCP_VERSION/$MOCHA_SUITE" +echo "$(<"suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh")" +source "suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh" && +launchAllTests + +export OCP_VERSION="ocp4-12" +echo "suits/$ARCH_VERSION/$OCP_VERSION/$MOCHA_SUITE" +echo "$(<"suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh")" +source "suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh" && +launchAllTests + +export OCP_VERSION="airgap-ocp-413" +echo "suits/$ARCH_VERSION/$OCP_VERSION/$MOCHA_SUITE" +echo "$(<"suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh")" +source "suits/$ARCH_VERSION/$OCP_VERSION/InitEnvironmental.sh" && +launchAllTests diff --git a/tests/e2e/constants/API_TEST_CONSTANTS.ts b/tests/e2e/constants/API_TEST_CONSTANTS.ts index 68279ffcb02f..b2e295bfdf63 100644 --- a/tests/e2e/constants/API_TEST_CONSTANTS.ts +++ b/tests/e2e/constants/API_TEST_CONSTANTS.ts @@ -23,6 +23,7 @@ export const SUPPORTED_DEVFILE_REGISTRIES: { GIT_HUB_CHE_DEVFILE_REGISTRY_URL: 'https://api.github.com/repos/eclipse-che/che-devfile-registry/contents/devfiles/' }; export const API_TEST_CONSTANTS: { + TS_API_TEST_DEV_WORKSPACE_LIST: string | undefined; TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: string; TS_API_TEST_PLUGIN_REGISTRY_URL: string | undefined; TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI: string | undefined; @@ -62,6 +63,8 @@ export const API_TEST_CONSTANTS: { * to run all devfile from registry. used in DevfileAcceptanceTestAPI.suite.ts */ TS_API_ACCEPTANCE_TEST_REGISTRY_URL(): string { - return process.env.TS_API_ACCEPTANCE_TEST_REGISTRY_URL || SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL(); - } + return process.env.TS_API_ACCEPTANCE_TEST_REGISTRY_URL || ''; + }, + + TS_API_TEST_DEV_WORKSPACE_LIST: process.env.TS_API_TEST_DEV_WORKSPACE_LIST || undefined }; diff --git a/tests/e2e/constants/BASE_TEST_CONSTANTS.ts b/tests/e2e/constants/BASE_TEST_CONSTANTS.ts index 5c5029a2d7bf..23330e460817 100644 --- a/tests/e2e/constants/BASE_TEST_CONSTANTS.ts +++ b/tests/e2e/constants/BASE_TEST_CONSTANTS.ts @@ -13,6 +13,9 @@ export enum Platform { } export const BASE_TEST_CONSTANTS: { + OCP_VERSION: string; + ARCH_VERSION: string; + TEST_ENVIRONMENT: string; IS_PRODUCT_DOCUMENTATION_RELEASED: any; TESTING_APPLICATION_VERSION: string; TS_DEBUG_MODE: boolean; @@ -33,6 +36,21 @@ export const BASE_TEST_CONSTANTS: { */ TS_SELENIUM_BASE_URL: !process.env.TS_SELENIUM_BASE_URL ? 'http://sample-url' : process.env.TS_SELENIUM_BASE_URL.replace(/\/$/, ''), + /** + * system arch type + */ + ARCH_VERSION: process.env.ARCH_VERSION || '', + + /** + * openShift version + */ + OCP_VERSION: process.env.OCP_VERSION || '', + + /** + * test environment (used as prefix in suite name) + */ + TEST_ENVIRONMENT: process.env.TEST_ENVIRONMENT || '', + /** * testing application version */ diff --git a/tests/e2e/constants/MOCHA_CONSTANTS.ts b/tests/e2e/constants/MOCHA_CONSTANTS.ts index 1b0986ab16bc..04a0fbc6c703 100644 --- a/tests/e2e/constants/MOCHA_CONSTANTS.ts +++ b/tests/e2e/constants/MOCHA_CONSTANTS.ts @@ -7,8 +7,11 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ +import { BASE_TEST_CONSTANTS } from './BASE_TEST_CONSTANTS'; export const MOCHA_CONSTANTS: { + MOCHA_SUITE: string | undefined; + MOCHA_DELAYED_SUITE: boolean; MOCHA_DEFAULT_TIMEOUT: string | number; MOCHA_DIRECTORY: string | undefined; MOCHA_USERSTORY: undefined | string; @@ -21,7 +24,11 @@ export const MOCHA_CONSTANTS: { MOCHA_BAIL: process.env.MOCHA_BAIL !== 'false', - MOCHA_DEFAULT_TIMEOUT: process.env.MOCHA_DEFAULT_TIMEOUT || 1200000, + MOCHA_DELAYED_SUITE: process.env.MOCHA_DELAYED_SUITE === 'true', - MOCHA_RETRIES: process.env.MOCHA_RETRIES || 3 + MOCHA_DEFAULT_TIMEOUT: process.env.MOCHA_DEFAULT_TIMEOUT || 420000, + + MOCHA_RETRIES: process.env.MOCHA_RETRIES || BASE_TEST_CONSTANTS.TEST_ENVIRONMENT === '' ? 0 : 2, + + MOCHA_SUITE: process.env.MOCHA_SUITE || undefined }; diff --git a/tests/e2e/package.json b/tests/e2e/package.json index 4b1564bd89e4..5e67f497eb3c 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -9,11 +9,13 @@ "tsc": "rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .", "test": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js", "driver-less-test": "export TS_USE_WEB_DRIVER_FOR_TEST=false && npm run test", + "delayed-test": "npm run lint && npm run tsc && export TS_USE_WEB_DRIVER_FOR_TEST=false && export MOCHA_DELAYED_SUITE=true && mocha --config dist/configs/mocharc.js --delay", "open-allure-dasboard": "allure generate .allure-results --clean -o .allure-report && allure open .allure-report", "cleanup-docker": "if [ $(docker ps -a | grep -c selenium-e2e) -gt 0 ]; then docker rm -f $(docker ps --filter \"name=selenium-e2e\" -aq); fi;", "test-docker": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL eclipse/che-e2e:nightly", "test-docker-mount-e2e": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL -v $(pwd):/tmp/e2e:Z eclipse/che-e2e:nightly", "test-all-devfiles": " ./configs/sh-scripts/initDefaultValues.sh && ./configs/sh-scripts/initDevfileTests.sh", + "test-regression": "./configs/sh-scripts/regressionTestRun.sh", "devfile-acceptance-test-suite": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export TS_USE_WEB_DRIVER_FOR_TEST=false && mocha 'dist/specs/api/*.js' --config dist/configs/mocharc.js --delay --grep 'Devfile acceptance test suite'" }, "author": "Ihor Okhrimenko (iokhrime@redhat.com)", diff --git a/tests/e2e/specs/MochaHooks.ts b/tests/e2e/specs/MochaHooks.ts index 2d09426fda14..1e1677885d17 100644 --- a/tests/e2e/specs/MochaHooks.ts +++ b/tests/e2e/specs/MochaHooks.ts @@ -22,6 +22,9 @@ import { allure } from 'allure-mocha/runtime'; import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS'; import { MONACO_CONSTANTS } from '../constants/MONACO_CONSTANTS'; import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS'; +import { decorate, injectable, unmanaged } from 'inversify'; +import { Main } from '@eclipse-che/che-devworkspace-generator/lib/main'; +import { LocatorLoader } from 'monaco-page-objects/out/locators/loader'; const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); let latestWorkspace: string = ''; @@ -34,6 +37,14 @@ export function registerRunningWorkspace(workspaceName: string): void { exports.mochaHooks = { beforeAll: [ + function decorateExternalClasses(): void { + decorate(injectable(), Main); + decorate(injectable(), LocatorLoader); + decorate(unmanaged(), LocatorLoader, 0); + decorate(unmanaged(), LocatorLoader, 1); + decorate(unmanaged(), LocatorLoader, 2); + }, + function enableRequestInterceptor(): void { if (BASE_TEST_CONSTANTS.TS_SELENIUM_REQUEST_INTERCEPTOR) { CheApiRequestHandler.enableRequestInterceptor(); diff --git a/tests/e2e/specs/api/ContainerOverridesAPI.spec.ts b/tests/e2e/specs/api/ContainerOverridesAPI.spec.ts index d3faf1fc3d10..b243c6e71e90 100644 --- a/tests/e2e/specs/api/ContainerOverridesAPI.spec.ts +++ b/tests/e2e/specs/api/ContainerOverridesAPI.spec.ts @@ -15,8 +15,9 @@ import { expect } from 'chai'; import { ShellExecutor } from '../../utils/ShellExecutor'; import { e2eContainer } from '../../configs/inversify.config'; import { CLASSES } from '../../configs/inversify.types'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; -suite('Test defining container overrides via attribute.', function (): void { +suite(`Test defining container overrides via attribute ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const pathToSampleFile: string = path.resolve('resources/container-overrides.yaml'); const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name; const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get( diff --git a/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts b/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts index 8066e0e3fe7f..405ce4499f07 100644 --- a/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts +++ b/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts @@ -16,21 +16,23 @@ import { StringUtil } from '../../utils/StringUtil'; import { Logger } from '../../utils/Logger'; import { e2eContainer } from '../../configs/inversify.config'; import { CLASSES } from '../../configs/inversify.types'; +import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper'; +import { MOCHA_CONSTANTS } from '../../constants/MOCHA_CONSTANTS'; +import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS'; /** * dynamically generating tests * info: https://mochajs.org/#delayed-root-suite */ -// todo: skipped while don`t use to avoid sending useless requests -// eslint-disable-next-line @typescript-eslint/require-await void (async function (): Promise { - // const devfilesRegistryHelper: DevfilesRegistryHelper = e2eContainer.get(CLASSES.DevfilesRegistryHelper); - - const devfileSamples: any = []; - // devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry(); + const devfilesRegistryHelper: DevfilesRegistryHelper = e2eContainer.get(CLASSES.DevfilesRegistryHelper); + let devfileSamples: any = []; + if (MOCHA_CONSTANTS.MOCHA_DELAYED_SUITE && API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) { + devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry(false); + } for (const devfileSample of devfileSamples) { - suite.skip(`Devfile acceptance test suite for ${devfileSample.name}`, function (): void { + suite(`Devfile acceptance test suite for ${devfileSample.name}`, function (): void { this.bail(false); this.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper; @@ -105,7 +107,7 @@ void (async function (): Promise { ); Logger.info(`Full build command to be executed: ${commandString}`); - const output: ShellString = containerTerminal.executeCommand(commandString, command.exec.component); + const output: ShellString = containerTerminal.execInContainerCommand(commandString, command.exec.component); expect(output.code).eqls(0); }); } diff --git a/tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts b/tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts index 1ccff56e2c00..a3ee0d27bce6 100644 --- a/tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts +++ b/tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts @@ -31,7 +31,7 @@ suite('Empty workspace API test', function (): void { const gitRepository: string = 'https://github.com/crw-qe/web-nodejs-sample'; - suiteSetup('Create empty workspace with OC client', async function (): Promise { + suiteSetup(`Create empty workspace with OC client ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, async function (): Promise { const workspaceName: string = 'empty-' + Math.floor(Math.random() * 1000); const devfileContent: string = 'schemaVersion: 2.2.0\n' + 'metadata:\n' + ` name: ${workspaceName}\n`; @@ -54,7 +54,7 @@ suite('Empty workspace API test', function (): void { expect(output.stdout).contains('condition met'); }); - suite('Clone public repo without previous setup', function (): void { + suite(`Clone public repo without previous setup ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { test('Check if public repo can be cloned', function (): void { containerWorkDir = containerTerminal.pwd().stdout.replace('\n', ''); const cloneOutput: ShellString = containerTerminal.gitClone(gitRepository); diff --git a/tests/e2e/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.ts b/tests/e2e/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.ts new file mode 100644 index 000000000000..abb8342971ca --- /dev/null +++ b/tests/e2e/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.ts @@ -0,0 +1,130 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor'; +import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper'; +import { ShellString } from 'shelljs'; +import { expect } from 'chai'; +import { StringUtil } from '../../utils/StringUtil'; +import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper'; +import { Logger } from '../../utils/Logger'; +import { e2eContainer } from '../../configs/inversify.config'; +import { CLASSES } from '../../configs/inversify.types'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; +import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS'; +import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS'; +import { MOCHA_CONSTANTS } from '../../constants/MOCHA_CONSTANTS'; + +/** + * dynamically generating tests + * info: https://mochajs.org/#delayed-root-suite + */ + +void (async function (): Promise { + const devfilesRegistryHelper: DevfilesRegistryHelper = e2eContainer.get(CLASSES.DevfilesRegistryHelper); + let devfileSamples: any; + if (MOCHA_CONSTANTS.MOCHA_DELAYED_SUITE) { + devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry( + true, + API_TEST_CONSTANTS.TS_API_TEST_DEV_WORKSPACE_LIST?.split(',') + ); + } + + for (const devfileSample of devfileSamples) { + suite( + `Inbuilt DevWorkspaces test suite for "${devfileSample.name}" sample ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, + function (): void { + this.bail(false); + let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper; + let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor; + let containerTerminal: ContainerTerminal; + let devfileContextYaml: any; + let devWorkspaceName: string | undefined; + let clonedProjectName: string; + let containerWorkDir: string; + const devfilesBuildCommands: any[] = []; + + test('Get DevWorkspace configuration', function (): void { + devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({}); + devfileContextYaml = devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationsAsYaml( + devfileSample.devWorkspaceConfigurationString + ); + devWorkspaceName = devfileContextYaml.DevWorkspace.metadata.name; + kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor); + kubernetesCommandLineToolsExecutor.workspaceName = devWorkspaceName; + containerTerminal = e2eContainer.get(CLASSES.ContainerTerminal); + kubernetesCommandLineToolsExecutor.loginToOcp(); + }); + + test('Collect build commands from the devfile', function (): void { + if (devfileContextYaml.DevWorkspace.spec.template.commands === undefined) { + Logger.info('Devfile does not contains any commands.'); + } else { + devfileContextYaml.DevWorkspace.spec.template.commands.forEach((command: any): void => { + if (command.exec?.group?.kind === 'build') { + Logger.debug(`Build command found: ${command.exec.commandLine}`); + devfilesBuildCommands.push(command); + } + }); + } + }); + + test('Create and wait DevWorkspace', function (): void { + const output: ShellString = kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsStringOutput( + devfileSample.devWorkspaceConfigurationString + ); + expect(output.stdout) + .contains('devworkspacetemplate') + .and.contains('devworkspace') + .and.contains.oneOf(['created', 'configured']); + }); + + test('Wait until DevWorkspace has status "ready"', function (): void { + this.timeout(TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT); + expect(kubernetesCommandLineToolsExecutor.waitDevWorkspace().stdout).contains('condition met'); + }); + + test('Check if project was created', function (): void { + clonedProjectName = devfileContextYaml.DevWorkspace.spec.template.projects[0].name; + expect(containerTerminal.ls().stdout).includes(clonedProjectName); + }); + + test('Check if project files are imported', function (): void { + containerWorkDir = containerTerminal.pwd().stdout.replace('\n', ''); + expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes('devfile.yaml'); + }); + + test('Check if build commands returns success', function (): void { + this.test?.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes + if (devfilesBuildCommands.length === 0) { + Logger.info('Devfile does not contains build commands.'); + } else { + devfilesBuildCommands.forEach((command): void => { + Logger.info(`command.exec: ${JSON.stringify(command.exec)}`); + + const commandString: string = StringUtil.updateCommandEnvsToShStyle( + `cd ${command.exec.workingDir} && ${command.exec.commandLine}` + ); + Logger.info(`Full build command to be executed: ${commandString}`); + + const output: ShellString = containerTerminal.execInContainerCommand(commandString, command.exec.component); + expect(output.code).eqls(0); + }); + } + }); + + test('Delete DevWorkspace', function (): void { + kubernetesCommandLineToolsExecutor.deleteDevWorkspace(); + }); + } + ); + } + + run(); +})(); diff --git a/tests/e2e/specs/api/PodOverridesAPI.spec.ts b/tests/e2e/specs/api/PodOverridesAPI.spec.ts index f02cf76af9b2..41c4e27733d2 100644 --- a/tests/e2e/specs/api/PodOverridesAPI.spec.ts +++ b/tests/e2e/specs/api/PodOverridesAPI.spec.ts @@ -17,7 +17,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; import { e2eContainer } from '../../configs/inversify.config'; import { CLASSES } from '../../configs/inversify.types'; -suite('Test defining pod overrides via attribute.', function (): void { +suite(`Test defining pod overrides via attribute ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const pathToSampleFile: string = path.resolve( `resources/pod-overrides${BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED() ? '-airgap' : ''}.yaml` ); diff --git a/tests/e2e/specs/dashboard-samples/Documentation.spec.ts b/tests/e2e/specs/dashboard-samples/Documentation.spec.ts index cf8a0441a1b0..8fe3df09fe0d 100644 --- a/tests/e2e/specs/dashboard-samples/Documentation.spec.ts +++ b/tests/e2e/specs/dashboard-samples/Documentation.spec.ts @@ -26,7 +26,7 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS'; import { Logger } from '../../utils/Logger'; // suit works for DevSpaces -suite('Check links to documentation page in Dashboard', function (): void { +suite(`Check links to documentation page in Dashboard ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { this.timeout(180000); const pathToSampleFile: string = path.resolve('resources/default-devfile.yaml'); const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name; diff --git a/tests/e2e/specs/dashboard-samples/EmptyWorkspace.spec.ts b/tests/e2e/specs/dashboard-samples/EmptyWorkspace.spec.ts index 36a6931289d8..9634cefa7ae0 100644 --- a/tests/e2e/specs/dashboard-samples/EmptyWorkspace.spec.ts +++ b/tests/e2e/specs/dashboard-samples/EmptyWorkspace.spec.ts @@ -16,10 +16,11 @@ import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests'; import { LoginTests } from '../../tests-library/LoginTests'; import { registerRunningWorkspace } from '../MochaHooks'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; const stackName: string = 'Empty Workspace'; -suite(`${stackName} test`, function (): void { +suite(`${stackName} test ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); diff --git a/tests/e2e/specs/dashboard-samples/Quarkus.spec.ts b/tests/e2e/specs/dashboard-samples/Quarkus.spec.ts index b54c2bc8fafd..bb524d37037e 100644 --- a/tests/e2e/specs/dashboard-samples/Quarkus.spec.ts +++ b/tests/e2e/specs/dashboard-samples/Quarkus.spec.ts @@ -21,7 +21,7 @@ import { expect } from 'chai'; const stackName: string = 'Java 11 with Quarkus'; -suite(`The ${stackName} userstory`, function (): void { +suite(`The ${stackName} userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); diff --git a/tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts b/tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts index 39054dd13ef0..4ca9f29d0eb9 100644 --- a/tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts +++ b/tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts @@ -33,11 +33,12 @@ import { expect } from 'chai'; import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; import { PLUGIN_TEST_CONSTANTS } from '../../constants/PLUGIN_TEST_CONSTANTS'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; const samples: string[] = PLUGIN_TEST_CONSTANTS.TS_SAMPLE_LIST.split(','); for (const sample of samples) { - suite(`Check if recommended extensions installed for ${sample}`, function (): void { + suite(`Check if recommended extensions installed for ${sample} ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); diff --git a/tests/e2e/specs/devconsole-intergration/DevConsoleIntegration.spec.ts b/tests/e2e/specs/devconsole-intergration/DevConsoleIntegration.spec.ts index 05b037a45196..79eb7fa13a85 100644 --- a/tests/e2e/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +++ b/tests/e2e/specs/devconsole-intergration/DevConsoleIntegration.spec.ts @@ -25,7 +25,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; -suite('DevConsole Integration', function (): void { +suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { let ocpImportPage: OcpImportFromGitPage; let ocpApplicationPage: OcpApplicationPage; diff --git a/tests/e2e/specs/factory/Factory.spec.ts b/tests/e2e/specs/factory/Factory.spec.ts index f5af702f4211..614517ecf1bc 100644 --- a/tests/e2e/specs/factory/Factory.spec.ts +++ b/tests/e2e/specs/factory/Factory.spec.ts @@ -38,7 +38,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS'; suite( - `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`, + `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); diff --git a/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts b/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts index ca0f30d8bafc..ad70a3289096 100644 --- a/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts +++ b/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts @@ -41,7 +41,7 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS'; import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; suite( - `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup`, + `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); diff --git a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts index 4a0bf2ba649d..907b4b6fb349 100644 --- a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts +++ b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts @@ -40,7 +40,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS'; suite( - `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`, + `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); diff --git a/tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts b/tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts index 0d52d9600535..3197d301c983 100644 --- a/tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts +++ b/tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts @@ -23,7 +23,7 @@ import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS'; const stackName: string = BASE_TEST_CONSTANTS.TS_SELENIUM_DASHBOARD_SAMPLE_NAME || 'Python'; const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || 'python-hello-world'; -suite('"Start workspace with existed workspace name" test', function (): void { +suite(`"Start workspace with existed workspace name" test ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); diff --git a/tests/e2e/specs/miscellaneous/KubedockPodmanTest.spec.ts b/tests/e2e/specs/miscellaneous/KubedockPodmanTest.spec.ts index 0b2d827659dd..3bc7c9022207 100644 --- a/tests/e2e/specs/miscellaneous/KubedockPodmanTest.spec.ts +++ b/tests/e2e/specs/miscellaneous/KubedockPodmanTest.spec.ts @@ -18,75 +18,79 @@ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; import { expect } from 'chai'; import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor'; import { ShellString } from 'shelljs'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; -suite('Check possibility to manage containers within a workspace with kubedock and podman', function (): void { - const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); - const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); - const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); - const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); - let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor; - let workspaceName: string = ''; +suite( + `Check possibility to manage containers within a workspace with kubedock and podman ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, + function (): void { + const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); + const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); + const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); + const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); + let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor; + let workspaceName: string = ''; - const testScript: string = - '# Enable Kubedock\n' + - 'export KUBEDOCK_ENABLED=true\n' + - 'echo KUBEDOCK_ENABLED\n' + - '/entrypoint.sh\n' + - 'cd $PROJECT_SOURCE\n' + - 'export USER=$(oc whoami)\n' + - 'export TKN=$(oc whoami -t)\n' + - 'export REG="image-registry.openshift-image-registry.svc:5000"\n' + - 'export PROJECT=$(oc project -q)\n' + - 'export IMG="${REG}/${PROJECT}/hello"\n' + - 'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' + - 'podman build -t ${IMG} .\n' + - 'podman push --tls-verify=false ${IMG}\n' + - 'podman run --rm ${IMG}'; + const testScript: string = + '# Enable Kubedock\n' + + 'export KUBEDOCK_ENABLED=true\n' + + 'echo KUBEDOCK_ENABLED\n' + + '/entrypoint.sh\n' + + 'cd $PROJECT_SOURCE\n' + + 'export USER=$(oc whoami)\n' + + 'export TKN=$(oc whoami -t)\n' + + 'export REG="image-registry.openshift-image-registry.svc:5000"\n' + + 'export PROJECT=$(oc project -q)\n' + + 'export IMG="${REG}/${PROJECT}/hello"\n' + + 'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' + + 'podman build -t ${IMG} .\n' + + 'podman push --tls-verify=false ${IMG}\n' + + 'podman run --rm ${IMG}'; - const factoryUrl: string = 'https://github.com/l0rd/dockerfile-hello-world'; + const factoryUrl: string = 'https://github.com/l0rd/dockerfile-hello-world'; - loginTests.loginIntoChe(); + loginTests.loginIntoChe(); - test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise { - await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl); - }); + test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise { + await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl); + }); - test('Obtain workspace name from workspace loader page', async function (): Promise { - await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); - workspaceName = WorkspaceHandlingTests.getWorkspaceName(); - expect(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined; - }); + test('Obtain workspace name from workspace loader page', async function (): Promise { + await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); + workspaceName = WorkspaceHandlingTests.getWorkspaceName(); + expect(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined; + }); - test('Register running workspace', function (): void { - registerRunningWorkspace(workspaceName); - }); + test('Register running workspace', function (): void { + registerRunningWorkspace(workspaceName); + }); - test('Wait workspace readiness', async function (): Promise { - await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); - }); + test('Wait workspace readiness', async function (): Promise { + await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); + }); - test('Check the project files were imported', async function (): Promise { - const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession(); - expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile'), 'Files not imported').not.undefined; - }); + test('Check the project files were imported', async function (): Promise { + const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession(); + expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile'), 'Files not imported').not.undefined; + }); - test('Create and check container runs using kubedock and podman', function (): void { - kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor); - kubernetesCommandLineToolsExecutor.workspaceName = workspaceName; - kubernetesCommandLineToolsExecutor.loginToOcp(); - kubernetesCommandLineToolsExecutor.getPodAndContainerNames(); - const output: ShellString = kubernetesCommandLineToolsExecutor.executeCommand(testScript); - expect(output, 'Podman test script failed').contains('Hello from Kubedock!'); - }); + test('Create and check container runs using kubedock and podman', function (): void { + kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor); + kubernetesCommandLineToolsExecutor.workspaceName = workspaceName; + kubernetesCommandLineToolsExecutor.loginToOcp(); + kubernetesCommandLineToolsExecutor.getPodAndContainerNames(); + const output: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(testScript); + expect(output, 'Podman test script failed').contains('Hello from Kubedock!'); + }); - test('Stop the workspace', async function (): Promise { - await workspaceHandlingTests.stopWorkspace(workspaceName); - await browserTabsUtil.closeAllTabsExceptCurrent(); - }); + test('Stop the workspace', async function (): Promise { + await workspaceHandlingTests.stopWorkspace(workspaceName); + await browserTabsUtil.closeAllTabsExceptCurrent(); + }); - test('Delete the workspace', async function (): Promise { - await workspaceHandlingTests.removeWorkspace(workspaceName); - }); + test('Delete the workspace', async function (): Promise { + await workspaceHandlingTests.removeWorkspace(workspaceName); + }); - loginTests.logoutFromChe(); -}); + loginTests.logoutFromChe(); + } +); diff --git a/tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts b/tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts index 381f931c4ee3..f9972b1005fb 100644 --- a/tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts +++ b/tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts @@ -16,8 +16,9 @@ import { LoginTests } from '../../tests-library/LoginTests'; import { registerRunningWorkspace } from '../MochaHooks'; import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor'; import { ShellExecutor } from '../../utils/ShellExecutor'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; -suite('Create predefined workspace and check it', function (): void { +suite(`Create predefined workspace and check it ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const predefinedNamespaceName: string = 'predefined-ns'; const stackName: string = 'Empty Workspace'; diff --git a/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts b/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts index 76cb3798e172..8ad4f5c64d88 100644 --- a/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts +++ b/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts @@ -10,7 +10,7 @@ import { e2eContainer } from '../../configs/inversify.config'; import { ShellExecutor } from '../../utils/ShellExecutor'; import { InputBox, QuickOpenBox, QuickPickItem, ViewItem, ViewSection, Workbench } from 'monaco-page-objects'; -import { CLASSES } from '../../configs/inversify.types'; +import { CLASSES, TYPES } from '../../configs/inversify.types'; import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests'; import { LoginTests } from '../../tests-library/LoginTests'; import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; @@ -21,13 +21,15 @@ import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS'; import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; import { registerRunningWorkspace } from '../MochaHooks'; import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor'; +import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil'; -suite('Workspace using a parent test suite', function (): void { +suite(`Workspace using a parent test suite ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor); + const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get( CLASSES.KubernetesCommandLineToolsExecutor @@ -96,5 +98,10 @@ suite('Workspace using a parent test suite', function (): void { expect(envList).contains('DEVFILE_ENV_VAR=true').and.contains('PARENT_ENV_VAR=true'); }); + test('Stop and delete the workspace by API', async function (): Promise { + await browserTabsUtil.closeAllTabsExceptCurrent(); + testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName()); + }); + loginTests.logoutFromChe(); }); diff --git a/tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts b/tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts index a0e2f0f977b3..a5186472cc7b 100644 --- a/tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts +++ b/tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts @@ -11,8 +11,9 @@ import { CLASSES } from '../../configs/inversify.types'; import { e2eContainer } from '../../configs/inversify.config'; import { LoginTests } from '../../tests-library/LoginTests'; import { OcpMainPage } from '../../pageobjects/openshift/OcpMainPage'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; -suite('Login to Openshift console and start WebTerminal', function (): void { +suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage); diff --git a/tests/e2e/suits/x86_64/airgap-ocp-413/APITest.suite.ts b/tests/e2e/suits/x86_64/airgap-ocp-413/APITest.suite.ts new file mode 100644 index 000000000000..e3aa41bcab73 --- /dev/null +++ b/tests/e2e/suits/x86_64/airgap-ocp-413/APITest.suite.ts @@ -0,0 +1,11 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/ContainerOverridesAPI.spec'; +import '../../../specs/api/PodOverridesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/airgap-ocp-413/DynamicAPITest.suite.ts b/tests/e2e/suits/x86_64/airgap-ocp-413/DynamicAPITest.suite.ts new file mode 100644 index 000000000000..7191f49f081f --- /dev/null +++ b/tests/e2e/suits/x86_64/airgap-ocp-413/DynamicAPITest.suite.ts @@ -0,0 +1,10 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/InbuiltApplicationDevWorkspacesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/airgap-ocp-413/InitEnvironmental.sh b/tests/e2e/suits/x86_64/airgap-ocp-413/InitEnvironmental.sh new file mode 100644 index 000000000000..f9d0916a3952 --- /dev/null +++ b/tests/e2e/suits/x86_64/airgap-ocp-413/InitEnvironmental.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +export OCP_VERSION='airgap-ocp4-13' +export ARCH_VERSION='x86_64' +export TEST_ENVIRONMENT="$OCP_VERSION $ARCH_VERSION" +export TS_SELENIUM_BASE_URL=${TS_SELENIUM_BASE_URL_AIRGAP_OCP_413:-''} +export DELETE_WORKSPACE_ON_FAILED_TEST='true' +export DELETE_SCREENCAST_IF_TEST_PASS='true' +export NODE_TLS_REJECT_UNAUTHORIZED='0' +export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE='htpasswd' +export TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS='1000' +export TS_SELENIUM_EDITOR='che-code' +export TS_SELENIUM_EXECUTION_SCREENCAST='false' +export TS_SELENIUM_HEADLESS='false' +export TS_SELENIUM_LAUNCH_FULLSCREEN='true' +export TS_SELENIUM_LOG_LEVEL='TRACE' +export TS_SELENIUM_OCP_PASSWORD=${TS_SELENIUM_OCP_PASSWORD:-''} +export TS_SELENIUM_OCP_USERNAME='admin' +export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH='true' +export MOCHA_BAIL='false' +export MOCHA_RETRIES='1' + diff --git a/tests/e2e/suits/x86_64/airgap-ocp-413/UITest.suite.ts b/tests/e2e/suits/x86_64/airgap-ocp-413/UITest.suite.ts new file mode 100644 index 000000000000..cd8f5a3d730f --- /dev/null +++ b/tests/e2e/suits/x86_64/airgap-ocp-413/UITest.suite.ts @@ -0,0 +1,16 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/dashboard-samples/Quarkus.spec'; +import '../../../specs/dashboard-samples/RecommendedExtensions.spec'; +import '../../../specs/dashboard-samples/Documentation.spec'; +import '../../../specs/devconsole-intergration/DevConsoleIntegration.spec'; +import '../../../specs/miscellaneous/CreateWorkspaceWithExistedName.spec'; +import '../../../specs/miscellaneous/PredefinedNamespace.spec'; +import '../../../specs/miscellaneous/WorkspaceWithParent.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-12/APITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-12/APITest.suite.ts new file mode 100644 index 000000000000..b8eed024aedd --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-12/APITest.suite.ts @@ -0,0 +1,12 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/ContainerOverridesAPI.spec'; +import '../../../specs/api/EmptyWorkspaceAPI.spec'; +import '../../../specs/api/PodOverridesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-12/DynamicAPITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-12/DynamicAPITest.suite.ts new file mode 100644 index 000000000000..7191f49f081f --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-12/DynamicAPITest.suite.ts @@ -0,0 +1,10 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/InbuiltApplicationDevWorkspacesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-12/InitEnvironmental.sh b/tests/e2e/suits/x86_64/ocp4-12/InitEnvironmental.sh new file mode 100644 index 000000000000..9b7541818491 --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-12/InitEnvironmental.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export OCP_VERSION='ocp4-12' +export ARCH_VERSION='x86_64' +export TEST_ENVIRONMENT="$OCP_VERSION $ARCH_VERSION" +export TS_SELENIUM_BASE_URL=${TS_SELENIUM_BASE_URL_OCP_412:-''} +export TS_SELENIUM_OCP_PASSWORD=${TS_SELENIUM_OCP_PASSWORD:-''} +export DELETE_WORKSPACE_ON_FAILED_TEST='true' +export DELETE_SCREENCAST_IF_TEST_PASS='true' +export NODE_TLS_REJECT_UNAUTHORIZED='0' +export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE='htpasswd' +export TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS='1000' +export TS_SELENIUM_EDITOR='che-code' +export TS_SELENIUM_EXECUTION_SCREENCAST='false' +export TS_SELENIUM_HEADLESS='false' +export TS_SELENIUM_LAUNCH_FULLSCREEN='true' +export TS_SELENIUM_LOG_LEVEL='TRACE' +export TS_SELENIUM_OCP_USERNAME='admin' +export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH='true' +export MOCHA_BAIL='false' +export MOCHA_RETRIES='1' diff --git a/tests/e2e/suits/x86_64/ocp4-12/UITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-12/UITest.suite.ts new file mode 100644 index 000000000000..c7510412cdf2 --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-12/UITest.suite.ts @@ -0,0 +1,19 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/SmokeTest.spec'; +import '../../../specs/dashboard-samples/EmptyWorkspace.spec'; +import '../../../specs/dashboard-samples/Quarkus.spec'; +import '../../../specs/dashboard-samples/RecommendedExtensions.spec'; +import '../../../specs/dashboard-samples/Documentation.spec'; +import '../../../specs/devconsole-intergration/DevConsoleIntegration.spec'; +import '../../../specs/miscellaneous/CreateWorkspaceWithExistedName.spec'; +import '../../../specs/miscellaneous/KubedockPodmanTest.spec'; +import '../../../specs/miscellaneous/PredefinedNamespace.spec'; +import '../../../specs/miscellaneous/WorkspaceWithParent.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-13/APITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-13/APITest.suite.ts new file mode 100644 index 000000000000..b8eed024aedd --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-13/APITest.suite.ts @@ -0,0 +1,12 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/ContainerOverridesAPI.spec'; +import '../../../specs/api/EmptyWorkspaceAPI.spec'; +import '../../../specs/api/PodOverridesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-13/DynamicAPITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-13/DynamicAPITest.suite.ts new file mode 100644 index 000000000000..7191f49f081f --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-13/DynamicAPITest.suite.ts @@ -0,0 +1,10 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/api/InbuiltApplicationDevWorkspacesAPI.spec'; diff --git a/tests/e2e/suits/x86_64/ocp4-13/InitEnvironmental.sh b/tests/e2e/suits/x86_64/ocp4-13/InitEnvironmental.sh new file mode 100644 index 000000000000..70994c29eef5 --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-13/InitEnvironmental.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export OCP_VERSION='ocp4-13' +export ARCH_VERSION='x86_64' +export TEST_ENVIRONMENT="$OCP_VERSION $ARCH_VERSION" +export TS_SELENIUM_BASE_URL=${TS_SELENIUM_BASE_URL_OCP_413:-''} +export TS_SELENIUM_OCP_PASSWORD=${TS_SELENIUM_OCP_PASSWORD:-''} +export DELETE_WORKSPACE_ON_FAILED_TEST='true' +export DELETE_SCREENCAST_IF_TEST_PASS='true' +export NODE_TLS_REJECT_UNAUTHORIZED='0' +export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE='htpasswd' +export TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS='1000' +export TS_SELENIUM_EDITOR='che-code' +export TS_SELENIUM_EXECUTION_SCREENCAST='false' +export TS_SELENIUM_HEADLESS='false' +export TS_SELENIUM_LAUNCH_FULLSCREEN='true' +export TS_SELENIUM_LOG_LEVEL='TRACE' +export TS_SELENIUM_OCP_USERNAME='admin' +export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH='true' +export MOCHA_BAIL='false' +export MOCHA_RETRIES='1' diff --git a/tests/e2e/suits/x86_64/ocp4-13/UITest.suite.ts b/tests/e2e/suits/x86_64/ocp4-13/UITest.suite.ts new file mode 100644 index 000000000000..c7510412cdf2 --- /dev/null +++ b/tests/e2e/suits/x86_64/ocp4-13/UITest.suite.ts @@ -0,0 +1,19 @@ +/** ******************************************************************* + * copyright (c) 2023 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 + **********************************************************************/ +import '../../../specs/SmokeTest.spec'; +import '../../../specs/dashboard-samples/EmptyWorkspace.spec'; +import '../../../specs/dashboard-samples/Quarkus.spec'; +import '../../../specs/dashboard-samples/RecommendedExtensions.spec'; +import '../../../specs/dashboard-samples/Documentation.spec'; +import '../../../specs/devconsole-intergration/DevConsoleIntegration.spec'; +import '../../../specs/miscellaneous/CreateWorkspaceWithExistedName.spec'; +import '../../../specs/miscellaneous/KubedockPodmanTest.spec'; +import '../../../specs/miscellaneous/PredefinedNamespace.spec'; +import '../../../specs/miscellaneous/WorkspaceWithParent.spec'; diff --git a/tests/e2e/tests-library/LoginTests.ts b/tests/e2e/tests-library/LoginTests.ts index 196856cd8f5b..0896c86129e3 100644 --- a/tests/e2e/tests-library/LoginTests.ts +++ b/tests/e2e/tests-library/LoginTests.ts @@ -15,6 +15,7 @@ import { inject, injectable } from 'inversify'; import { Dashboard } from '../pageobjects/dashboard/Dashboard'; import { IOcpLoginPage } from '../pageobjects/login/interfaces/IOcpLoginPage'; import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS'; +import { registerRunningWorkspace } from '../specs/MochaHooks'; @injectable() export class LoginTests { @@ -50,6 +51,7 @@ export class LoginTests { logoutFromChe(): void { test('Logout', async (): Promise => { await this.dashboard.logout(); + registerRunningWorkspace(''); }); } } diff --git a/tests/e2e/utils/DevWorkspaceConfigurationHelper.ts b/tests/e2e/utils/DevWorkspaceConfigurationHelper.ts index 1a56e55e1544..44e2539aee00 100644 --- a/tests/e2e/utils/DevWorkspaceConfigurationHelper.ts +++ b/tests/e2e/utils/DevWorkspaceConfigurationHelper.ts @@ -19,12 +19,16 @@ import { injectable } from 'inversify'; import { IContextParams } from './IContextParams'; import { e2eContainer } from '../configs/inversify.config'; import { CLASSES, EXTERNAL_CLASSES } from '../configs/inversify.types'; +import getDecorators from 'inversify-inject-decorators'; + +const { lazyInject } = getDecorators(e2eContainer); @injectable() export class DevWorkspaceConfigurationHelper { - private generator: Generator = e2eContainer.get(EXTERNAL_CLASSES.Generator); - private shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor); - + @lazyInject(EXTERNAL_CLASSES.Generator) + private readonly generator!: Generator; + @lazyInject(CLASSES.ShellExecutor) + private readonly shellExecutor!: ShellExecutor; private readonly params: IContextParams; constructor(params: IContextParams) { @@ -74,4 +78,30 @@ export class DevWorkspaceConfigurationHelper { return allContentArray.join('---\n'); } + + getDevWorkspaceConfigurationsAsYaml(allContentString: string): string { + Logger.debug(`${this.constructor.name}.${this.getDevWorkspaceConfigurationsAsYaml.name}`); + const content: any = {}; + const contentArray: string[] = allContentString.split('---\n'); + contentArray.forEach((e: any): void => { + e = YAML.parse(e); + e.kind === 'DevWorkspace' + ? (content.DevWorkspace = e) + : e.kind === 'DevWorkspaceTemplate' + ? (content.DevWorkspaceTemplate = e) + : Logger.error( + 'Problems with configuration parsing, string should be in format "DevWorkspace\\n---\\nDevWorkspaceTemplate"' + ); + }); + + return content; + } + patchDevWorkspaceConfigWithBuildContainerAttribute(devfileContextDevWorkspace: any): void { + devfileContextDevWorkspace.spec.template.attributes = YAML.parse(` + controller.devfile.io/devworkspace-config: + name: devworkspace-config + namespace: openshift-devspaces + controller.devfile.io/scc: container-build + controller.devfile.io/storage-type: per-user`); + } } diff --git a/tests/e2e/utils/DevfilesRegistryHelper.ts b/tests/e2e/utils/DevfilesRegistryHelper.ts index 5cf1cb808766..5597fa297378 100644 --- a/tests/e2e/utils/DevfilesRegistryHelper.ts +++ b/tests/e2e/utils/DevfilesRegistryHelper.ts @@ -12,13 +12,17 @@ import { Logger } from './Logger'; import YAML from 'yaml'; import { API_TEST_CONSTANTS, SUPPORTED_DEVFILE_REGISTRIES } from '../constants/API_TEST_CONSTANTS'; import { injectable } from 'inversify'; +import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS'; @injectable() export class DevfilesRegistryHelper { - async getInbuiltDevfilesRegistryContent(): Promise { + async getInbuiltDevfilesRegistryContent(sampleNamePatterns?: string[]): Promise { Logger.trace(); - return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL()); + return this.filterSamples( + sampleNamePatterns, + await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL()) + ); } async getGitHubCheDevfileRegistryContent(): Promise { @@ -27,13 +31,13 @@ export class DevfilesRegistryHelper { return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL); } - async collectPathsToDevfilesFromRegistry(): Promise { + async collectPathsToDevfilesFromRegistry(isInbuilt: boolean = true, sampleNamePatterns?: string[]): Promise { Logger.debug(); const devfileSamples: object[] = []; const sampleNames: string[] = []; - switch (API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) { - case SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL: + switch (isInbuilt) { + case false: { const content: any[any] = await this.getGitHubCheDevfileRegistryContent(); content.forEach((e: any): void => { @@ -55,14 +59,17 @@ export class DevfilesRegistryHelper { Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`); } break; - case SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL(): + case true: { - const content: any[any] = await this.getInbuiltDevfilesRegistryContent(); - + const content: any[any] = await this.getInbuiltDevfilesRegistryContent(sampleNamePatterns); for (const sample of content) { + const linkToDevWorkspaceYaml: any = + BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL + + '/devfile-registry' + + sample.links.devWorkspaces['che-incubator/che-code/latest']; devfileSamples.push({ name: sample.displayName, - link: sample.links.v2 + devWorkspaceConfigurationString: await this.getContent(linkToDevWorkspaceYaml) }); } Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`); @@ -76,6 +83,18 @@ export class DevfilesRegistryHelper { return devfileSamples; } + async getEditorContent(entry: string): Promise { + return await this.getContent(`${BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL}/${entry}`); + } + + private filterSamples(sampleNamePatterns: string[] | undefined, content: any): Promise { + if (sampleNamePatterns) { + const commonSampleNamePattern: RegExp = new RegExp(sampleNamePatterns.join('|'), 'i'); + content = content.filter((e: any): boolean => commonSampleNamePattern.test(e.displayName)); + } + return content; + } + private async getContent(url: string, headers?: object): Promise { Logger.trace(`${url}`); diff --git a/tests/e2e/utils/IKubernetesCommandLineToolsExecutor.ts b/tests/e2e/utils/IKubernetesCommandLineToolsExecutor.ts index fc5867f43ce2..1b5d976b8246 100644 --- a/tests/e2e/utils/IKubernetesCommandLineToolsExecutor.ts +++ b/tests/e2e/utils/IKubernetesCommandLineToolsExecutor.ts @@ -20,7 +20,7 @@ export interface IKubernetesCommandLineToolsExecutor { applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString; - executeCommand(commandToExecute: string, container: string): ShellString; + execInContainerCommand(commandToExecute: string, container: string): ShellString; applyYamlConfigurationAsStringOutput(yamlConfiguration: string): ShellString; diff --git a/tests/e2e/utils/KubernetesCommandLineToolsExecutor.ts b/tests/e2e/utils/KubernetesCommandLineToolsExecutor.ts index 67f711ee727c..94767a6870d7 100644 --- a/tests/e2e/utils/KubernetesCommandLineToolsExecutor.ts +++ b/tests/e2e/utils/KubernetesCommandLineToolsExecutor.ts @@ -114,7 +114,7 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin return this.waitDevWorkspace(); } - executeCommand(commandToExecute: string, container: string = KubernetesCommandLineToolsExecutor.container): ShellString { + execInContainerCommand(commandToExecute: string, container: string = KubernetesCommandLineToolsExecutor.container): ShellString { Logger.debug(`${this.kubernetesCommandLineTool}`); return this.shellExecutor.executeCommand( @@ -217,22 +217,22 @@ export class ContainerTerminal extends KubernetesCommandLineToolsExecutor { } ls(path: string = ''): ShellString { - return this.shellExecutor.executeCommand('ls ' + path); + return this.execInContainerCommand('ls ' + path); } pwd(): ShellString { - return this.shellExecutor.executeCommand('pwd'); + return this.execInContainerCommand('pwd'); } cd(path: string): ShellString { - return this.shellExecutor.executeCommand('cd ' + path); + return this.execInContainerCommand('cd ' + path); } gitClone(repository: string): ShellString { - return this.shellExecutor.executeCommand('git clone ' + repository); + return this.execInContainerCommand('git clone ' + repository); } removeFolder(path: string): ShellString { - return this.shellExecutor.executeCommand('rm -rf ' + path); + return this.execInContainerCommand('rm -rf ' + path); } }