diff --git a/tests/e2e/inversify.types.ts b/tests/e2e/inversify.types.ts index e867208bb2..3b41ba537d 100644 --- a/tests/e2e/inversify.types.ts +++ b/tests/e2e/inversify.types.ts @@ -48,7 +48,6 @@ const CLASSES = { GitHubUtil: 'GitHubUtil', CheGitApi: 'CheGitApi', GitPlugin: 'GitPlugin', - TestWorkspaceUtil: 'TestWorkspaceUtil', NotificationCenter: 'NotificationCenter', PreferencesHandler: 'PreferencesHandler', CheApiRequestHandler: 'CheApiRequestHandler', diff --git a/tests/e2e/mocha-all-plugins.opts b/tests/e2e/mocha-all-plugins.opts new file mode 100644 index 0000000000..68c4c4b874 --- /dev/null +++ b/tests/e2e/mocha-all-plugins.opts @@ -0,0 +1,7 @@ +--timeout 2200000 +--reporter 'dist/driver/CheReporter.js' +-u tdd +--full-trace +--spec dist/tests/login/Login.spec.js +--spec dist/tests/plugins/*.spec.js +--require source-map-support/register diff --git a/tests/e2e/package.json b/tests/e2e/package.json index c601459e9b..3b0f94a8dc 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -23,8 +23,9 @@ "test-oauth": "tsc && mocha --opts mocha.ocp.link.opts", "lint": "tslint --fix -p .", "tsc": "tsc -p .", - "init-mocha-opts": "tsc && mocha --opts mocha-single-devfile.opts", - "test-plugin": "npm run init-mocha-opts -- --spec dist/tests/login/Login.spec.js --spec dist/tests/plugins/${USERSTORY}.spec.js" + "init-mocha-opts": "tsc && mocha --opts mocha-single-devfile.opts --spec dist/tests/login/Login.spec.js", + "test-plugin": "npm run init-mocha-opts -- --spec dist/tests/plugins/${USERSTORY}.spec.js", + "test-all-plugins": "tsc && mocha --opts mocha-all-plugins.opts" }, "author": "Ihor Okhrimenko (iokhrime@redhat.com)", "license": "ISC", diff --git a/tests/e2e/tests/plugins/VscodeShellcheckPlugin.spec.ts b/tests/e2e/tests/plugins/VscodeShellcheckPlugin.spec.ts index 80bbfd9fdf..7656ae0ffe 100644 --- a/tests/e2e/tests/plugins/VscodeShellcheckPlugin.spec.ts +++ b/tests/e2e/tests/plugins/VscodeShellcheckPlugin.spec.ts @@ -34,7 +34,8 @@ const subRootFolder: string = 'app'; const pathToFile: string = `${sampleName}`; const fileName: string = 'test.sh'; -suite(`The 'VscodeShellcheckPlugin' test`, async () => { +// skipped until issue: https://github.com/eclipse/che/issues/19376 resolved +suite.skip(`The 'VscodeShellcheckPlugin' test`, async () => { suite('Create workspace', async () => { test('Set shellcheck path', async () => { const shellcheckExecutablePathPropertyName: string = 'shellcheck.executablePath'; diff --git a/tests/e2e/tests/plugins/VscodeValePlugin.spec.ts b/tests/e2e/tests/plugins/VscodeValePlugin.spec.ts index e5abbba3b6..3a64155870 100644 --- a/tests/e2e/tests/plugins/VscodeValePlugin.spec.ts +++ b/tests/e2e/tests/plugins/VscodeValePlugin.spec.ts @@ -37,7 +37,8 @@ const projectName: string = 'che-docs'; const pathToFile: string = `${projectName}/modules/administration-guide/partials`; const docFileName: string = 'assembly_authenticating-users.adoc'; -suite('The "VscodeValePlugin" userstory', async () => { +// skipped until issue: https://github.com/eclipse/che/issues/19289 resolved +suite.skip('The "VscodeValePlugin" userstory', async () => { suite('Create workspace', async () => { test('Create workspace using factory', async () => { await driverHelper.navigateToUrl(factoryUrl); diff --git a/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts b/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts index 033c82ccd5..2216a331c8 100644 --- a/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts +++ b/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts @@ -9,6 +9,7 @@ **********************************************************************/ import { WorkspaceStatus } from './WorkspaceStatus'; +import { che } from '@eclipse-che/api'; export interface ITestWorkspaceUtil { cleanUpAllWorkspaces() : void; @@ -18,4 +19,7 @@ export interface ITestWorkspaceUtil { stopWorkspaceById(id: string) : void; getIdOfRunningWorkspace(namespace: string): Promise; getIdOfRunningWorkspaces(): Promise>; + createWsFromDevFile(customTemplate: che.workspace.devfile.Devfile): void; + getBaseDevfile(): Promise; + startWorkspace(workspaceId: string): void; } diff --git a/tests/e2e/utils/workspace/TestWorkspaceUtil.ts b/tests/e2e/utils/workspace/TestWorkspaceUtil.ts index a59351fd4a..bb706c8fd4 100644 --- a/tests/e2e/utils/workspace/TestWorkspaceUtil.ts +++ b/tests/e2e/utils/workspace/TestWorkspaceUtil.ts @@ -18,6 +18,7 @@ import { ITestWorkspaceUtil } from './ITestWorkspaceUtil'; import { error } from 'selenium-webdriver'; import { CheApiRequestHandler } from '../requestHandlers/CheApiRequestHandler'; import { CLASSES } from '../../inversify.types'; +import { Logger } from '../Logger'; @injectable() export class TestWorkspaceUtil implements ITestWorkspaceUtil { @@ -30,6 +31,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { ) { } public async waitWorkspaceStatus(namespace: string, workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus) { + Logger.debug('TestWorkspaceUtil.waitWorkspaceStatus'); + const workspaceStatusApiUrl: string = `${TestWorkspaceUtil.WORKSPACE_API_URL}/${namespace}:${workspaceName}`; const attempts: number = TestConstants.TS_SELENIUM_WORKSPACE_STATUS_ATTEMPTS; const polling: number = TestConstants.TS_SELENIUM_WORKSPACE_STATUS_POLLING; @@ -56,6 +59,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async waitPluginAdding(namespace: string, workspaceName: string, pluginName: string) { + Logger.debug('TestWorkspaceUtil.waitPluginAdding'); + const workspaceStatusApiUrl: string = `${TestWorkspaceUtil.WORKSPACE_API_URL}/${namespace}:${workspaceName}`; const attempts: number = TestConstants.TS_SELENIUM_PLUGIN_PRECENCE_ATTEMPTS; const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING; @@ -84,6 +89,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async getListOfWorkspaceId(): Promise { + Logger.debug('TestWorkspaceUtil.getListOfWorkspaceId'); + const getAllWorkspacesResponse = await this.processRequestHandler.get(TestWorkspaceUtil.WORKSPACE_API_URL); interface IMyObj { @@ -103,12 +110,16 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async getIdOfRunningWorkspace(wsName: string): Promise { + Logger.debug('TestWorkspaceUtil.getIdOfRunningWorkspace'); + const getWorkspacesByNameResponse = await this.processRequestHandler.get(`${TestWorkspaceUtil.WORKSPACE_API_URL}/:${wsName}`); return getWorkspacesByNameResponse.data.id; } public async getIdOfRunningWorkspaces(): Promise> { + Logger.debug('TestWorkspaceUtil.getIdOfRunningWorkspaces'); + try { const getAllWorkspacesResponse = await this.processRequestHandler.get(TestWorkspaceUtil.WORKSPACE_API_URL); @@ -134,6 +145,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async removeWorkspaceById(id: string) { + Logger.debug('TestWorkspaceUtil.removeWorkspaceById'); + const workspaceIdUrl: string = `${TestWorkspaceUtil.WORKSPACE_API_URL}/${id}`; try { const deleteWorkspaceResponse = await this.processRequestHandler.delete(workspaceIdUrl); @@ -148,6 +161,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async stopWorkspaceById(id: string) { + Logger.debug('TestWorkspaceUtil.stopWorkspaceById'); + const stopWorkspaceApiUrl: string = `${TestWorkspaceUtil.WORKSPACE_API_URL}/${id}`; try { @@ -177,6 +192,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } public async cleanUpAllWorkspaces() { + Logger.debug('TestWorkspaceUtil.cleanUpAllWorkspaces'); + let listOfRunningWorkspaces: Array = await this.getIdOfRunningWorkspaces(); for (const entry of listOfRunningWorkspaces) { await this.stopWorkspaceById(entry); @@ -191,8 +208,10 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } async createWsFromDevFile(customTemplate: che.workspace.devfile.Devfile) { + Logger.debug('TestWorkspaceUtil.createWsFromDevFile'); + try { - await this.processRequestHandler.post(TestWorkspaceUtil.WORKSPACE_API_URL + '/devfile', customTemplate); + await this.processRequestHandler.post(TestWorkspaceUtil.WORKSPACE_API_URL + '/devfile', customTemplate); } catch (error) { console.error(error); throw error; @@ -200,6 +219,8 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { } async getBaseDevfile(): Promise { + Logger.debug('TestWorkspaceUtil.getBaseDevfile'); + const baseDevfile: che.workspace.devfile.Devfile = { apiVersion: '1.0.0', metadata: { @@ -210,4 +231,15 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { return baseDevfile; } + async startWorkspace(workspaceId: string) { + Logger.debug('TestWorkspaceUtil.startWorkspace'); + + try { + await this.processRequestHandler.post(`${TestWorkspaceUtil.WORKSPACE_API_URL}/${workspaceId}/runtime`); + } catch (error) { + console.error(error); + throw error; + } + } + }