@eclipse-che/che-e2e 7.73.0 → 7.74.0-dev-41d1364
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/.eslintignore +10 -0
- package/.eslintrc.js +183 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +10 -0
- package/README.md +47 -47
- package/configs/inversify.config.ts +14 -10
- package/configs/inversify.types.ts +29 -29
- package/configs/mocharc.ts +21 -24
- package/constants/API_TEST_CONSTANTS.ts +67 -0
- package/constants/BASE_TEST_CONSTANTS.ts +80 -0
- package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
- package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
- package/constants/MONACO_CONSTANTS.ts +25 -0
- package/constants/OAUTH_CONSTANTS.ts +67 -0
- package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
- package/constants/REPORTER_CONSTANTS.ts +53 -0
- package/constants/TIMEOUT_CONSTANTS.ts +131 -0
- package/dist/configs/inversify.config.js +14 -8
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +2 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -16
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +13 -13
- package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +17 -16
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +14 -14
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
- package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +15 -14
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +8 -8
- package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
- package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +15 -15
- package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
- package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +13 -13
- package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
- package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
- package/dist/driver/ChromeDriver.js +12 -16
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +18 -18
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +27 -27
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +42 -42
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +44 -33
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +37 -35
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +10 -10
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +10 -10
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +6 -6
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +23 -23
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +11 -11
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +10 -10
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +9 -9
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +15 -15
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +27 -24
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +17 -13
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +31 -18
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +18 -12
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +12 -2
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -8
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -9
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +47 -43
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +17 -10
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +28 -26
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +41 -36
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +37 -35
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +18 -5
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +7 -7
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +9 -7
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +61 -78
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +29 -24
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +44 -44
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +19 -10
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +25 -19
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +126 -128
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +53 -46
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +62 -39
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +18 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +9 -0
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +17 -9
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +36 -34
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
- package/dist/utils/workspace/ApiUrlResolver.js +5 -5
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
- package/dist/utils/workspace/TestWorkspaceUtil.js +36 -30
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js +2 -2
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/ChromeDriver.ts +45 -51
- package/driver/IDriver.ts +3 -3
- package/index.ts +9 -9
- package/package.json +59 -49
- package/pageobjects/dashboard/CreateWorkspace.ts +65 -56
- package/pageobjects/dashboard/Dashboard.ts +101 -100
- package/pageobjects/dashboard/Workspaces.ts +197 -166
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +151 -127
- package/pageobjects/git-providers/OauthPage.ts +177 -166
- package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
- package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
- package/pageobjects/login/kubernetes/DexLoginPage.ts +32 -31
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +16 -15
- package/pageobjects/login/openshift/OcpLoginPage.ts +62 -55
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +30 -25
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +16 -19
- package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -44
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +39 -35
- package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
- package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
- package/pageobjects/openshift/OcpMainPage.ts +69 -68
- package/resources/pod-overrides-airgap.yaml +37 -0
- package/specs/MochaHooks.ts +59 -50
- package/specs/SmokeTest.spec.ts +43 -36
- package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +107 -94
- package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
- package/specs/api/PodOverridesAPI.spec.ts +42 -32
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -27
- package/specs/dashboard-samples/Quarkus.spec.ts +34 -30
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -170
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -55
- package/specs/factory/Factory.spec.ts +178 -166
- package/specs/factory/NoSetupRepoFactory.spec.ts +227 -210
- package/specs/factory/RefusedOAuthFactory.spec.ts +219 -203
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -50
- package/tests-library/LoginTests.ts +34 -32
- package/tests-library/ProjectAndFileTests.ts +21 -18
- package/tests-library/WorkspaceHandlingTests.ts +98 -108
- package/tsconfig.json +15 -15
- package/utils/BrowserTabsUtil.ts +104 -98
- package/utils/CheReporter.ts +142 -148
- package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
- package/utils/DevfilesRegistryHelper.ts +67 -58
- package/utils/DriverHelper.ts +726 -701
- package/utils/KubernetesCommandLineToolsExecutor.ts +196 -172
- package/utils/Logger.ts +104 -75
- package/utils/ScreenCatcher.ts +59 -48
- package/utils/ShellExecutor.ts +19 -11
- package/utils/StringUtil.ts +40 -32
- package/utils/request-handlers/CheApiRequestHandler.ts +92 -87
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
- package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
- package/utils/workspace/ApiUrlResolver.ts +31 -26
- package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
- package/utils/workspace/TestWorkspaceUtil.ts +153 -142
- package/utils/workspace/WorkspaceStatus.ts +5 -5
- package/constants/APITestConstants.ts +0 -56
- package/constants/BaseTestConstants.ts +0 -65
- package/constants/ChromeDriverConstants.ts +0 -46
- package/constants/FactoryTestConstants.ts +0 -51
- package/constants/MonacoConstants.ts +0 -22
- package/constants/OAuthConstants.ts +0 -57
- package/constants/PluginsTestConstants.ts +0 -15
- package/constants/ReporterConstants.ts +0 -45
- package/constants/TimeoutConstants.ts +0 -113
- package/dist/constants/APITestConstants.js.map +0 -1
- package/dist/constants/BaseTestConstants.js.map +0 -1
- package/dist/constants/ChromeDriverConstants.js.map +0 -1
- package/dist/constants/FactoryTestConstants.js.map +0 -1
- package/dist/constants/MonacoConstants.js.map +0 -1
- package/dist/constants/OAuthConstants.js.map +0 -1
- package/dist/constants/PluginsTestConstants.js.map +0 -1
- package/dist/constants/ReporterConstants.js.map +0 -1
- package/dist/constants/TimeoutConstants.js.map +0 -1
- package/tslint.json +0 -126
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
1
10
|
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
11
|
import fs from 'fs';
|
|
3
12
|
import path from 'path';
|
|
@@ -5,34 +14,32 @@ import YAML from 'yaml';
|
|
|
5
14
|
import { expect } from 'chai';
|
|
6
15
|
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
7
16
|
|
|
8
|
-
suite(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
suite('Test defining container overrides via attribute.', function (): void {
|
|
18
|
+
const pathToSampleFile: string = path.resolve('resources/container-overrides.yaml');
|
|
19
|
+
const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name;
|
|
20
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName);
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
suiteSetup('Login into OC client', function (): void {
|
|
23
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
24
|
+
});
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
suiteTeardown('Delete DevWorkspace', function (): void {
|
|
27
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
28
|
+
});
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
test('Apply container-overrides sample as DevWorkspace with OC client', function (): void {
|
|
31
|
+
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
|
|
32
|
+
ShellExecutor.wait(5);
|
|
33
|
+
});
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
test('Check that fields are overridden in the Deployment for DevWorkspace', function (): void {
|
|
36
|
+
const devWorkspaceFullYamlOutput: any = YAML.parse(kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration());
|
|
37
|
+
expect(devWorkspaceFullYamlOutput.spec.template.components[0].attributes['container-overrides']).eqls({
|
|
38
|
+
resources: {
|
|
39
|
+
limits: {
|
|
40
|
+
'nvidia.com/gpu': '1'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
36
45
|
});
|
|
37
|
-
|
|
38
|
-
|
|
@@ -1,106 +1,119 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
1
10
|
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
11
|
import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
|
|
3
12
|
import { ShellString } from 'shelljs';
|
|
4
13
|
import { expect } from 'chai';
|
|
5
14
|
import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
|
|
6
15
|
import { StringUtil } from '../../utils/StringUtil';
|
|
7
|
-
import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper';
|
|
16
|
+
// import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper';
|
|
8
17
|
import { Logger } from '../../utils/Logger';
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
|
-
*
|
|
20
|
+
* dynamically generating tests
|
|
12
21
|
* info: https://mochajs.org/#delayed-root-suite
|
|
13
22
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
23
|
+
// todo: skipped while don`t use to avoid sending useless requests
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
25
|
+
void (async function (): Promise<void> {
|
|
26
|
+
// const devfilesRegistryHelper: DevfilesRegistryHelper = new DevfilesRegistryHelper();
|
|
27
|
+
const devfileSamples: any = [];
|
|
28
|
+
// devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry();
|
|
29
|
+
|
|
30
|
+
for (const devfileSample of devfileSamples) {
|
|
31
|
+
suite.skip(`Devfile acceptance test suite for ${devfileSample.name}`, function (): void {
|
|
32
|
+
this.bail(false);
|
|
33
|
+
this.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes
|
|
34
|
+
let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
|
|
35
|
+
let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
|
|
36
|
+
let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
|
|
37
|
+
let devfileContext: DevfileContext;
|
|
38
|
+
let devWorkspaceName: string | undefined;
|
|
39
|
+
let clonedProjectName: string;
|
|
40
|
+
let containerWorkDir: string;
|
|
41
|
+
const devfilesBuildCommands: any[] = [];
|
|
42
|
+
|
|
43
|
+
test('Get DevWorkspace configuration', async function (): Promise<void> {
|
|
44
|
+
devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({
|
|
45
|
+
devfileUrl: devfileSample.link
|
|
46
|
+
});
|
|
47
|
+
devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
|
|
48
|
+
devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
|
|
49
|
+
|
|
50
|
+
kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName);
|
|
51
|
+
containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
52
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Collect build commands from the devfile', function (): void {
|
|
56
|
+
if (devfileContext.devfile.commands === undefined) {
|
|
57
|
+
Logger.info('Devfile does not contains any commands.');
|
|
58
|
+
} else {
|
|
59
|
+
devfileContext.devfile?.commands?.forEach((command: any): void => {
|
|
60
|
+
if (command.exec?.group?.kind === 'build') {
|
|
61
|
+
Logger.debug(`Build command found: ${command.exec.commandLine}`);
|
|
62
|
+
devfilesBuildCommands.push(command);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('Create DevWorkspace', function (): void {
|
|
69
|
+
const devWorkspaceConfigurationYamlString: string =
|
|
70
|
+
devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationYamlAsString(devfileContext);
|
|
71
|
+
const applyOutput: ShellString =
|
|
72
|
+
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsStringOutput(devWorkspaceConfigurationYamlString);
|
|
73
|
+
|
|
74
|
+
expect(applyOutput.stdout)
|
|
75
|
+
.contains('devworkspacetemplate')
|
|
76
|
+
.and.contains('devworkspace')
|
|
77
|
+
.and.contains.oneOf(['created', 'configured']);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('Wait until DevWorkspace has status "ready"', function (): void {
|
|
81
|
+
expect(kubernetesCommandLineToolsExecutor.waitDevWorkspace().stdout).contains('condition met');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('Check if project was created', function (): void {
|
|
85
|
+
clonedProjectName = StringUtil.getProjectNameFromGitUrl(devfileSample.link);
|
|
86
|
+
expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('Check if project files are imported', function (): void {
|
|
90
|
+
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
91
|
+
expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes('devfile.yaml');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('Check if build commands returns success', function (): void {
|
|
95
|
+
if (devfilesBuildCommands.length === 0) {
|
|
96
|
+
Logger.info('Devfile does not contains build commands.');
|
|
97
|
+
} else {
|
|
98
|
+
devfilesBuildCommands.forEach((command): void => {
|
|
99
|
+
Logger.info(`command.exec: ${JSON.stringify(command.exec)}`);
|
|
100
|
+
|
|
101
|
+
const commandString: string = StringUtil.updateCommandEnvsToShStyle(
|
|
102
|
+
`cd ${command.exec.workingDir} && ${command.exec.commandLine}`
|
|
103
|
+
);
|
|
104
|
+
Logger.info(`Full build command to be executed: ${commandString}`);
|
|
105
|
+
|
|
106
|
+
const output: ShellString = containerTerminal.executeCommand(commandString, command.exec.component);
|
|
107
|
+
expect(output.code).eqls(0);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('Delete DevWorkspace', function (): void {
|
|
113
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
run();
|
|
106
119
|
})();
|
|
@@ -1,74 +1,79 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
1
10
|
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
11
|
import { expect } from 'chai';
|
|
3
12
|
import { ShellString } from 'shelljs';
|
|
4
13
|
import { StringUtil } from '../../utils/StringUtil';
|
|
5
14
|
import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
|
|
6
15
|
import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
16
|
+
import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS';
|
|
17
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
9
18
|
|
|
10
|
-
suite(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
suite('Empty workspace API test', function (): void {
|
|
20
|
+
// works only for root user
|
|
21
|
+
const namespace: string | undefined = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
|
|
22
|
+
let clonedProjectName: string;
|
|
23
|
+
let containerWorkDir: string;
|
|
24
|
+
let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
|
|
25
|
+
let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
|
|
26
|
+
let devfileContext: DevfileContext;
|
|
27
|
+
let devWorkspaceName: string | undefined;
|
|
28
|
+
let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
const gitRepository: string = 'https://github.com/crw-qe/web-nodejs-sample';
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'schemaVersion: 2.2.0\n' +
|
|
27
|
-
'metadata:\n' +
|
|
28
|
-
` name: ${workspaceName}\n`;
|
|
32
|
+
suiteSetup('Create empty workspace with OC client', async function (): Promise<void> {
|
|
33
|
+
const workspaceName: string = 'empty-' + Math.floor(Math.random() * 1000);
|
|
34
|
+
const devfileContent: string = 'schemaVersion: 2.2.0\n' + 'metadata:\n' + ` name: ${workspaceName}\n`;
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({
|
|
37
|
+
devfileContent
|
|
38
|
+
});
|
|
39
|
+
devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
|
|
40
|
+
devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
|
|
41
|
+
kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName, namespace);
|
|
42
|
+
containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
43
|
+
});
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
test('Create empty workspace', function (): void {
|
|
46
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
47
|
+
const devWorkspaceConfigurationYamlString: string =
|
|
48
|
+
devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationYamlAsString(devfileContext);
|
|
49
|
+
const output: ShellString = kubernetesCommandLineToolsExecutor.applyAndWaitDevWorkspace(devWorkspaceConfigurationYamlString);
|
|
50
|
+
expect(output.stdout).contains('condition met');
|
|
51
|
+
});
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
suite('Clone public repo without previous setup', function (): void {
|
|
54
|
+
test('Check if public repo can be cloned', function (): void {
|
|
55
|
+
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
56
|
+
const cloneOutput: ShellString = containerTerminal.gitClone(gitRepository);
|
|
57
|
+
expect(cloneOutput.stdout + cloneOutput.stderr).includes('Cloning');
|
|
58
|
+
});
|
|
47
59
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
60
|
+
test('Check if project was created', function (): void {
|
|
61
|
+
clonedProjectName = StringUtil.getProjectNameFromGitUrl(gitRepository);
|
|
62
|
+
expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
63
|
+
});
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
test('Check if project files are imported', function (): void {
|
|
66
|
+
expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes(
|
|
67
|
+
BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME
|
|
68
|
+
);
|
|
69
|
+
});
|
|
58
70
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
suiteTeardown('Delete cloned project', function (): void {
|
|
72
|
+
containerTerminal.removeFolder(`${clonedProjectName}`);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
suiteTeardown('Delete workspace', function (): void {
|
|
70
|
-
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
71
|
-
});
|
|
76
|
+
suiteTeardown('Delete workspace', function (): void {
|
|
77
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
78
|
+
});
|
|
72
79
|
});
|
|
73
|
-
|
|
74
|
-
|
|
@@ -1,44 +1,54 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
1
10
|
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
11
|
import fs from 'fs';
|
|
3
12
|
import path from 'path';
|
|
4
13
|
import YAML from 'yaml';
|
|
5
14
|
import { expect } from 'chai';
|
|
6
15
|
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
16
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
7
17
|
|
|
8
|
-
suite(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
suite('Test defining pod overrides via attribute.', function (): void {
|
|
19
|
+
const pathToSampleFile: string = path.resolve(
|
|
20
|
+
`resources/pod-overrides${BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED() ? '-airgap' : ''}.yaml`
|
|
21
|
+
);
|
|
22
|
+
const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name;
|
|
23
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName);
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
suiteSetup('Login into OC client', function (): void {
|
|
26
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
27
|
+
});
|
|
16
28
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
suiteTeardown('Delete DevWorkspace', function (): void {
|
|
30
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
31
|
+
});
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
33
|
+
test('Apply pod-overrides sample as DevWorkspace with OC client', function (): void {
|
|
34
|
+
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
|
|
35
|
+
ShellExecutor.wait(5);
|
|
36
|
+
});
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
test('Check that fields are overridden in the Deployment for DevWorkspace', function (): void {
|
|
39
|
+
const devWorkspaceFullYamlOutput: any = YAML.parse(kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration());
|
|
40
|
+
expect(devWorkspaceFullYamlOutput.spec.template.attributes['pod-overrides']).eqls({
|
|
41
|
+
metadata: {
|
|
42
|
+
annotations: {
|
|
43
|
+
'io.kubernetes.cri-o.userns-mode': 'auto:size=65536;map-to-root=true',
|
|
44
|
+
'io.openshift.userns': 'true',
|
|
45
|
+
'openshift.io/scc': 'container-build'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
spec: {
|
|
49
|
+
runtimeClassName: 'kata',
|
|
50
|
+
schedulerName: 'stork'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
42
54
|
});
|
|
43
|
-
|
|
44
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2020-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -24,38 +24,42 @@ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUti
|
|
|
24
24
|
|
|
25
25
|
const stackName: string = 'Empty Workspace';
|
|
26
26
|
|
|
27
|
-
suite(`${stackName} test`,
|
|
28
|
-
|
|
27
|
+
suite(`${stackName} test`, function (): void {
|
|
28
|
+
loginTests.loginIntoChe();
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
|
|
31
|
+
await workspaceHandlingTests.createAndOpenWorkspace(stackName);
|
|
32
|
+
});
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
|
|
35
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
36
|
+
});
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
test('Register running workspace', function (): void {
|
|
39
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
40
|
+
});
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
test('Wait workspace readiness', async function (): Promise<void> {
|
|
43
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
const workbench: Workbench = new Workbench();
|
|
46
|
+
const activityBar: ActivityBar = workbench.getActivityBar();
|
|
47
|
+
const activityBarControls: ViewControl[] = await activityBar.getViewControls();
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
Logger.debug('Editor sections:');
|
|
50
|
+
for (const control of activityBarControls) {
|
|
51
|
+
Logger.debug(`${await control.getTitle()}`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
56
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
57
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
58
|
+
});
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
61
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
62
|
+
});
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
loginTests.logoutFromChe();
|
|
61
65
|
});
|