@eclipse-che/che-e2e 7.74.0-dev-1d09cb7 → 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.
Files changed (221) hide show
  1. package/.eslintignore +10 -0
  2. package/.eslintrc.js +183 -0
  3. package/.prettierignore +10 -0
  4. package/.prettierrc.json +10 -0
  5. package/README.md +47 -47
  6. package/configs/inversify.config.ts +13 -9
  7. package/configs/inversify.types.ts +29 -29
  8. package/configs/mocharc.ts +21 -24
  9. package/constants/API_TEST_CONSTANTS.ts +67 -0
  10. package/constants/BASE_TEST_CONSTANTS.ts +80 -0
  11. package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
  12. package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
  13. package/constants/MONACO_CONSTANTS.ts +25 -0
  14. package/constants/OAUTH_CONSTANTS.ts +67 -0
  15. package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
  16. package/constants/REPORTER_CONSTANTS.ts +53 -0
  17. package/constants/TIMEOUT_CONSTANTS.ts +131 -0
  18. package/dist/configs/inversify.config.js +14 -8
  19. package/dist/configs/inversify.config.js.map +1 -1
  20. package/dist/configs/inversify.types.js +2 -2
  21. package/dist/configs/inversify.types.js.map +1 -1
  22. package/dist/configs/mocharc.js +13 -16
  23. package/dist/configs/mocharc.js.map +1 -1
  24. package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +12 -12
  25. package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
  26. package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +16 -16
  27. package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
  28. package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +13 -13
  29. package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
  30. package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +14 -13
  31. package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
  32. package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +7 -7
  33. package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
  34. package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +14 -14
  35. package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
  36. package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
  37. package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
  38. package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +12 -12
  39. package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
  40. package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
  41. package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
  42. package/dist/driver/ChromeDriver.js +12 -16
  43. package/dist/driver/ChromeDriver.js.map +1 -1
  44. package/dist/index.js +9 -9
  45. package/dist/index.js.map +1 -1
  46. package/dist/pageobjects/dashboard/CreateWorkspace.js +11 -11
  47. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  48. package/dist/pageobjects/dashboard/Dashboard.js +16 -16
  49. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  50. package/dist/pageobjects/dashboard/Workspaces.js +28 -28
  51. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  52. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +36 -25
  53. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  54. package/dist/pageobjects/git-providers/OauthPage.js +20 -18
  55. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
  56. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +9 -9
  57. package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
  58. package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
  59. package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
  60. package/dist/pageobjects/login/kubernetes/DexLoginPage.js +5 -5
  61. package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
  62. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +5 -5
  63. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
  64. package/dist/pageobjects/login/openshift/OcpLoginPage.js +13 -13
  65. package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
  66. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +5 -5
  67. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
  68. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +6 -6
  69. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
  70. package/dist/pageobjects/login/openshift/RedHatLoginPage.js +5 -5
  71. package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
  72. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +8 -8
  73. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
  74. package/dist/pageobjects/openshift/OcpApplicationPage.js +5 -5
  75. package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
  76. package/dist/pageobjects/openshift/OcpImportFromGitPage.js +4 -4
  77. package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
  78. package/dist/pageobjects/openshift/OcpMainPage.js +6 -6
  79. package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
  80. package/dist/specs/MochaHooks.js +26 -23
  81. package/dist/specs/MochaHooks.js.map +1 -1
  82. package/dist/specs/SmokeTest.spec.js +11 -11
  83. package/dist/specs/SmokeTest.spec.js.map +1 -1
  84. package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
  85. package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
  86. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +26 -15
  87. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  88. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +17 -11
  89. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  90. package/dist/specs/api/PodOverridesAPI.spec.js +12 -3
  91. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  92. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +5 -5
  93. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  94. package/dist/specs/dashboard-samples/Quarkus.spec.js +7 -7
  95. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  96. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +41 -41
  97. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  98. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +14 -9
  99. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  100. package/dist/specs/factory/Factory.spec.js +25 -25
  101. package/dist/specs/factory/Factory.spec.js.map +1 -1
  102. package/dist/specs/factory/NoSetupRepoFactory.spec.js +37 -34
  103. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  104. package/dist/specs/factory/RefusedOAuthFactory.spec.js +33 -33
  105. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  106. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +12 -3
  107. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  108. package/dist/tests-library/LoginTests.js +7 -7
  109. package/dist/tests-library/LoginTests.js.map +1 -1
  110. package/dist/tests-library/ProjectAndFileTests.js +7 -5
  111. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  112. package/dist/tests-library/WorkspaceHandlingTests.js +16 -13
  113. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  114. package/dist/utils/BrowserTabsUtil.js +19 -14
  115. package/dist/utils/BrowserTabsUtil.js.map +1 -1
  116. package/dist/utils/CheReporter.js +44 -44
  117. package/dist/utils/CheReporter.js.map +1 -1
  118. package/dist/utils/DevWorkspaceConfigurationHelper.js +17 -8
  119. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  120. package/dist/utils/DevfilesRegistryHelper.js +19 -13
  121. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  122. package/dist/utils/DriverHelper.js +64 -66
  123. package/dist/utils/DriverHelper.js.map +1 -1
  124. package/dist/utils/KubernetesCommandLineToolsExecutor.js +28 -24
  125. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  126. package/dist/utils/Logger.js +18 -19
  127. package/dist/utils/Logger.js.map +1 -1
  128. package/dist/utils/ScreenCatcher.js +18 -12
  129. package/dist/utils/ScreenCatcher.js.map +1 -1
  130. package/dist/utils/ShellExecutor.js +9 -0
  131. package/dist/utils/ShellExecutor.js.map +1 -1
  132. package/dist/utils/StringUtil.js +15 -7
  133. package/dist/utils/StringUtil.js.map +1 -1
  134. package/dist/utils/request-handlers/CheApiRequestHandler.js +27 -27
  135. package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
  136. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
  137. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  138. package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
  139. package/dist/utils/workspace/ApiUrlResolver.js +3 -3
  140. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  141. package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
  142. package/dist/utils/workspace/TestWorkspaceUtil.js +21 -19
  143. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  144. package/dist/utils/workspace/WorkspaceStatus.js +2 -2
  145. package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
  146. package/driver/ChromeDriver.ts +44 -50
  147. package/driver/IDriver.ts +3 -3
  148. package/index.ts +9 -9
  149. package/package.json +59 -49
  150. package/pageobjects/dashboard/CreateWorkspace.ts +64 -55
  151. package/pageobjects/dashboard/Dashboard.ts +101 -100
  152. package/pageobjects/dashboard/Workspaces.ts +196 -164
  153. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +150 -125
  154. package/pageobjects/git-providers/OauthPage.ts +177 -166
  155. package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
  156. package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
  157. package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
  158. package/pageobjects/login/kubernetes/DexLoginPage.ts +31 -30
  159. package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +15 -14
  160. package/pageobjects/login/openshift/OcpLoginPage.ts +61 -54
  161. package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +29 -24
  162. package/pageobjects/login/openshift/OcpUserLoginPage.ts +15 -18
  163. package/pageobjects/login/openshift/RedHatLoginPage.ts +48 -46
  164. package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +38 -34
  165. package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
  166. package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
  167. package/pageobjects/openshift/OcpMainPage.ts +69 -68
  168. package/specs/MochaHooks.ts +59 -50
  169. package/specs/SmokeTest.spec.ts +43 -40
  170. package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
  171. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +106 -95
  172. package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
  173. package/specs/api/PodOverridesAPI.spec.ts +42 -33
  174. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -31
  175. package/specs/dashboard-samples/Quarkus.spec.ts +34 -34
  176. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -174
  177. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +61 -52
  178. package/specs/factory/Factory.spec.ts +178 -168
  179. package/specs/factory/NoSetupRepoFactory.spec.ts +226 -211
  180. package/specs/factory/RefusedOAuthFactory.spec.ts +218 -204
  181. package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -54
  182. package/tests-library/LoginTests.ts +34 -32
  183. package/tests-library/ProjectAndFileTests.ts +21 -18
  184. package/tests-library/WorkspaceHandlingTests.ts +98 -89
  185. package/tsconfig.json +15 -15
  186. package/utils/BrowserTabsUtil.ts +103 -97
  187. package/utils/CheReporter.ts +141 -145
  188. package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
  189. package/utils/DevfilesRegistryHelper.ts +67 -58
  190. package/utils/DriverHelper.ts +726 -700
  191. package/utils/KubernetesCommandLineToolsExecutor.ts +196 -180
  192. package/utils/Logger.ts +102 -125
  193. package/utils/ScreenCatcher.ts +57 -46
  194. package/utils/ShellExecutor.ts +19 -11
  195. package/utils/StringUtil.ts +40 -32
  196. package/utils/request-handlers/CheApiRequestHandler.ts +91 -88
  197. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
  198. package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
  199. package/utils/workspace/ApiUrlResolver.ts +31 -26
  200. package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
  201. package/utils/workspace/TestWorkspaceUtil.ts +152 -145
  202. package/utils/workspace/WorkspaceStatus.ts +5 -5
  203. package/constants/APITestConstants.ts +0 -57
  204. package/constants/BaseTestConstants.ts +0 -68
  205. package/constants/ChromeDriverConstants.ts +0 -46
  206. package/constants/FactoryTestConstants.ts +0 -51
  207. package/constants/MonacoConstants.ts +0 -22
  208. package/constants/OAuthConstants.ts +0 -57
  209. package/constants/PluginsTestConstants.ts +0 -15
  210. package/constants/ReporterConstants.ts +0 -45
  211. package/constants/TimeoutConstants.ts +0 -113
  212. package/dist/constants/APITestConstants.js.map +0 -1
  213. package/dist/constants/BaseTestConstants.js.map +0 -1
  214. package/dist/constants/ChromeDriverConstants.js.map +0 -1
  215. package/dist/constants/FactoryTestConstants.js.map +0 -1
  216. package/dist/constants/MonacoConstants.js.map +0 -1
  217. package/dist/constants/OAuthConstants.js.map +0 -1
  218. package/dist/constants/PluginsTestConstants.js.map +0 -1
  219. package/dist/constants/ReporterConstants.js.map +0 -1
  220. package/dist/constants/TimeoutConstants.js.map +0 -1
  221. package/tslint.json +0 -126
@@ -1,5 +1,5 @@
1
- /*********************************************************************
2
- * Copyright (c) 2023 Red Hat, Inc.
1
+ /** *******************************************************************
2
+ * copyright (c) 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
@@ -11,16 +11,16 @@
11
11
  import 'reflect-metadata';
12
12
  import { CLASSES, TYPES } from '../configs/inversify.types';
13
13
  import { CheApiRequestHandler } from '../utils/request-handlers/CheApiRequestHandler';
14
- import { TimeoutConstants } from '../constants/TimeoutConstants';
14
+ import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
15
15
  import * as monacoPageObjects from 'monaco-page-objects';
16
16
  import * as vscodeExtensionTesterLocators from 'vscode-extension-tester-locators';
17
17
  import { e2eContainer } from '../configs/inversify.config';
18
18
  import { DriverHelper } from '../utils/DriverHelper';
19
19
  import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
20
20
  import { Logger } from '../utils/Logger';
21
- import { BaseTestConstants } from '../constants/BaseTestConstants';
22
- import { ChromeDriverConstants } from '../constants/ChromeDriverConstants';
23
- import { MonacoConstants } from '../constants/MonacoConstants';
21
+ import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
22
+ import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
23
+ import { MONACO_CONSTANTS } from '../constants/MONACO_CONSTANTS';
24
24
 
25
25
  const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
26
26
  const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
@@ -28,51 +28,60 @@ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUt
28
28
  let latestWorkspace: string = '';
29
29
 
30
30
  export function registerRunningWorkspace(workspaceName: string): void {
31
- Logger.debug(`with workspaceName:${workspaceName}`);
32
- latestWorkspace = workspaceName;
31
+ Logger.debug(`with workspaceName:${workspaceName}`);
32
+ latestWorkspace = workspaceName;
33
33
  }
34
34
 
35
35
  exports.mochaHooks = {
36
- beforeAll: [
37
- async function enableRequestInterceptor(): Promise<void> {
38
- if (BaseTestConstants.TS_SELENIUM_REQUEST_INTERCEPTOR) {
39
- CheApiRequestHandler.enableRequestInterceptor();
40
- }
41
- },
42
- async function enableResponseInterceptor(): Promise<void> {
43
- if (BaseTestConstants.TS_SELENIUM_RESPONSE_INTERCEPTOR) {
44
- CheApiRequestHandler.enableResponseInterceptor();
45
- }
46
- },
47
- async function initMonacoPageObjects(): Promise<void> {
48
- // init vscode-extension-tester monaco-page-objects
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');
50
- },
51
- async function prolongTimeoutConstantsInDebugMode(): Promise<void> {
52
- if (BaseTestConstants.TS_DEBUG_MODE) {
53
- for (let [timeout, seconds] of Object.entries(TimeoutConstants)) {
54
- Object.defineProperty(TimeoutConstants, timeout, { value: seconds as number * 100 });
55
- }
56
- }
57
- },
58
- ],
59
- afterEach: [
60
- // stop and remove running workspace
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
- }
67
- }
68
- },
69
- ],
70
- afterAll: [
71
- async function stopTheDriver(): Promise<void> {
72
- if (!BaseTestConstants.TS_DEBUG_MODE && ChromeDriverConstants.TS_USE_WEB_DRIVER_FOR_TEST) {
73
- await driverHelper.getDriver().quit();
74
- Logger.info('Chrome driver session stopped.');
75
- }
76
- },
77
- ]
36
+ beforeAll: [
37
+ function enableRequestInterceptor(): void {
38
+ if (BASE_TEST_CONSTANTS.TS_SELENIUM_REQUEST_INTERCEPTOR) {
39
+ CheApiRequestHandler.enableRequestInterceptor();
40
+ }
41
+ },
42
+ function enableResponseInterceptor(): void {
43
+ if (BASE_TEST_CONSTANTS.TS_SELENIUM_RESPONSE_INTERCEPTOR) {
44
+ CheApiRequestHandler.enableResponseInterceptor();
45
+ }
46
+ },
47
+ function initMonacoPageObjects(): void {
48
+ // init vscode-extension-tester monaco-page-objects
49
+ monacoPageObjects.initPageObjects(
50
+ MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION,
51
+ MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION,
52
+ vscodeExtensionTesterLocators.getLocatorsPath(),
53
+ driverHelper.getDriver(),
54
+ 'google-chrome'
55
+ );
56
+ },
57
+ function prolongTimeoutConstantsInDebugMode(): void {
58
+ if (BASE_TEST_CONSTANTS.TS_DEBUG_MODE) {
59
+ for (const [timeout, seconds] of Object.entries(TIMEOUT_CONSTANTS)) {
60
+ Object.defineProperty(TIMEOUT_CONSTANTS, timeout, {
61
+ value: seconds * 100
62
+ });
63
+ }
64
+ }
65
+ }
66
+ ],
67
+ afterEach: [
68
+ // stop and remove running workspace
69
+ function (this: Mocha.Context): void {
70
+ if (this.currentTest?.state === 'failed') {
71
+ if (BASE_TEST_CONSTANTS.DELETE_WORKSPACE_ON_FAILED_TEST) {
72
+ Logger.info('Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete running workspace with API.');
73
+ // await
74
+ testWorkspaceUtil.stopAndDeleteWorkspaceByName(latestWorkspace);
75
+ }
76
+ }
77
+ }
78
+ ],
79
+ afterAll: [
80
+ async function stopTheDriver(): Promise<void> {
81
+ if (!BASE_TEST_CONSTANTS.TS_DEBUG_MODE && CHROME_DRIVER_CONSTANTS.TS_USE_WEB_DRIVER_FOR_TEST) {
82
+ await driverHelper.getDriver().quit();
83
+ Logger.info('Chrome driver session stopped.');
84
+ }
85
+ }
86
+ ]
78
87
  };
@@ -1,5 +1,5 @@
1
- /*********************************************************************
2
- * Copyright (c) 2023 Red Hat, Inc.
1
+ /** *******************************************************************
2
+ * copyright (c) 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
@@ -16,50 +16,53 @@ import { registerRunningWorkspace } from './MochaHooks';
16
16
  import { Logger } from '../utils/Logger';
17
17
  import { LoginTests } from '../tests-library/LoginTests';
18
18
  import { StringUtil } from '../utils/StringUtil';
19
- import { FactoryTestConstants } from '../constants/FactoryTestConstants';
19
+ import { FACTORY_TEST_CONSTANTS } from '../constants/FACTORY_TEST_CONSTANTS';
20
20
  import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
21
21
  import { expect } from 'chai';
22
- import { BaseTestConstants } from '../constants/BaseTestConstants';
22
+ import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
23
23
 
24
24
  const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
25
25
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
26
26
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
27
27
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
28
28
 
29
- suite(`The SmokeTest userstory`, async function(): Promise<void> {
30
- const factoryUrl: string = FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/che-incubator/quarkus-api-example.git';
31
- let projectSection: ViewSection;
32
- suite(`Create workspace from factory:${factoryUrl}`, async function(): Promise<void> {
33
- loginTests.loginIntoChe();
34
- test(`Create and open new workspace from factory:${factoryUrl}`, async function(): Promise<void> {
35
- await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
36
- });
37
- test('Obtain workspace name from workspace loader page', async function(): Promise<void> {
38
- await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
39
- });
40
- test('Register running workspace', async function(): Promise<void> {
41
- registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
42
- });
43
- test('Wait workspace readiness', async function(): Promise<void> {
44
- await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
45
- });
46
- test('Check a project folder has been created', async function(): Promise<void> {
47
- const projectName: string = FactoryTestConstants.TS_SELENIUM_PROJECT_NAME || StringUtil.getProjectNameFromGitUrl(factoryUrl);
48
- projectSection = await new SideBarView().getContent().getSection(projectName);
49
- Logger.debug(`new SideBarView().getContent().getSection: get ${projectName}`);
50
- });
51
- test('Check the project files was imported', async function(): Promise<void> {
52
- Logger.debug(`projectSection.findItem: find ${BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME}`);
53
- const isFileImported: ViewItem | undefined = await projectSection.findItem(BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
54
- expect(isFileImported).not.eqls(undefined);
55
- });
56
- test('Stop the workspace', async function(): Promise<void> {
57
- await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
58
- await browserTabsUtil.closeAllTabsExceptCurrent();
59
- });
60
- test('Delete the workspace', async function(): Promise<void> {
61
- await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
62
- });
63
- loginTests.logoutFromChe();
64
- });
29
+ suite('The SmokeTest userstory', function (): void {
30
+ const factoryUrl: string =
31
+ FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/che-incubator/quarkus-api-example.git';
32
+ let projectSection: ViewSection;
33
+ suite(`Create workspace from factory:${factoryUrl}`, function (): void {
34
+ loginTests.loginIntoChe();
35
+ test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
36
+ await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
37
+ });
38
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
39
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
40
+ });
41
+ test('Register running workspace', function (): void {
42
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
43
+ });
44
+ test('Wait workspace readiness', async function (): Promise<void> {
45
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
46
+ });
47
+ test('Check a project folder has been created', async function (): Promise<void> {
48
+ const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || StringUtil.getProjectNameFromGitUrl(factoryUrl);
49
+ projectSection = await new SideBarView().getContent().getSection(projectName);
50
+ Logger.debug(`new SideBarView().getContent().getSection: get ${projectName}`);
51
+ });
52
+ test('Check the project files was imported', async function (): Promise<void> {
53
+ Logger.debug(`projectSection.findItem: find ${BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME}`);
54
+ const isFileImported: ViewItem | undefined = await projectSection.findItem(
55
+ BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME
56
+ );
57
+ expect(isFileImported).not.eqls(undefined);
58
+ });
59
+ test('Stop the workspace', async function (): Promise<void> {
60
+ await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
61
+ await browserTabsUtil.closeAllTabsExceptCurrent();
62
+ });
63
+ test('Delete the workspace', async function (): Promise<void> {
64
+ await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
65
+ });
66
+ loginTests.logoutFromChe();
67
+ });
65
68
  });
@@ -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(`Test defining container overrides via attribute.`, async function(): Promise<void> {
9
- const pathToSampleFile: string = path.resolve('resources/container-overrides.yaml');
10
- const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name;
11
- const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName);
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
- suiteSetup('Login into OC client', function(): void {
14
- kubernetesCommandLineToolsExecutor.loginToOcp();
15
- });
22
+ suiteSetup('Login into OC client', function (): void {
23
+ kubernetesCommandLineToolsExecutor.loginToOcp();
24
+ });
16
25
 
17
- suiteTeardown('Delete DevWorkspace', function(): void {
18
- kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
19
- });
26
+ suiteTeardown('Delete DevWorkspace', function (): void {
27
+ kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
28
+ });
20
29
 
21
- test('Apply container-overrides sample as DevWorkspace with OC client', function(): void {
22
- kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
23
- ShellExecutor.wait(5);
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
- test('Check that fields are overridden in the Deployment for DevWorkspace', function(): void {
27
- const devWorkspaceFullYamlOutput: any = YAML.parse(kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration());
28
- expect(devWorkspaceFullYamlOutput.spec.template.components[0].attributes['container-overrides']).eqls({
29
- resources: {
30
- limits: {
31
- 'nvidia.com/gpu': '1'
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,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 { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
3
12
  import { ShellString } from 'shelljs';
@@ -8,101 +17,103 @@ import { StringUtil } from '../../utils/StringUtil';
8
17
  import { Logger } from '../../utils/Logger';
9
18
 
10
19
  /**
11
- * Dynamically generating tests
20
+ * dynamically generating tests
12
21
  * info: https://mochajs.org/#delayed-root-suite
13
22
  */
14
-
15
- (async function(): Promise<void> {
16
-
17
- // todo: skipped while don`t use to avoid sending useless requests
18
- // const devfilesRegistryHelper: DevfilesRegistryHelper = new DevfilesRegistryHelper();
19
- const devfileSamples: any = [];
20
- // devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry();
21
-
22
- for (const devfileSample of devfileSamples) {
23
- suite.skip(`Devfile acceptance test suite for ${devfileSample.name}`, async function(): Promise<void> {
24
- this.bail(false);
25
- this.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes
26
- let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
27
- let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
28
- let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
29
- let devfileContext: DevfileContext;
30
- let devWorkspaceName: string | undefined;
31
- let clonedProjectName: string;
32
- let containerWorkDir: string;
33
- let devfilesBuildCommands: any[] = [];
34
-
35
- test('Get DevWorkspace configuration', async function(): Promise<void> {
36
- devWorkspaceConfigurationHelper = new DevWorkspaceConfigurationHelper({
37
- devfileUrl: devfileSample.link
38
- });
39
- devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
40
- devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
41
-
42
- kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName);
43
- containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
44
- kubernetesCommandLineToolsExecutor.loginToOcp();
45
- });
46
-
47
- test('Collect build commands from the devfile', async function(): Promise<void> {
48
- if (devfileContext.devfile.commands === undefined) {
49
- Logger.info(`Devfile does not contains any commands.`);
50
- } else {
51
- devfileContext.devfile.commands.forEach((command: any) => {
52
- if (command.exec?.group?.kind === 'build') {
53
- Logger.debug(`Build command found: ${command.exec.commandLine}`);
54
- devfilesBuildCommands.push(command);
55
- }
56
- });
57
- }
58
- });
59
-
60
- test('Create DevWorkspace', async function(): Promise<void> {
61
- const devWorkspaceConfigurationYamlString: string = await devWorkspaceConfigurationHelper.getDevWorkspaceConfigurationYamlAsString(devfileContext);
62
- const applyOutput: ShellString = kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsStringOutput(devWorkspaceConfigurationYamlString);
63
-
64
- expect(applyOutput.stdout)
65
- .contains('devworkspacetemplate')
66
- .and.contains('devworkspace')
67
- .and.contains.oneOf(['created', 'configured']);
68
-
69
- });
70
-
71
- test('Wait until DevWorkspace has status "ready"', async function(): Promise<void> {
72
- expect(kubernetesCommandLineToolsExecutor.waitDevWorkspace().stdout).contains('condition met');
73
- });
74
-
75
- test('Check if project was created', function(): void {
76
- clonedProjectName = StringUtil.getProjectNameFromGitUrl(devfileSample.link);
77
- expect(containerTerminal.ls().stdout).includes(clonedProjectName);
78
- });
79
-
80
- test('Check if project files are imported', function(): void {
81
- containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
82
- expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes(`devfile.yaml`);
83
- });
84
-
85
- test(`Check if build commands returns success`, function(): void {
86
- if (devfilesBuildCommands.length === 0) {
87
- Logger.info(`Devfile does not contains build commands.`);
88
- } else {
89
- devfilesBuildCommands.forEach((command) => {
90
- Logger.info(`command.exec: ${JSON.stringify(command.exec)}`);
91
-
92
- const commandString: string = StringUtil.updateCommandEnvsToShStyle(`cd ${command.exec.workingDir} && ${command.exec.commandLine}`);
93
- Logger.info(`Full build command to be executed: ${commandString}`);
94
-
95
- const output: ShellString = containerTerminal.executeCommand(commandString, command.exec.component);
96
- expect(output.code).eqls(0);
97
- });
98
- }
99
- });
100
-
101
- test('Delete DevWorkspace', async function(): Promise<void> {
102
- kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
103
- });
104
- });
105
- }
106
-
107
- run();
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();
108
119
  })();