@eclipse-che/che-e2e 7.67.0 → 7.67.1-dev-e49f025
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -4
- package/build/dockerfiles/Dockerfile +1 -1
- package/configs/inversify.config.ts +20 -17
- package/configs/inversify.types.ts +3 -3
- package/configs/mocharc.ts +14 -4
- package/configs/sh-scripts/generateIndex.sh +2 -3
- package/constants/APITestConstants.ts +56 -0
- package/constants/BaseTestConstants.ts +65 -0
- package/constants/ChromeDriverConstants.ts +46 -0
- package/constants/FactoryTestConstants.ts +45 -0
- package/constants/MonacoConstants.ts +22 -0
- package/constants/OAuthConstants.ts +56 -0
- package/constants/PluginsTestConstants.ts +15 -0
- package/constants/ReporterConstants.ts +45 -0
- package/constants/TimeoutConstants.ts +28 -146
- package/dist/configs/inversify.config.js +17 -13
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +3 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -4
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/APITestConstants.js +54 -0
- package/dist/constants/APITestConstants.js.map +1 -0
- package/dist/constants/BaseTestConstants.js +61 -0
- package/dist/constants/BaseTestConstants.js.map +1 -0
- package/dist/constants/ChromeDriverConstants.js +44 -0
- package/dist/constants/ChromeDriverConstants.js.map +1 -0
- package/dist/constants/FactoryTestConstants.js +44 -0
- package/dist/constants/FactoryTestConstants.js.map +1 -0
- package/dist/constants/MonacoConstants.js +25 -0
- package/dist/constants/MonacoConstants.js.map +1 -0
- package/dist/constants/OAuthConstants.js +52 -0
- package/dist/constants/OAuthConstants.js.map +1 -0
- package/dist/constants/PluginsTestConstants.js +19 -0
- package/dist/constants/PluginsTestConstants.js.map +1 -0
- package/dist/constants/ReporterConstants.js +43 -0
- package/dist/constants/ReporterConstants.js.map +1 -0
- package/dist/constants/TimeoutConstants.js +22 -113
- package/dist/constants/TimeoutConstants.js.map +1 -1
- package/dist/driver/ChromeDriver.js +7 -7
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +22 -12
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +2 -2
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +7 -6
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +3 -4
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +2 -3
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +12 -19
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +2 -2
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js.map +1 -0
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js.map +1 -0
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +68 -0
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -0
- package/dist/pageobjects/{openshift/CheLoginPage.js → login/kubernetes/KubernetesLoginPage.js} +21 -26
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -0
- package/dist/pageobjects/{openshift → login/openshift}/OcpLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{OcpRedHatLoginPage.js → openshift/OcpRedHatLoginPage.js} +5 -5
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{OcpUserLoginPage.js → openshift/OcpUserLoginPage.js} +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{RedHatLoginPage.js → openshift/RedHatLoginPage.js} +6 -6
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{RegularUserOcpCheLoginPage.js → openshift/RegularUserOcpCheLoginPage.js} +8 -8
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -0
- package/dist/specs/MochaHooks.js +18 -11
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +5 -2
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +5 -4
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +93 -0
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +62 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -0
- package/dist/specs/api/PodOverridesAPI.spec.js +5 -4
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +7 -2
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js +7 -6
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +4 -4
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +20 -18
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +28 -28
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +28 -26
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +4 -4
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +1 -2
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +2 -2
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +33 -36
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +72 -0
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -0
- package/dist/utils/DevfilesRegistryHelper.js +82 -0
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -0
- package/dist/utils/DriverHelper.js +20 -17
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +42 -29
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +11 -11
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +9 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +5 -2
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/{vsc/GitUtil.js → StringUtil.js} +26 -8
- package/dist/utils/StringUtil.js.map +1 -0
- package/dist/utils/request-handlers/CheApiRequestHandler.js +2 -2
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +4 -2
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +9 -7
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +7 -7
- package/index.ts +22 -12
- package/package.json +4 -2
- package/pageobjects/dashboard/CreateWorkspace.ts +2 -2
- package/pageobjects/dashboard/Dashboard.ts +7 -6
- package/pageobjects/dashboard/Workspaces.ts +3 -4
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +2 -3
- package/pageobjects/git-providers/OauthPage.ts +8 -16
- package/pageobjects/ide/CheCodeLocatorLoader.ts +2 -2
- package/pageobjects/login/kubernetes/DexLoginPage.ts +58 -0
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +33 -0
- package/pageobjects/{openshift → login/openshift}/OcpLoginPage.ts +7 -7
- package/pageobjects/login/{OcpRedHatLoginPage.ts → openshift/OcpRedHatLoginPage.ts} +6 -6
- package/pageobjects/login/{OcpUserLoginPage.ts → openshift/OcpUserLoginPage.ts} +8 -8
- package/pageobjects/login/{RedHatLoginPage.ts → openshift/RedHatLoginPage.ts} +6 -6
- package/pageobjects/login/{RegularUserOcpCheLoginPage.ts → openshift/RegularUserOcpCheLoginPage.ts} +9 -9
- package/specs/MochaHooks.ts +18 -12
- package/specs/SmokeTest.spec.ts +5 -2
- package/specs/api/ContainerOverridesAPI.spec.ts +5 -4
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +106 -0
- package/specs/api/EmptyWorkspaceAPI.spec.ts +74 -0
- package/specs/api/PodOverridesAPI.spec.ts +5 -4
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +10 -2
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +8 -7
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +4 -4
- package/specs/factory/Factory.spec.ts +21 -19
- package/specs/factory/NoSetupRepoFactory.spec.ts +29 -30
- package/specs/factory/RefusedOAuthFactory.spec.ts +29 -28
- package/tests-library/LoginTests.ts +9 -9
- package/tests-library/ProjectAndFileTests.ts +1 -1
- package/tests-library/WorkspaceHandlingTests.ts +11 -12
- package/utils/BrowserTabsUtil.ts +2 -2
- package/utils/CheReporter.ts +35 -42
- package/utils/DevWorkspaceConfigurationHelper.ts +83 -0
- package/utils/DevfilesRegistryHelper.ts +77 -0
- package/utils/DriverHelper.ts +54 -50
- package/utils/KubernetesCommandLineToolsExecutor.ts +43 -28
- package/utils/Logger.ts +16 -17
- package/utils/ScreenCatcher.ts +8 -9
- package/utils/ShellExecutor.ts +6 -2
- package/utils/StringUtil.ts +46 -0
- package/utils/request-handlers/CheApiRequestHandler.ts +4 -4
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +4 -2
- package/utils/workspace/ApiUrlResolver.ts +2 -2
- package/utils/workspace/TestWorkspaceUtil.ts +16 -14
- package/constants/TestConstants.ts +0 -247
- package/dist/constants/TestConstants.js +0 -198
- package/dist/constants/TestConstants.js.map +0 -1
- package/dist/pageobjects/login/ICheLoginPage.js.map +0 -1
- package/dist/pageobjects/login/IOcpLoginPage.js.map +0 -1
- package/dist/pageobjects/login/OcpRedHatLoginPage.js.map +0 -1
- package/dist/pageobjects/login/OcpUserLoginPage.js.map +0 -1
- package/dist/pageobjects/login/RedHatLoginPage.js.map +0 -1
- package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js.map +0 -1
- package/dist/pageobjects/openshift/CheLoginPage.js.map +0 -1
- package/dist/pageobjects/openshift/OcpLoginPage.js.map +0 -1
- package/dist/specs/api/CloneGitRepoAPI.spec.js +0 -60
- package/dist/specs/api/CloneGitRepoAPI.spec.js.map +0 -1
- package/dist/utils/Sanitizer.js +0 -29
- package/dist/utils/Sanitizer.js.map +0 -1
- package/dist/utils/vsc/GitUtil.js.map +0 -1
- package/pageobjects/openshift/CheLoginPage.ts +0 -42
- package/specs/api/CloneGitRepoAPI.spec.ts +0 -72
- package/utils/Sanitizer.ts +0 -19
- package/utils/vsc/GitUtil.ts +0 -25
- /package/dist/pageobjects/login/{ICheLoginPage.js → interfaces/ICheLoginPage.js} +0 -0
- /package/dist/pageobjects/login/{IOcpLoginPage.js → interfaces/IOcpLoginPage.js} +0 -0
- /package/pageobjects/login/{ICheLoginPage.ts → interfaces/ICheLoginPage.ts} +0 -0
- /package/pageobjects/login/{IOcpLoginPage.ts → interfaces/IOcpLoginPage.ts} +0 -0
package/specs/MochaHooks.ts
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import 'reflect-metadata';
|
|
12
12
|
import { CLASSES, TYPES } from '../configs/inversify.types';
|
|
13
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
14
13
|
import { CheApiRequestHandler } from '../utils/request-handlers/CheApiRequestHandler';
|
|
15
14
|
import { TimeoutConstants } from '../constants/TimeoutConstants';
|
|
16
15
|
import * as monacoPageObjects from 'monaco-page-objects';
|
|
@@ -19,6 +18,9 @@ import { e2eContainer } from '../configs/inversify.config';
|
|
|
19
18
|
import { DriverHelper } from '../utils/DriverHelper';
|
|
20
19
|
import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
|
|
21
20
|
import { Logger } from '../utils/Logger';
|
|
21
|
+
import { BaseTestConstants } from '../constants/BaseTestConstants';
|
|
22
|
+
import { ChromeDriverConstants } from '../constants/ChromeDriverConstants';
|
|
23
|
+
import { MonacoConstants } from '../constants/MonacoConstants';
|
|
22
24
|
|
|
23
25
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
24
26
|
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
|
|
@@ -33,37 +35,41 @@ export function registerRunningWorkspace(workspaceName: string): void {
|
|
|
33
35
|
exports.mochaHooks = {
|
|
34
36
|
beforeAll: [
|
|
35
37
|
async function enableRequestInterceptor(): Promise<void> {
|
|
36
|
-
if (
|
|
38
|
+
if (BaseTestConstants.TS_SELENIUM_REQUEST_INTERCEPTOR) {
|
|
37
39
|
CheApiRequestHandler.enableRequestInterceptor();
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
async function enableResponseInterceptor(): Promise<void> {
|
|
41
|
-
if (
|
|
43
|
+
if (BaseTestConstants.TS_SELENIUM_RESPONSE_INTERCEPTOR) {
|
|
42
44
|
CheApiRequestHandler.enableResponseInterceptor();
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
async function initMonacoPageObjects(): Promise<void> {
|
|
46
48
|
// init vscode-extension-tester monaco-page-objects
|
|
47
|
-
monacoPageObjects.initPageObjects(
|
|
49
|
+
monacoPageObjects.initPageObjects(MonacoConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION, MonacoConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION, vscodeExtensionTesterLocators.getLocatorsPath(), driverHelper.getDriver(), 'google-chrome');
|
|
48
50
|
},
|
|
49
51
|
async function prolongTimeoutConstantsInDebugMode(): Promise<void> {
|
|
50
|
-
if (
|
|
52
|
+
if (BaseTestConstants.TS_DEBUG_MODE) {
|
|
51
53
|
for (let [timeout, seconds] of Object.entries(TimeoutConstants)) {
|
|
52
|
-
Object.defineProperty(TimeoutConstants, timeout, {value: seconds as number * 100});
|
|
54
|
+
Object.defineProperty(TimeoutConstants, timeout, { value: seconds as number * 100 });
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
},
|
|
56
58
|
],
|
|
57
|
-
|
|
59
|
+
afterEach: [
|
|
58
60
|
// stop and remove running workspace
|
|
59
|
-
async ()
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
async function (this: Mocha.Context): Promise<void> {
|
|
62
|
+
if (this.currentTest?.state === 'failed') {
|
|
63
|
+
if (BaseTestConstants.DELETE_WORKSPACE_ON_FAILED_TEST) {
|
|
64
|
+
Logger.info('Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete running workspace with API.');
|
|
65
|
+
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(latestWorkspace);
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
},
|
|
69
|
+
],
|
|
70
|
+
afterAll: [
|
|
65
71
|
async function stopTheDriver(): Promise<void> {
|
|
66
|
-
if (!
|
|
72
|
+
if (!BaseTestConstants.TS_DEBUG_MODE && ChromeDriverConstants.TS_USE_WEB_DRIVER_FOR_TEST) {
|
|
67
73
|
await driverHelper.getDriver().quit();
|
|
68
74
|
Logger.info('Chrome driver session stopped.');
|
|
69
75
|
}
|
package/specs/SmokeTest.spec.ts
CHANGED
|
@@ -15,12 +15,14 @@ import { WorkspaceHandlingTests } from '../tests-library/WorkspaceHandlingTests'
|
|
|
15
15
|
import { registerRunningWorkspace } from './MochaHooks';
|
|
16
16
|
import { Logger } from '../utils/Logger';
|
|
17
17
|
import { LoginTests } from '../tests-library/LoginTests';
|
|
18
|
+
import { StringUtil } from '../utils/StringUtil';
|
|
19
|
+
import { FactoryTestConstants } from '../constants/FactoryTestConstants';
|
|
18
20
|
|
|
19
|
-
const factoryUrl: string = 'https://github.com/che-incubator/quarkus-api-example.git';
|
|
20
|
-
const projectName: string = 'quarkus-api-example';
|
|
21
|
+
const factoryUrl: string = FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/che-incubator/quarkus-api-example.git';
|
|
21
22
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
22
23
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
23
24
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
25
|
+
let projectName: string;
|
|
24
26
|
|
|
25
27
|
suite(`The SmokeTest userstory`, async function (): Promise<void> {
|
|
26
28
|
let projectSection: ViewSection;
|
|
@@ -35,6 +37,7 @@ suite(`The SmokeTest userstory`, async function (): Promise<void> {
|
|
|
35
37
|
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
36
38
|
});
|
|
37
39
|
test('Check a project folder has been created', async function (): Promise<void> {
|
|
40
|
+
projectName = StringUtil.getProjectNameFromGitUrl(factoryUrl);
|
|
38
41
|
projectSection = await new SideBarView().getContent().getSection(projectName);
|
|
39
42
|
Logger.debug(`new SideBarView().getContent().getSection: get ${projectName}`);
|
|
40
43
|
});
|
|
@@ -3,6 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import YAML from 'yaml';
|
|
5
5
|
import { expect } from 'chai';
|
|
6
|
+
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
6
7
|
|
|
7
8
|
suite(`Test defining container overrides via attribute.`, async function (): Promise<void> {
|
|
8
9
|
const pathToSampleFile: string = path.resolve('resources/container-overrides.yaml');
|
|
@@ -13,16 +14,16 @@ suite(`Test defining container overrides via attribute.`, async function (): Pro
|
|
|
13
14
|
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
14
15
|
});
|
|
15
16
|
|
|
16
|
-
suiteTeardown('Delete
|
|
17
|
+
suiteTeardown('Delete DevWorkspace', function (): void {
|
|
17
18
|
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
test('Apply container-overrides sample as
|
|
21
|
+
test('Apply container-overrides sample as DevWorkspace with OC client', function (): void {
|
|
21
22
|
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
|
|
22
|
-
|
|
23
|
+
ShellExecutor.wait(5);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
test('Check that fields are overridden in the Deployment for
|
|
26
|
+
test('Check that fields are overridden in the Deployment for DevWorkspace', function (): void {
|
|
26
27
|
const devWorkspaceFullYamlOutput: any = YAML.parse(kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration());
|
|
27
28
|
expect(devWorkspaceFullYamlOutput.spec.template.components[0].attributes['container-overrides']).eqls({
|
|
28
29
|
resources: {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
|
+
import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
|
|
3
|
+
import { ShellString } from 'shelljs';
|
|
4
|
+
import { expect } from 'chai';
|
|
5
|
+
import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
|
|
6
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
7
|
+
import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper';
|
|
8
|
+
import { Logger } from '../../utils/Logger';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Dynamically generating tests
|
|
12
|
+
* info: https://mochajs.org/#delayed-root-suite
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
(async function (): Promise<void> {
|
|
16
|
+
|
|
17
|
+
const devfilesRegistryHelper: DevfilesRegistryHelper = new DevfilesRegistryHelper();
|
|
18
|
+
const devfileSamples: any = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry();
|
|
19
|
+
|
|
20
|
+
for (const devfileSample of devfileSamples) {
|
|
21
|
+
suite(`Devfile acceptance test suite for ${devfileSample.name}`, async function (): Promise<void> {
|
|
22
|
+
this.bail(false);
|
|
23
|
+
this.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes
|
|
24
|
+
let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
|
|
25
|
+
let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
|
|
26
|
+
let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
|
|
27
|
+
let devfileContext: DevfileContext;
|
|
28
|
+
let devWorkspaceName: string | undefined;
|
|
29
|
+
let clonedProjectName: string;
|
|
30
|
+
let containerWorkDir: string;
|
|
31
|
+
let devfilesBuildCommands: any[] = [];
|
|
32
|
+
|
|
33
|
+
test('Get DevWorkspace configuration', async function (): Promise<void> {
|
|
34
|
+
devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({
|
|
35
|
+
devfileUrl: devfileSample.link,
|
|
36
|
+
});
|
|
37
|
+
devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
|
|
38
|
+
devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
|
|
39
|
+
|
|
40
|
+
kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName);
|
|
41
|
+
containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
42
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('Collect build commands from the devfile', async function (): Promise<void> {
|
|
46
|
+
if (devfileContext.devfile.commands === undefined) {
|
|
47
|
+
Logger.info(`Devfile does not contains any commands.`);
|
|
48
|
+
} else {
|
|
49
|
+
devfileContext.devfile.commands.forEach((command: any) => {
|
|
50
|
+
if (command.exec?.group?.kind === 'build') {
|
|
51
|
+
Logger.debug(`Build command found: ${command.exec.commandLine}`);
|
|
52
|
+
devfilesBuildCommands.push(command);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('Create DevWorkspace', async function (): Promise<void> {
|
|
59
|
+
const devWorkspaceConfigurationYamlString: string = await devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationYamlAsString(devfileContext);
|
|
60
|
+
const applyOutput: ShellString = kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsStringOutput(devWorkspaceConfigurationYamlString);
|
|
61
|
+
|
|
62
|
+
expect(applyOutput.stdout)
|
|
63
|
+
.contains('devworkspacetemplate')
|
|
64
|
+
.and.contains('devworkspace')
|
|
65
|
+
.and.contains.oneOf(['created', 'configured']);
|
|
66
|
+
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('Wait until DevWorkspace has status "ready"', async function (): Promise<void> {
|
|
70
|
+
expect(kubernetesCommandLineToolsExecutor.waitDevWorkspace().stdout).contains('condition met');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('Check if project was created', function (): void {
|
|
74
|
+
clonedProjectName = StringUtil.getProjectNameFromGitUrl(devfileSample.link);
|
|
75
|
+
expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('Check if project files are imported', function (): void {
|
|
79
|
+
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
80
|
+
expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes(`devfile.yaml`);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test(`Check if build commands returns success`, function (): void {
|
|
84
|
+
if (devfilesBuildCommands.length === 0) {
|
|
85
|
+
Logger.info(`Devfile does not contains build commands.`);
|
|
86
|
+
} else {
|
|
87
|
+
devfilesBuildCommands.forEach((command) => {
|
|
88
|
+
Logger.info(`command.exec: ${JSON.stringify(command.exec)}`);
|
|
89
|
+
|
|
90
|
+
const commandString: string = StringUtil.updateCommandEnvsToShStyle(`cd ${command.exec.workingDir} && ${command.exec.commandLine}`);
|
|
91
|
+
Logger.info(`Full build command to be executed: ${commandString}`);
|
|
92
|
+
|
|
93
|
+
const output: ShellString = containerTerminal.executeCommand(commandString, command.exec.component);
|
|
94
|
+
expect(output.code).eqls(0);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('Delete DevWorkspace', async function (): Promise<void> {
|
|
100
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
run();
|
|
106
|
+
})();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { ShellString } from 'shelljs';
|
|
4
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
5
|
+
import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
|
|
6
|
+
import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
|
|
7
|
+
import { APITestConstants } from '../../constants/APITestConstants';
|
|
8
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
9
|
+
|
|
10
|
+
suite(`Empty workspace API test`, async function (): Promise<void> {
|
|
11
|
+
// works only for root user
|
|
12
|
+
const namespace: string = APITestConstants.TS_API_TEST_NAMESPACE;
|
|
13
|
+
let clonedProjectName: string;
|
|
14
|
+
let containerWorkDir: string;
|
|
15
|
+
let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
|
|
16
|
+
let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
|
|
17
|
+
let devfileContext: DevfileContext;
|
|
18
|
+
let devWorkspaceName: string | undefined;
|
|
19
|
+
let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
|
|
20
|
+
|
|
21
|
+
const gitRepository: string = 'https://github.com/crw-qe/web-nodejs-sample';
|
|
22
|
+
|
|
23
|
+
suiteSetup('Create empty workspace with OC client', async function (): Promise<void> {
|
|
24
|
+
const workspaceName: string = 'empty-' + Math.floor(Math.random() * 1000);
|
|
25
|
+
const devfileContent: string =
|
|
26
|
+
'schemaVersion: 2.2.0\n' +
|
|
27
|
+
'metadata:\n' +
|
|
28
|
+
` name: ${workspaceName}\n`;
|
|
29
|
+
|
|
30
|
+
devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({
|
|
31
|
+
devfileContent,
|
|
32
|
+
});
|
|
33
|
+
devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
|
|
34
|
+
devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
|
|
35
|
+
kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName, namespace);
|
|
36
|
+
containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Create empty workspace', async function (): Promise<void> {
|
|
40
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
41
|
+
const devWorkspaceConfigurationYamlString: string = await devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationYamlAsString(devfileContext);
|
|
42
|
+
const output: ShellString = kubernetesCommandLineToolsExecutor.applyAndWaitDevWorkspace(devWorkspaceConfigurationYamlString);
|
|
43
|
+
expect(output.stdout).contains('condition met');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
suite('Clone public repo without previous setup', function (): void {
|
|
47
|
+
|
|
48
|
+
test('Check if public repo can be cloned', function (): void {
|
|
49
|
+
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
50
|
+
const cloneOutput: ShellString = containerTerminal.gitClone(gitRepository);
|
|
51
|
+
expect(cloneOutput.stdout + cloneOutput.stderr).includes('Cloning');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('Check if project was created', function (): void {
|
|
55
|
+
clonedProjectName = StringUtil.getProjectNameFromGitUrl(gitRepository);
|
|
56
|
+
expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('Check if project files are imported', function (): void {
|
|
60
|
+
expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout)
|
|
61
|
+
.includes(BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
suiteTeardown('Delete cloned project', function (): void {
|
|
65
|
+
containerTerminal.removeFolder(`${clonedProjectName}`);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
suiteTeardown('Delete workspace', function (): void {
|
|
70
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
|
|
@@ -3,6 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import YAML from 'yaml';
|
|
5
5
|
import { expect } from 'chai';
|
|
6
|
+
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
6
7
|
|
|
7
8
|
suite(`Test defining pod overrides via attribute.`, async function (): Promise<void> {
|
|
8
9
|
const pathToSampleFile: string = path.resolve('resources/pod-overrides.yaml');
|
|
@@ -13,16 +14,16 @@ suite(`Test defining pod overrides via attribute.`, async function (): Promise<v
|
|
|
13
14
|
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
14
15
|
});
|
|
15
16
|
|
|
16
|
-
suiteTeardown('Delete
|
|
17
|
+
suiteTeardown('Delete DevWorkspace', function (): void {
|
|
17
18
|
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
test('Apply pod-overrides sample as
|
|
21
|
+
test('Apply pod-overrides sample as DevWorkspace with OC client', function (): void {
|
|
21
22
|
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
|
|
22
|
-
|
|
23
|
+
ShellExecutor.wait(5);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
test('Check that fields are overridden in the Deployment for
|
|
26
|
+
test('Check that fields are overridden in the Deployment for DevWorkspace', function (): void {
|
|
26
27
|
const devWorkspaceFullYamlOutput: any = YAML.parse(kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration());
|
|
27
28
|
expect(devWorkspaceFullYamlOutput.spec.template.attributes['pod-overrides']).eqls({
|
|
28
29
|
metadata: {
|
|
@@ -15,10 +15,13 @@ import { Logger } from '../../utils/Logger';
|
|
|
15
15
|
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
16
16
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
17
17
|
import { registerRunningWorkspace } from '../MochaHooks';
|
|
18
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
18
19
|
|
|
19
20
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
20
21
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
21
22
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
23
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
24
|
+
|
|
22
25
|
const stackName: string = 'Empty Workspace';
|
|
23
26
|
|
|
24
27
|
suite(`${stackName} test`, async () => {
|
|
@@ -44,8 +47,13 @@ suite(`${stackName} test`, async () => {
|
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
suite('Stopping and deleting the workspace', async () => {
|
|
47
|
-
test(
|
|
48
|
-
await workspaceHandlingTests.
|
|
50
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
51
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
52
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
56
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
49
57
|
});
|
|
50
58
|
loginTests.logoutFromChe();
|
|
51
59
|
});
|
|
@@ -33,8 +33,9 @@ import { DriverHelper } from '../../utils/DriverHelper';
|
|
|
33
33
|
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
34
34
|
import { expect } from 'chai';
|
|
35
35
|
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
36
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
37
36
|
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
37
|
+
import { PluginsTestConstants } from '../../constants/PluginsTestConstants';
|
|
38
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
38
39
|
|
|
39
40
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
40
41
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
@@ -42,7 +43,7 @@ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
|
42
43
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
43
44
|
|
|
44
45
|
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
|
|
45
|
-
const samples: string[] =
|
|
46
|
+
const samples: string[] = PluginsTestConstants.TS_SAMPLE_LIST.split(',');
|
|
46
47
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
47
48
|
|
|
48
49
|
suite(`Check if recommended extensions installed for ${samples}`, async function (): Promise<void> {
|
|
@@ -71,7 +72,7 @@ suite(`Check if recommended extensions installed for ${samples}`, async function
|
|
|
71
72
|
|
|
72
73
|
test('Wait until the project will be imported and accept it as trusted one', async function (): Promise<void> {
|
|
73
74
|
[projectSection] = await new SideBarView().getContent().getSections();
|
|
74
|
-
const label: string =
|
|
75
|
+
const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
75
76
|
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
76
77
|
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
77
78
|
expect(isFileImported).not.eqls(undefined);
|
|
@@ -115,7 +116,7 @@ suite(`Check if recommended extensions installed for ${samples}`, async function
|
|
|
115
116
|
await driverHelper.wait(TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT);
|
|
116
117
|
});
|
|
117
118
|
|
|
118
|
-
test(`Check if extensions
|
|
119
|
+
test(`Check if extensions are installed and enabled`, async function (): Promise<void> {
|
|
119
120
|
this.retries(10);
|
|
120
121
|
Logger.debug(`ActivityBar().getViewControl('Extensions'))?.openView(): open Extensions view.`);
|
|
121
122
|
extensionsView = await (await new ActivityBar().getViewControl('Extensions'))?.openView();
|
|
@@ -171,12 +172,12 @@ suite(`Check if recommended extensions installed for ${samples}`, async function
|
|
|
171
172
|
expect(isInstalled).eqls(true);
|
|
172
173
|
|
|
173
174
|
Logger.debug(`itemWithRightNameAndPublisher.manage(): get context menu.`);
|
|
174
|
-
const extensionManageMenu: ContextMenu
|
|
175
|
+
const extensionManageMenu: ContextMenu = await (itemWithRightNameAndPublisher as ExtensionsViewItem).manage();
|
|
175
176
|
|
|
176
177
|
Logger.debug(`extensionManageMenu.getItems(): get menu items.`);
|
|
177
|
-
const extensionMenuItems: ContextMenuItem[]
|
|
178
|
+
const extensionMenuItems: ContextMenuItem[] = await extensionManageMenu.getItems();
|
|
178
179
|
let extensionMenuItemLabels: string = '';
|
|
179
|
-
for (const item of extensionMenuItems
|
|
180
|
+
for (const item of extensionMenuItems) {
|
|
180
181
|
Logger.trace(`extensionMenuItems -> item.getLabel(): get menu items names.`);
|
|
181
182
|
extensionMenuItemLabels += (await item.getLabel()) + ' ';
|
|
182
183
|
}
|
|
@@ -20,12 +20,12 @@ import { CLASSES } from '../../configs/inversify.types';
|
|
|
20
20
|
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
21
21
|
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
22
22
|
import { expect } from 'chai';
|
|
23
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
24
23
|
import { OcpMainPage } from '../../pageobjects/openshift/OcpMainPage';
|
|
25
24
|
import { OcpImportFromGitPage } from '../../pageobjects/openshift/OcpImportFromGitPage';
|
|
26
25
|
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
27
|
-
import {
|
|
26
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
28
27
|
import { OcpApplicationPage } from '../../pageobjects/openshift/OcpApplicationPage';
|
|
28
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
29
29
|
|
|
30
30
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
31
31
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
@@ -84,9 +84,9 @@ suite(`DevConsole Integration`, async function (): Promise<void> {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
test('Check if project and files imported', async function (): Promise<void> {
|
|
87
|
-
const applicationSourceProjectName: string =
|
|
87
|
+
const applicationSourceProjectName: string = StringUtil.getProjectNameFromGitUrl(gitImportRepo);
|
|
88
88
|
const projectSection: ViewSection = await new SideBarView().getContent().getSection(applicationSourceProjectName);
|
|
89
|
-
const isFileImported: ViewItem | undefined = await projectSection.findItem(
|
|
89
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
|
|
90
90
|
expect(isFileImported).not.eqls(undefined);
|
|
91
91
|
});
|
|
92
92
|
|
|
@@ -25,10 +25,9 @@ import {
|
|
|
25
25
|
ViewItem,
|
|
26
26
|
ViewSection
|
|
27
27
|
} from 'monaco-page-objects';
|
|
28
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
29
28
|
import { expect } from 'chai';
|
|
30
29
|
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
|
|
31
|
-
import {
|
|
30
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
32
31
|
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
33
32
|
import { registerRunningWorkspace } from '../MochaHooks';
|
|
34
33
|
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
@@ -38,6 +37,9 @@ import { DriverHelper } from '../../utils/DriverHelper';
|
|
|
38
37
|
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
39
38
|
import { Logger } from '../../utils/Logger';
|
|
40
39
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
40
|
+
import { OAuthConstants } from '../../constants/OAuthConstants';
|
|
41
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
42
|
+
import { FactoryTestConstants } from '../../constants/FactoryTestConstants';
|
|
41
43
|
|
|
42
44
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
43
45
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
@@ -47,7 +49,7 @@ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
|
47
49
|
|
|
48
50
|
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
|
|
49
51
|
|
|
50
|
-
suite(`Create a workspace via launching a factory from the ${
|
|
52
|
+
suite(`Create a workspace via launching a factory from the ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`, async function (): Promise<void> {
|
|
51
53
|
const oauthPage: OauthPage = new OauthPage(driverHelper);
|
|
52
54
|
|
|
53
55
|
let projectSection: ViewSection;
|
|
@@ -59,18 +61,18 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
59
61
|
const timeToRefresh: number = 1500;
|
|
60
62
|
const changesToCommit: string = (new Date()).getTime().toString();
|
|
61
63
|
const fileToChange: string = 'Date.txt';
|
|
62
|
-
const commitChangesButtonLabel: string = `Commit Changes on "${
|
|
64
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
63
65
|
const refreshButtonLabel: string = 'Refresh';
|
|
64
66
|
const pushItemLabel: string = 'Push';
|
|
65
|
-
|
|
67
|
+
let testRepoProjectName: string;
|
|
66
68
|
|
|
67
69
|
loginTests.loginIntoChe();
|
|
68
70
|
test(`Navigate to the factory URL`, async function (): Promise<void> {
|
|
69
|
-
await browserTabsUtil.navigateTo(
|
|
71
|
+
await browserTabsUtil.navigateTo(FactoryTestConstants.TS_SELENIUM_FACTORY_URL());
|
|
70
72
|
});
|
|
71
73
|
|
|
72
|
-
if (
|
|
73
|
-
test(`Authorize with a ${
|
|
74
|
+
if (OAuthConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
|
|
75
|
+
test(`Authorize with a ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth`, async function (): Promise<void> {
|
|
74
76
|
await oauthPage.login();
|
|
75
77
|
await oauthPage.waitOauthPage();
|
|
76
78
|
await oauthPage.confirmAccess();
|
|
@@ -88,12 +90,13 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
88
90
|
});
|
|
89
91
|
|
|
90
92
|
test('Check if a project folder has been created', async function (): Promise<void> {
|
|
93
|
+
testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
91
94
|
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
92
95
|
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
|
|
93
96
|
});
|
|
94
97
|
|
|
95
98
|
test('Check if the project files were imported', async function (): Promise<void> {
|
|
96
|
-
const label: string =
|
|
99
|
+
const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
97
100
|
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
98
101
|
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
99
102
|
expect(isFileImported).not.eqls(undefined);
|
|
@@ -129,7 +132,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
129
132
|
Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
|
|
130
133
|
});
|
|
131
134
|
|
|
132
|
-
test('Check if the changes
|
|
135
|
+
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
|
|
133
136
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
134
137
|
await driverHelper.wait(timeToRefresh);
|
|
135
138
|
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
@@ -166,7 +169,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
166
169
|
});
|
|
167
170
|
|
|
168
171
|
test('Push the changes', async function (): Promise<void> {
|
|
169
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${
|
|
172
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
|
|
170
173
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
171
174
|
Logger.debug(`scmProvider.openMoreActions`);
|
|
172
175
|
scmContextMenu = await scmProvider.openMoreActions();
|
|
@@ -184,15 +187,14 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
184
187
|
expect(isCommitButtonDisabled).eql('true');
|
|
185
188
|
});
|
|
186
189
|
|
|
187
|
-
test(
|
|
188
|
-
await workspaceHandlingTests.
|
|
190
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
191
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
192
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
189
193
|
});
|
|
190
194
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
suiteTeardown('Close the browser', async function (): Promise<void> {
|
|
194
|
-
if (!TestConstants.TS_DEBUG_MODE) {
|
|
195
|
-
await driverHelper.getDriver().close();
|
|
196
|
-
}
|
|
195
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
196
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
197
197
|
});
|
|
198
|
+
|
|
199
|
+
loginTests.logoutFromChe();
|
|
198
200
|
});
|