@eclipse-che/che-e2e 7.74.0-dev-1d09cb7 → 7.74.0-dev-aace77a

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 (229) hide show
  1. package/.eslintignore +10 -0
  2. package/.eslintrc.js +197 -0
  3. package/.prettierignore +10 -0
  4. package/.prettierrc.json +10 -0
  5. package/CODE_STYLE.md +144 -0
  6. package/README.md +47 -47
  7. package/configs/inversify.config.ts +39 -14
  8. package/configs/inversify.types.ts +44 -30
  9. package/configs/mocharc.ts +21 -24
  10. package/constants/API_TEST_CONSTANTS.ts +67 -0
  11. package/constants/BASE_TEST_CONSTANTS.ts +80 -0
  12. package/constants/CHROME_DRIVER_CONSTANTS.ts +42 -0
  13. package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
  14. package/constants/MONACO_CONSTANTS.ts +25 -0
  15. package/constants/OAUTH_CONSTANTS.ts +67 -0
  16. package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
  17. package/constants/REPORTER_CONSTANTS.ts +53 -0
  18. package/constants/TIMEOUT_CONSTANTS.ts +131 -0
  19. package/dist/configs/inversify.config.js +36 -9
  20. package/dist/configs/inversify.config.js.map +1 -1
  21. package/dist/configs/inversify.types.js +19 -5
  22. package/dist/configs/inversify.types.js.map +1 -1
  23. package/dist/configs/mocharc.js +13 -16
  24. package/dist/configs/mocharc.js.map +1 -1
  25. package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +12 -12
  26. package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
  27. package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +16 -16
  28. package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
  29. package/dist/constants/CHROME_DRIVER_CONSTANTS.js +36 -0
  30. package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
  31. package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +14 -13
  32. package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
  33. package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +7 -7
  34. package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
  35. package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +14 -14
  36. package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
  37. package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
  38. package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
  39. package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +12 -12
  40. package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
  41. package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
  42. package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
  43. package/dist/driver/ChromeDriver.js +12 -22
  44. package/dist/driver/ChromeDriver.js.map +1 -1
  45. package/dist/index.js +18 -12
  46. package/dist/index.js.map +1 -1
  47. package/dist/pageobjects/dashboard/CreateWorkspace.js +15 -15
  48. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  49. package/dist/pageobjects/dashboard/Dashboard.js +20 -21
  50. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  51. package/dist/pageobjects/dashboard/Workspaces.js +55 -60
  52. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  53. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +58 -48
  54. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  55. package/dist/pageobjects/git-providers/OauthPage.js +22 -20
  56. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
  57. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +26 -12
  58. package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
  59. package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
  60. package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
  61. package/dist/pageobjects/login/kubernetes/DexLoginPage.js +14 -14
  62. package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
  63. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +7 -7
  64. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
  65. package/dist/pageobjects/login/openshift/OcpLoginPage.js +24 -28
  66. package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
  67. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +13 -16
  68. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
  69. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +9 -9
  70. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
  71. package/dist/pageobjects/login/openshift/RedHatLoginPage.js +19 -23
  72. package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
  73. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +20 -19
  74. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
  75. package/dist/pageobjects/openshift/OcpApplicationPage.js +11 -11
  76. package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
  77. package/dist/pageobjects/openshift/OcpImportFromGitPage.js +24 -24
  78. package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
  79. package/dist/pageobjects/openshift/OcpMainPage.js +30 -30
  80. package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
  81. package/dist/specs/MochaHooks.js +33 -27
  82. package/dist/specs/MochaHooks.js.map +1 -1
  83. package/dist/specs/SmokeTest.spec.js +17 -17
  84. package/dist/specs/SmokeTest.spec.js.map +1 -1
  85. package/dist/specs/api/ContainerOverridesAPI.spec.js +8 -6
  86. package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
  87. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +27 -24
  88. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  89. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +17 -17
  90. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  91. package/dist/specs/api/PodOverridesAPI.spec.js +10 -8
  92. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  93. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +10 -10
  94. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  95. package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -13
  96. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  97. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +52 -52
  98. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  99. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +23 -19
  100. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  101. package/dist/specs/factory/Factory.spec.js +38 -41
  102. package/dist/specs/factory/Factory.spec.js.map +1 -1
  103. package/dist/specs/factory/NoSetupRepoFactory.spec.js +52 -50
  104. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  105. package/dist/specs/factory/RefusedOAuthFactory.spec.js +49 -51
  106. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  107. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +45 -42
  108. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  109. package/dist/tests-library/LoginTests.js +13 -13
  110. package/dist/tests-library/LoginTests.js.map +1 -1
  111. package/dist/tests-library/ProjectAndFileTests.js +9 -7
  112. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  113. package/dist/tests-library/WorkspaceHandlingTests.js +22 -19
  114. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  115. package/dist/utils/BrowserTabsUtil.js +21 -21
  116. package/dist/utils/BrowserTabsUtil.js.map +1 -1
  117. package/dist/utils/CheReporter.js +91 -65
  118. package/dist/utils/CheReporter.js.map +1 -1
  119. package/dist/utils/DevWorkspaceConfigurationHelper.js +34 -15
  120. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  121. package/dist/utils/DevfilesRegistryHelper.js +34 -18
  122. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  123. package/dist/utils/DriverHelper.js +73 -68
  124. package/dist/utils/DriverHelper.js.map +1 -1
  125. package/dist/utils/IContextParams.js +12 -0
  126. package/dist/utils/IContextParams.js.map +1 -0
  127. package/dist/utils/IKubernetesCommandLineToolsExecutor.js +3 -0
  128. package/dist/utils/IKubernetesCommandLineToolsExecutor.js.map +1 -0
  129. package/dist/utils/KubernetesCommandLineToolsExecutor.js +146 -107
  130. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  131. package/dist/utils/Logger.js +18 -19
  132. package/dist/utils/Logger.js.map +1 -1
  133. package/dist/utils/ScreenCatcher.js +26 -16
  134. package/dist/utils/ScreenCatcher.js.map +1 -1
  135. package/dist/utils/ShellExecutor.js +29 -9
  136. package/dist/utils/ShellExecutor.js.map +1 -1
  137. package/dist/utils/StringUtil.js +19 -9
  138. package/dist/utils/StringUtil.js.map +1 -1
  139. package/dist/utils/request-handlers/CheApiRequestHandler.js +29 -29
  140. package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
  141. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +12 -8
  142. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  143. package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
  144. package/dist/utils/workspace/ApiUrlResolver.js +5 -5
  145. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  146. package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
  147. package/dist/utils/workspace/TestWorkspaceUtil.js +25 -23
  148. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  149. package/dist/utils/workspace/WorkspaceStatus.js +2 -2
  150. package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
  151. package/driver/ChromeDriver.ts +45 -58
  152. package/driver/IDriver.ts +3 -3
  153. package/index.ts +11 -9
  154. package/package.json +59 -49
  155. package/pageobjects/dashboard/CreateWorkspace.ts +65 -55
  156. package/pageobjects/dashboard/Dashboard.ts +100 -100
  157. package/pageobjects/dashboard/Workspaces.ts +210 -186
  158. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +153 -131
  159. package/pageobjects/git-providers/OauthPage.ts +177 -166
  160. package/pageobjects/ide/CheCodeLocatorLoader.ts +51 -46
  161. package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
  162. package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
  163. package/pageobjects/login/kubernetes/DexLoginPage.ts +31 -30
  164. package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +15 -14
  165. package/pageobjects/login/openshift/OcpLoginPage.ts +51 -56
  166. package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +27 -27
  167. package/pageobjects/login/openshift/OcpUserLoginPage.ts +15 -18
  168. package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -46
  169. package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +43 -34
  170. package/pageobjects/openshift/OcpApplicationPage.ts +21 -19
  171. package/pageobjects/openshift/OcpImportFromGitPage.ts +68 -68
  172. package/pageobjects/openshift/OcpMainPage.ts +69 -69
  173. package/specs/MochaHooks.ts +59 -52
  174. package/specs/SmokeTest.spec.ts +47 -45
  175. package/specs/api/ContainerOverridesAPI.spec.ts +39 -26
  176. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +110 -97
  177. package/specs/api/EmptyWorkspaceAPI.spec.ts +67 -58
  178. package/specs/api/PodOverridesAPI.spec.ts +48 -34
  179. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +36 -36
  180. package/specs/dashboard-samples/Quarkus.spec.ts +41 -40
  181. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +202 -183
  182. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +85 -75
  183. package/specs/factory/Factory.spec.ts +184 -178
  184. package/specs/factory/NoSetupRepoFactory.spec.ts +233 -219
  185. package/specs/factory/RefusedOAuthFactory.spec.ts +223 -211
  186. package/specs/miscellaneous/PredefinedNamespace.spec.ts +70 -64
  187. package/tests-library/LoginTests.ts +34 -32
  188. package/tests-library/ProjectAndFileTests.ts +21 -18
  189. package/tests-library/WorkspaceHandlingTests.ts +98 -89
  190. package/tsconfig.json +15 -15
  191. package/utils/BrowserTabsUtil.ts +78 -74
  192. package/utils/CheReporter.ts +159 -157
  193. package/utils/DevWorkspaceConfigurationHelper.ts +63 -69
  194. package/utils/DevfilesRegistryHelper.ts +71 -57
  195. package/utils/DriverHelper.ts +728 -700
  196. package/utils/IContextParams.ts +26 -0
  197. package/utils/IKubernetesCommandLineToolsExecutor.ts +42 -0
  198. package/utils/KubernetesCommandLineToolsExecutor.ts +231 -183
  199. package/utils/Logger.ts +102 -125
  200. package/utils/ScreenCatcher.ts +57 -46
  201. package/utils/ShellExecutor.ts +23 -12
  202. package/utils/StringUtil.ts +49 -36
  203. package/utils/request-handlers/CheApiRequestHandler.ts +91 -88
  204. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
  205. package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
  206. package/utils/workspace/ApiUrlResolver.ts +31 -26
  207. package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
  208. package/utils/workspace/TestWorkspaceUtil.ts +152 -145
  209. package/utils/workspace/WorkspaceStatus.ts +5 -5
  210. package/constants/APITestConstants.ts +0 -57
  211. package/constants/BaseTestConstants.ts +0 -68
  212. package/constants/ChromeDriverConstants.ts +0 -46
  213. package/constants/FactoryTestConstants.ts +0 -51
  214. package/constants/MonacoConstants.ts +0 -22
  215. package/constants/OAuthConstants.ts +0 -57
  216. package/constants/PluginsTestConstants.ts +0 -15
  217. package/constants/ReporterConstants.ts +0 -45
  218. package/constants/TimeoutConstants.ts +0 -113
  219. package/dist/constants/APITestConstants.js.map +0 -1
  220. package/dist/constants/BaseTestConstants.js.map +0 -1
  221. package/dist/constants/ChromeDriverConstants.js +0 -44
  222. package/dist/constants/ChromeDriverConstants.js.map +0 -1
  223. package/dist/constants/FactoryTestConstants.js.map +0 -1
  224. package/dist/constants/MonacoConstants.js.map +0 -1
  225. package/dist/constants/OAuthConstants.js.map +0 -1
  226. package/dist/constants/PluginsTestConstants.js.map +0 -1
  227. package/dist/constants/ReporterConstants.js.map +0 -1
  228. package/dist/constants/TimeoutConstants.js.map +0 -1
  229. package/tslint.json +0 -126
@@ -1,5 +1,5 @@
1
- /*********************************************************************
2
- * Copyright (c) 2021 Red Hat, Inc.
1
+ /** *******************************************************************
2
+ * copyright (c) 2021 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,20 +11,20 @@
11
11
  import 'reflect-metadata';
12
12
  import { e2eContainer } from '../../configs/inversify.config';
13
13
  import {
14
- ActivityBar,
15
- ContextMenu,
16
- EditorView,
17
- error,
18
- InputBox,
19
- Locators,
20
- ModalDialog,
21
- NewScmView,
22
- SideBarView,
23
- SingleScmProvider,
24
- TextEditor,
25
- ViewControl,
26
- ViewItem,
27
- ViewSection
14
+ ActivityBar,
15
+ ContextMenu,
16
+ EditorView,
17
+ error,
18
+ InputBox,
19
+ Locators,
20
+ ModalDialog,
21
+ NewScmView,
22
+ SideBarView,
23
+ SingleScmProvider,
24
+ TextEditor,
25
+ ViewControl,
26
+ ViewItem,
27
+ ViewSection
28
28
  } from 'monaco-page-objects';
29
29
  import { expect } from 'chai';
30
30
  import { registerRunningWorkspace } from '../MochaHooks';
@@ -37,226 +37,238 @@ import { DriverHelper } from '../../utils/DriverHelper';
37
37
  import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
38
38
  import { StringUtil } from '../../utils/StringUtil';
39
39
  import { Logger } from '../../utils/Logger';
40
- import { TimeoutConstants } from '../../constants/TimeoutConstants';
40
+ import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
41
41
  import { LoginTests } from '../../tests-library/LoginTests';
42
- import { OAuthConstants } from '../../constants/OAuthConstants';
43
- import { BaseTestConstants } from '../../constants/BaseTestConstants';
44
- import { FactoryTestConstants, GitProviderType } from '../../constants/FactoryTestConstants';
42
+ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
43
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
44
+ import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
45
45
  import WebDriverError = error.WebDriverError;
46
46
 
47
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
48
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
49
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
50
- const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
51
- const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
52
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
47
+ suite(
48
+ `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`,
49
+ function (): void {
50
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
51
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
52
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
53
+ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
54
+ const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
55
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
56
+ const oauthPage: OauthPage = e2eContainer.get(CLASSES.OauthPage);
53
57
 
54
- suite(`Create a workspace via launching a factory from the ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`, async function(): Promise<void> {
55
- const oauthPage: OauthPage = new OauthPage(driverHelper);
58
+ let projectSection: ViewSection;
59
+ let scmProvider: SingleScmProvider;
60
+ let scmContextMenu: ContextMenu;
56
61
 
57
- let projectSection: ViewSection;
58
- let scmProvider: SingleScmProvider;
59
- let rest: SingleScmProvider[];
60
- let scmContextMenu: ContextMenu;
62
+ // test specific data
63
+ const timeToRefresh: number = 1500;
64
+ const changesToCommit: string = new Date().getTime().toString();
65
+ const fileToChange: string = 'Date.txt';
66
+ const commitChangesButtonLabel: string = `Commit Changes on "${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
67
+ const refreshButtonLabel: string = 'Refresh';
68
+ const pushItemLabel: string = 'Push';
69
+ const label: string = BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
70
+ let testRepoProjectName: string;
71
+ const isPrivateRepo: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
61
72
 
62
- // test specific data
63
- const timeToRefresh: number = 1500;
64
- const changesToCommit: string = (new Date()).getTime().toString();
65
- const fileToChange: string = 'Date.txt';
66
- const commitChangesButtonLabel: string = `Commit Changes on "${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
67
- const refreshButtonLabel: string = 'Refresh';
68
- const pushItemLabel: string = 'Push';
69
- const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
70
- let testRepoProjectName: string;
71
- const isPrivateRepo: string = FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
73
+ loginTests.loginIntoChe();
72
74
 
73
- loginTests.loginIntoChe();
75
+ test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
76
+ await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
77
+ });
74
78
 
75
- test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function(): Promise<void> {
76
- await browserTabsUtil.navigateTo(FactoryTestConstants.TS_SELENIUM_FACTORY_URL());
77
- });
79
+ if (OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
80
+ test(`Authorize with a ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise<void> {
81
+ await oauthPage.login();
82
+ await oauthPage.waitOauthPage();
83
+ await oauthPage.denyAccess();
84
+ });
85
+ }
78
86
 
79
- if (OAuthConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
80
- test(`Authorize with a ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function(): Promise<void> {
81
- await oauthPage.login();
82
- await oauthPage.waitOauthPage();
83
- await oauthPage.denyAccess();
84
- });
85
- }
87
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
88
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
89
+ });
86
90
 
87
- test('Obtain workspace name from workspace loader page', async function(): Promise<void> {
88
- await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
89
- });
91
+ test('The workspace starts with access deny flag in the url', async function (): Promise<void> {
92
+ expect(await driverHelper.getDriver().getCurrentUrl()).contains('&error_code=access_denied');
93
+ });
90
94
 
91
- test('The workspace starts with access deny flag in the url', async function(): Promise<void> {
92
- expect(await driverHelper.getDriver().getCurrentUrl()).contains('&error_code=access_denied');
93
- });
95
+ test('Registering the running workspace', function (): void {
96
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
97
+ });
94
98
 
95
- test('Registering the running workspace', async function(): Promise<void> {
96
- registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
97
- });
99
+ test('Wait the workspace readiness', async function (): Promise<void> {
100
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
101
+ });
98
102
 
99
- test('Wait the workspace readiness', async function(): Promise<void> {
100
- await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
101
- });
103
+ test('Check if a project folder has been created', async function (): Promise<void> {
104
+ testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL);
105
+ Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
106
+ projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
107
+ });
102
108
 
103
- test('Check if a project folder has been created', async function(): Promise<void> {
104
- testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
105
- Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
106
- projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
107
- });
109
+ test('Accept the project as a trusted one', async function (): Promise<void> {
110
+ // click somewhere to trigger "Welcome Content" dialog
111
+ try {
112
+ await driverHelper.waitAndClick(webCheCodeLocators.Workbench.notificationItem);
113
+ } catch (e) {
114
+ Logger.info(`Click on ${webCheCodeLocators.Workbench.notificationItem} to get "Welcome Content" dialog ${e as string}`);
115
+ }
116
+ // "Welcome Content" dialog can be shown before of after dialog with an error for private repo
117
+ try {
118
+ const buttonYesITrustTheAuthors: string = 'Yes, I trust the authors';
119
+ await driverHelper.waitVisibility(
120
+ webCheCodeLocators.WelcomeContent.text,
121
+ TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
122
+ );
123
+ const welcomeContentDialog: ModalDialog = new ModalDialog();
124
+ Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
125
+ await welcomeContentDialog.pushButton(buttonYesITrustTheAuthors);
126
+ await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
127
+ } catch (e) {
128
+ Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
129
+ if (!FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
130
+ throw new WebDriverError(e as string);
131
+ }
132
+ }
133
+ });
108
134
 
109
- test('Accept the project as a trusted one', async function(): Promise<void> {
110
- // click somewhere to trigger "Welcome Content" dialog
111
- try {
112
- await driverHelper.waitAndClick(webCheCodeLocators.Workbench.notificationItem);
113
- } catch (e) {
114
- Logger.info(`Click on ${webCheCodeLocators.Workbench.notificationItem} to get "Welcome Content" dialog ${e as string}`);
115
- }
116
- // "Welcome Content" dialog can be shown before of after dialog with an error for private repo
117
- try {
118
- const buttonYesITrustTheAuthors: string = `Yes, I trust the authors`;
119
- await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.text, TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
120
- const welcomeContentDialog: ModalDialog = new ModalDialog();
121
- Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
122
- await welcomeContentDialog.pushButton(buttonYesITrustTheAuthors);
123
- await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
124
- } catch (e) {
125
- Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
126
- if (!FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
127
- throw new WebDriverError(e as string);
128
- }
129
- }
130
- });
135
+ if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
136
+ test('Check that project can not be cloned', async function (): Promise<void> {
137
+ await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message);
138
+ const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog();
139
+ const message: string = await workspaceDoesNotExistDialog.getMessage();
140
+ expect(message).contains('space does not exist');
141
+ });
131
142
 
132
- if (FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
133
- test('Check that project can not be cloned', async function(): Promise<void> {
134
- await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message);
135
- const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog();
136
- const message: string = await workspaceDoesNotExistDialog.getMessage();
137
- expect(message).contains('space does not exist');
138
- });
143
+ test('Check that project files were not imported', async function (): Promise<void> {
144
+ const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
145
+ expect(isFileImported).eqls(undefined);
146
+ });
147
+ } else {
148
+ test('Check if the project files were imported', async function (): Promise<void> {
149
+ Logger.debug(`projectSection.findItem: find ${label}`);
150
+ const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
151
+ // projectSection.findItem(label) can return undefined but test will goes on
152
+ expect(isFileImported).not.eqls(undefined);
153
+ });
139
154
 
140
- test('Check that project files were not imported', async function(): Promise<void> {
141
- const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
142
- expect(isFileImported).eqls(undefined);
143
- });
155
+ test('Make changes to the file', async function (): Promise<void> {
156
+ Logger.debug(`projectSection.openItem: "${fileToChange}"`);
157
+ await projectSection.openItem(fileToChange);
158
+ const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
159
+ await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
160
+ Logger.debug('editor.clearText');
161
+ await editor.clearText();
162
+ Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
163
+ await editor.typeTextAt(1, 1, changesToCommit);
164
+ });
144
165
 
145
- } else {
146
- test('Check if the project files were imported', async function(): Promise<void> {
147
- Logger.debug(`projectSection.findItem: find ${label}`);
148
- const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
149
- // projectSection.findItem(label) can return undefined but test will goes on
150
- expect(isFileImported).not.eqls(undefined);
151
- });
166
+ test('Open a source control manager', async function (): Promise<void> {
167
+ const viewSourceControl: string = 'Source Control';
168
+ const sourceControl: ViewControl = (await new ActivityBar().getViewControl(viewSourceControl)) as ViewControl;
169
+ Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
170
+ await sourceControl.openView();
171
+ const scmView: NewScmView = new NewScmView();
172
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
173
+ let rest: SingleScmProvider[];
174
+ [scmProvider, ...rest] = await scmView.getProviders();
175
+ Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
176
+ });
152
177
 
153
- test('Make changes to the file', async function(): Promise<void> {
154
- Logger.debug(`projectSection.openItem: "${fileToChange}"`);
155
- await projectSection.openItem(fileToChange);
156
- const editor: TextEditor = await new EditorView().openEditor(fileToChange) as TextEditor;
157
- await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
158
- Logger.debug(`editor.clearText`);
159
- await editor.clearText();
160
- Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
161
- await editor.typeTextAt(1, 1, changesToCommit);
162
- });
178
+ test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
179
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
180
+ await driverHelper.wait(timeToRefresh);
181
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
182
+ await scmProvider.takeAction(refreshButtonLabel);
183
+ // wait while changes counter will be refreshed
184
+ await driverHelper.wait(timeToRefresh);
185
+ const changes: number = await scmProvider.getChangeCount();
186
+ Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
187
+ expect(changes).eql(1);
188
+ });
163
189
 
164
- test('Open a source control manager', async function(): Promise<void> {
165
- const viewSourceControl: string = `Source Control`;
166
- const sourceControl: ViewControl = await new ActivityBar().getViewControl(viewSourceControl) as ViewControl;
167
- Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
168
- await sourceControl.openView();
169
- const scmView: NewScmView = new NewScmView();
170
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
171
- [scmProvider, ...rest] = await scmView.getProviders();
172
- Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
173
- });
190
+ test('Stage the changes', async function (): Promise<void> {
191
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
192
+ Logger.debug('scmProvider.openMoreActions');
193
+ scmContextMenu = await scmProvider.openMoreActions();
194
+ await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
195
+ Logger.debug('scmContextMenu.select: "Changes" -> "Stage All Changes"');
196
+ await scmContextMenu.select('Changes', 'Stage All Changes');
197
+ });
174
198
 
175
- test('Check if the changes are displayed in the source control manager', async function(): Promise<void> {
176
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
177
- await driverHelper.wait(timeToRefresh);
178
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
179
- await scmProvider.takeAction(refreshButtonLabel);
180
- // wait while changes counter will be refreshed
181
- await driverHelper.wait(timeToRefresh);
182
- const changes: number = await scmProvider.getChangeCount();
183
- Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
184
- expect(changes).eql(1);
185
- });
199
+ test('Commit the changes', async function (): Promise<void> {
200
+ Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
201
+ await scmProvider.commitChanges('Commit ' + changesToCommit);
202
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
203
+ await driverHelper.wait(timeToRefresh);
204
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
205
+ await scmProvider.takeAction(refreshButtonLabel);
206
+ // wait while changes counter will be refreshed
207
+ await driverHelper.wait(timeToRefresh);
208
+ const changes: number = await scmProvider.getChangeCount();
209
+ Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
210
+ expect(changes).eql(0);
211
+ });
186
212
 
187
- test('Stage the changes', async function(): Promise<void> {
188
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
189
- Logger.debug(`scmProvider.openMoreActions`);
190
- scmContextMenu = await scmProvider.openMoreActions();
191
- await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
192
- Logger.debug(`scmContextMenu.select: "Changes" -> "Stage All Changes"`);
193
- await scmContextMenu.select('Changes', 'Stage All Changes');
194
- });
213
+ test('Push the changes', async function (): Promise<void> {
214
+ await driverHelper.waitVisibility(
215
+ webCheCodeLocators.ScmView.actionConstructor(
216
+ `Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
217
+ )
218
+ );
219
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
220
+ Logger.debug('scmProvider.openMoreActions');
221
+ scmContextMenu = await scmProvider.openMoreActions();
222
+ await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
223
+ Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
224
+ await scmContextMenu.select(pushItemLabel);
225
+ });
195
226
 
196
- test('Commit the changes', async function(): Promise<void> {
197
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
198
- Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
199
- await scmProvider.commitChanges('Commit ' + changesToCommit);
200
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
201
- await driverHelper.wait(timeToRefresh);
202
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
203
- await scmProvider.takeAction(refreshButtonLabel);
204
- // wait while changes counter will be refreshed
205
- await driverHelper.wait(timeToRefresh);
206
- const changes: number = await scmProvider.getChangeCount();
207
- Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
208
- expect(changes).eql(0);
209
- });
210
-
211
- test('Push the changes', async function(): Promise<void> {
212
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
213
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
214
- Logger.debug(`scmProvider.openMoreActions`);
215
- scmContextMenu = await scmProvider.openMoreActions();
216
- await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
217
- Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
218
- await scmContextMenu.select(pushItemLabel);
219
- });
220
-
221
- test('Insert git credentials which were asked after push', async function(): Promise<void> {
222
- try {
223
- await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
224
- } catch (e) {
225
- Logger.info(`Workspace did not ask credentials before push - ${e};
227
+ test('Insert git credentials which were asked after push', async function (): Promise<void> {
228
+ try {
229
+ await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
230
+ } catch (e) {
231
+ Logger.info(`Workspace did not ask credentials before push - ${e};
226
232
  Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
227
- expect(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
228
- }
229
- const input: InputBox = new InputBox();
230
- await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_USERNAME);
231
- await input.confirm();
232
- await driverHelper.wait(timeToRefresh);
233
- await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
234
- await input.confirm();
235
- await driverHelper.wait(timeToRefresh);
236
- });
233
+ expect(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
234
+ }
235
+ const input: InputBox = new InputBox();
236
+ await input.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
237
+ await input.confirm();
238
+ await driverHelper.wait(timeToRefresh);
239
+ await input.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
240
+ await input.confirm();
241
+ await driverHelper.wait(timeToRefresh);
242
+ });
237
243
 
238
- test('Check if the changes were pushed', async function(): Promise<void> {
239
- try {
240
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
241
- await scmProvider.takeAction(refreshButtonLabel);
242
- } catch (e) {
243
- Logger.info('Check you use correct credentials.' +
244
- 'For bitbucket.org ensure you use an app password: https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/;' +
245
- 'For github.com - personal access token instead of password.');
246
- }
247
- const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel), 'aria-disabled');
248
- expect(isCommitButtonDisabled).eql('true');
249
- });
250
- }
244
+ test('Check if the changes were pushed', async function (): Promise<void> {
245
+ try {
246
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
247
+ await scmProvider.takeAction(refreshButtonLabel);
248
+ } catch (e) {
249
+ Logger.info(
250
+ 'Check you use correct credentials.' +
251
+ 'For bitbucket.org ensure you use an app password: https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/;' +
252
+ 'For github.com - personal access token instead of password.'
253
+ );
254
+ }
255
+ const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
256
+ webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel),
257
+ 'aria-disabled'
258
+ );
259
+ expect(isCommitButtonDisabled).eql('true');
260
+ });
261
+ }
251
262
 
252
- test('Stop the workspace', async function(): Promise<void> {
253
- await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
254
- await browserTabsUtil.closeAllTabsExceptCurrent();
255
- });
263
+ test('Stop the workspace', async function (): Promise<void> {
264
+ await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
265
+ await browserTabsUtil.closeAllTabsExceptCurrent();
266
+ });
256
267
 
257
- test('Delete the workspace', async function(): Promise<void> {
258
- await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
259
- });
268
+ test('Delete the workspace', async function (): Promise<void> {
269
+ await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
270
+ });
260
271
 
261
- loginTests.logoutFromChe();
262
- });
272
+ loginTests.logoutFromChe();
273
+ }
274
+ );
@@ -1,78 +1,84 @@
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 { e2eContainer } from '../../configs/inversify.config';
2
- import { assert } from 'chai';
11
+ import { expect } from 'chai';
3
12
  import { CLASSES } from '../../configs/inversify.types';
4
13
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
5
14
  import { Logger } from '../../utils/Logger';
6
15
  import { LoginTests } from '../../tests-library/LoginTests';
7
16
  import { registerRunningWorkspace } from '../MochaHooks';
17
+ import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
18
+ import { ShellExecutor } from '../../utils/ShellExecutor';
8
19
 
9
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
10
- const util: any = require('node:util');
11
- const exec: any = util.promisify(require('node:child_process').exec);
12
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
13
- const predefinedNamespaceName: string = 'predefined-ns';
20
+ suite('Create predefined workspace and check it', function (): void {
21
+ const predefinedNamespaceName: string = 'predefined-ns';
22
+ const stackName: string = 'Empty Workspace';
14
23
 
15
- async function runShellScript(shellCommandToExecution: string): Promise<string> {
16
- const { stdout, stderr } = await exec(shellCommandToExecution);
17
- console.log(stdout);
18
- console.error(stderr);
19
- return stdout;
20
- }
24
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
25
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
26
+ const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
27
+ CLASSES.KubernetesCommandLineToolsExecutor
28
+ );
29
+ const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
21
30
 
22
- suite(`Create predefined workspace and check it `, async function(): Promise<void> {
23
- let workspaceName: string = '';
31
+ suiteSetup(function (): void {
32
+ // create a predefined namespace for user using shell script and login into user dashboard
33
+ Logger.info('Test prerequisites:');
34
+ Logger.info(
35
+ ' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_OCP_USERNAME and TS_SELENIUM_OCP_PASSWORD variables'
36
+ );
37
+ Logger.info(' (2) "oc" client installed and logged into test OCP cluster with admin rights.');
38
+ kubernetesCommandLineToolsExecutor.loginToOcp('admin');
39
+ const predefinedProjectConfiguration: string =
40
+ 'kind: Namespace\n' +
41
+ 'apiVersion: v1\n' +
42
+ 'metadata:\n' +
43
+ ` name: ${predefinedNamespaceName}\n` +
44
+ ' labels:\n' +
45
+ ' app.kubernetes.io/part-of: che.eclipse.org\n' +
46
+ ' app.kubernetes.io/component: workspaces-namespace\n' +
47
+ ' annotations:\n' +
48
+ ' che.eclipse.org/username: user';
49
+ kubernetesCommandLineToolsExecutor.applyWithoutNamespace(predefinedProjectConfiguration);
50
+ const setEditRightsForUser: string = `oc adm policy add-role-to-user edit user -n ${predefinedNamespaceName}`;
51
+ shellExecutor.executeCommand(setEditRightsForUser);
52
+ });
24
53
 
25
- const setEditRightsForUser: string = `oc adm policy add-role-to-user edit user -n ${predefinedNamespaceName}`;
26
- const getDevWorkspaceFromPredefinedNameSpace: string = `oc get dw -n ${predefinedNamespaceName}`;
27
- const deletePredefinedNamespace: string = `oc delete project ${predefinedNamespaceName}`;
28
- const createPredefinedProjectCommand: string = 'cat <<EOF | oc apply -f - \n' +
29
- 'kind: Namespace\n' +
30
- 'apiVersion: v1\n' +
31
- 'metadata:\n' +
32
- ` name: ${predefinedNamespaceName}\n` +
33
- ' labels:\n' +
34
- ' app.kubernetes.io/part-of: che.eclipse.org\n' +
35
- ' app.kubernetes.io/component: workspaces-namespace\n' +
36
- ' annotations:\n' +
37
- ' che.eclipse.org/username: user\n' +
38
- 'EOF';
39
- // create a predefined namespace for user using shell script and login into user dashboard
40
- suiteSetup(async function(): Promise<void> {
41
- Logger.info('Test prerequisites:');
42
- Logger.info(' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_OCP_USERNAME and TS_SELENIUM_OCP_PASSWORD variables');
43
- Logger.info(' (2) \'oc\' client installed and logged into test OCP cluster with admin rights.');
54
+ suiteTeardown(function (): void {
55
+ const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
56
+ try {
57
+ kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
58
+ kubernetesCommandLineToolsExecutor.deleteProject(predefinedNamespaceName);
59
+ } catch (e) {
60
+ Logger.error(`Cannot remove the predefined project: ${workspaceName}, please fix it manually: ${e}`);
61
+ }
62
+ });
44
63
 
45
- await runShellScript(createPredefinedProjectCommand);
46
- await runShellScript(setEditRightsForUser);
47
- });
64
+ loginTests.loginIntoChe('user');
65
+ // create the Empty workspace using CHE Dashboard
66
+ test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
67
+ await workspaceHandlingTests.createAndOpenWorkspace(stackName);
68
+ });
69
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
70
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
71
+ });
48
72
 
49
- suiteTeardown(async (): Promise<void> => {
50
- const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
51
- try {
52
- await runShellScript(deletePredefinedNamespace);
53
- } catch (e) {
54
- Logger.error(`Cannot remove the predefined project: ${workspaceName}, please fix it manually: ${e}`);
55
- }
56
- });
73
+ // verify that just created workspace with unique name is present in the predefined namespace
74
+ test('Validate the created workspace is present in predefined namespace', function (): void {
75
+ const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
76
+ registerRunningWorkspace(workspaceName);
77
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
78
+ kubernetesCommandLineToolsExecutor.namespace = predefinedNamespaceName;
79
+ const ocDevWorkspaceOutput: string = kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration();
80
+ expect(ocDevWorkspaceOutput).includes(workspaceName);
81
+ });
57
82
 
58
- loginTests.loginIntoChe();
59
- // create the Empty workspace using CHE Dashboard
60
- test(`Create and open new workspace, stack:${'Empty Workspace'}`, async function(): Promise<void> {
61
- await workspaceHandlingTests.createAndOpenWorkspace('Empty Workspace');
62
- });
63
- test('Obtain workspace name from workspace loader page', async function(): Promise<void> {
64
- await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
65
- });
66
-
67
- // verify that just created workspace with unique name is present in the predefined namespace
68
- test('Validate the created workspace is present in predefined namespace', async function(): Promise<void> {
69
- workspaceName = WorkspaceHandlingTests.getWorkspaceName();
70
- registerRunningWorkspace(workspaceName);
71
- const ocDevWorkspaceOutput: string = await runShellScript(getDevWorkspaceFromPredefinedNameSpace);
72
- await assert.isTrue(ocDevWorkspaceOutput.includes(workspaceName));
73
- });
74
-
75
- loginTests.logoutFromChe();
83
+ loginTests.logoutFromChe();
76
84
  });
77
-
78
-