@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.
Files changed (222) 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 +14 -10
  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} +13 -13
  25. package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
  26. package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +17 -16
  27. package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
  28. package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +14 -14
  29. package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
  30. package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +15 -14
  31. package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
  32. package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +8 -8
  33. package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
  34. package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +15 -15
  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} +13 -13
  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 +18 -18
  47. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  48. package/dist/pageobjects/dashboard/Dashboard.js +27 -27
  49. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  50. package/dist/pageobjects/dashboard/Workspaces.js +42 -42
  51. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  52. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +44 -33
  53. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  54. package/dist/pageobjects/git-providers/OauthPage.js +37 -35
  55. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
  56. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +10 -10
  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 +10 -10
  61. package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
  62. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +6 -6
  63. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
  64. package/dist/pageobjects/login/openshift/OcpLoginPage.js +23 -23
  65. package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
  66. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +7 -7
  67. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
  68. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +7 -7
  69. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
  70. package/dist/pageobjects/login/openshift/RedHatLoginPage.js +11 -11
  71. package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
  72. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +10 -10
  73. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
  74. package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
  75. package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
  76. package/dist/pageobjects/openshift/OcpImportFromGitPage.js +9 -9
  77. package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
  78. package/dist/pageobjects/openshift/OcpMainPage.js +15 -15
  79. package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
  80. package/dist/specs/MochaHooks.js +27 -24
  81. package/dist/specs/MochaHooks.js.map +1 -1
  82. package/dist/specs/SmokeTest.spec.js +17 -13
  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 +31 -18
  87. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  88. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +18 -12
  89. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  90. package/dist/specs/api/PodOverridesAPI.spec.js +12 -2
  91. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  92. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -8
  93. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  94. package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -9
  95. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  96. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +47 -43
  97. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  98. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +17 -10
  99. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  100. package/dist/specs/factory/Factory.spec.js +28 -26
  101. package/dist/specs/factory/Factory.spec.js.map +1 -1
  102. package/dist/specs/factory/NoSetupRepoFactory.spec.js +41 -36
  103. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  104. package/dist/specs/factory/RefusedOAuthFactory.spec.js +37 -35
  105. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  106. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +18 -5
  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 +9 -7
  111. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  112. package/dist/tests-library/WorkspaceHandlingTests.js +61 -78
  113. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  114. package/dist/utils/BrowserTabsUtil.js +29 -24
  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 +19 -10
  119. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  120. package/dist/utils/DevfilesRegistryHelper.js +25 -19
  121. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  122. package/dist/utils/DriverHelper.js +126 -128
  123. package/dist/utils/DriverHelper.js.map +1 -1
  124. package/dist/utils/KubernetesCommandLineToolsExecutor.js +53 -46
  125. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  126. package/dist/utils/Logger.js +62 -39
  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 +17 -9
  133. package/dist/utils/StringUtil.js.map +1 -1
  134. package/dist/utils/request-handlers/CheApiRequestHandler.js +36 -34
  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 +5 -5
  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 +36 -30
  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 +45 -51
  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 +65 -56
  151. package/pageobjects/dashboard/Dashboard.ts +101 -100
  152. package/pageobjects/dashboard/Workspaces.ts +197 -166
  153. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +151 -127
  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 +32 -31
  159. package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +16 -15
  160. package/pageobjects/login/openshift/OcpLoginPage.ts +62 -55
  161. package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +30 -25
  162. package/pageobjects/login/openshift/OcpUserLoginPage.ts +16 -19
  163. package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -44
  164. package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +39 -35
  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/resources/pod-overrides-airgap.yaml +37 -0
  169. package/specs/MochaHooks.ts +59 -50
  170. package/specs/SmokeTest.spec.ts +43 -36
  171. package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
  172. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +107 -94
  173. package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
  174. package/specs/api/PodOverridesAPI.spec.ts +42 -32
  175. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -27
  176. package/specs/dashboard-samples/Quarkus.spec.ts +34 -30
  177. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -170
  178. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -55
  179. package/specs/factory/Factory.spec.ts +178 -166
  180. package/specs/factory/NoSetupRepoFactory.spec.ts +227 -210
  181. package/specs/factory/RefusedOAuthFactory.spec.ts +219 -203
  182. package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -50
  183. package/tests-library/LoginTests.ts +34 -32
  184. package/tests-library/ProjectAndFileTests.ts +21 -18
  185. package/tests-library/WorkspaceHandlingTests.ts +98 -108
  186. package/tsconfig.json +15 -15
  187. package/utils/BrowserTabsUtil.ts +104 -98
  188. package/utils/CheReporter.ts +142 -148
  189. package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
  190. package/utils/DevfilesRegistryHelper.ts +67 -58
  191. package/utils/DriverHelper.ts +726 -701
  192. package/utils/KubernetesCommandLineToolsExecutor.ts +196 -172
  193. package/utils/Logger.ts +104 -75
  194. package/utils/ScreenCatcher.ts +59 -48
  195. package/utils/ShellExecutor.ts +19 -11
  196. package/utils/StringUtil.ts +40 -32
  197. package/utils/request-handlers/CheApiRequestHandler.ts +92 -87
  198. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
  199. package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
  200. package/utils/workspace/ApiUrlResolver.ts +31 -26
  201. package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
  202. package/utils/workspace/TestWorkspaceUtil.ts +153 -142
  203. package/utils/workspace/WorkspaceStatus.ts +5 -5
  204. package/constants/APITestConstants.ts +0 -56
  205. package/constants/BaseTestConstants.ts +0 -65
  206. package/constants/ChromeDriverConstants.ts +0 -46
  207. package/constants/FactoryTestConstants.ts +0 -51
  208. package/constants/MonacoConstants.ts +0 -22
  209. package/constants/OAuthConstants.ts +0 -57
  210. package/constants/PluginsTestConstants.ts +0 -15
  211. package/constants/ReporterConstants.ts +0 -45
  212. package/constants/TimeoutConstants.ts +0 -113
  213. package/dist/constants/APITestConstants.js.map +0 -1
  214. package/dist/constants/BaseTestConstants.js.map +0 -1
  215. package/dist/constants/ChromeDriverConstants.js.map +0 -1
  216. package/dist/constants/FactoryTestConstants.js.map +0 -1
  217. package/dist/constants/MonacoConstants.js.map +0 -1
  218. package/dist/constants/OAuthConstants.js.map +0 -1
  219. package/dist/constants/PluginsTestConstants.js.map +0 -1
  220. package/dist/constants/ReporterConstants.js.map +0 -1
  221. package/dist/constants/TimeoutConstants.js.map +0 -1
  222. package/tslint.json +0 -126
@@ -1,5 +1,5 @@
1
- /*********************************************************************
2
- * Copyright (c) 2019-2023 Red Hat, Inc.
1
+ /** *******************************************************************
2
+ * copyright (c) 2019-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
@@ -8,15 +8,11 @@
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
10
 
11
- import {
12
- SideBarView,
13
- ViewItem,
14
- ViewSection
15
- } from 'monaco-page-objects';
11
+ import { SideBarView, ViewItem, ViewSection } from 'monaco-page-objects';
16
12
  import { registerRunningWorkspace } from '../MochaHooks';
17
13
  import { LoginTests } from '../../tests-library/LoginTests';
18
14
  import { e2eContainer } from '../../configs/inversify.config';
19
- import { CLASSES } from '../../configs/inversify.types';
15
+ import { CLASSES, TYPES } from '../../configs/inversify.types';
20
16
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
21
17
  import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
22
18
  import { expect } from 'chai';
@@ -25,74 +21,85 @@ import { OcpImportFromGitPage } from '../../pageobjects/openshift/OcpImportFromG
25
21
  import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
26
22
  import { StringUtil } from '../../utils/StringUtil';
27
23
  import { OcpApplicationPage } from '../../pageobjects/openshift/OcpApplicationPage';
28
- import { BaseTestConstants } from '../../constants/BaseTestConstants';
24
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
25
+ import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
26
+ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
29
27
 
30
28
  const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
31
29
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
32
30
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
31
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
33
32
  const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
33
+ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
34
+
34
35
  let ocpImportPage: OcpImportFromGitPage;
35
36
  let ocpApplicationPage: OcpApplicationPage;
36
37
  const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor();
37
38
 
38
- // works only with no-admin user
39
- suite(`DevConsole Integration`, async function (): Promise<void> {
40
- // test specific data
41
- const gitImportRepo: string = 'https://github.com/crw-qe/summit-lab-spring-music.git';
42
- const gitImportReference: string = 'pipeline';
43
- const projectLabel: string = 'app.openshift.io/runtime=spring';
44
- const projectName: string = 'devconsole-integration-test';
39
+ suite('DevConsole Integration', function (): void {
40
+ // test specific data
41
+ const gitImportRepo: string = 'https://github.com/crw-qe/summit-lab-spring-music.git';
42
+ const gitImportReference: string = 'pipeline';
43
+ const projectLabel: string = 'app.openshift.io/runtime=spring';
44
+ const projectName: string = 'devconsole-integration-test';
45
+
46
+ suiteSetup('Create new empty project using ocp', function (): void {
47
+ kubernetesCommandLineToolsExecutor.loginToOcp();
48
+ kubernetesCommandLineToolsExecutor.createProject(projectName);
49
+ });
45
50
 
46
- suiteSetup('Create new empty project using ocp', async function (): Promise<void> {
47
- kubernetesCommandLineToolsExecutor.loginToOcp();
48
- kubernetesCommandLineToolsExecutor.createProject(projectName);
49
- });
51
+ loginTests.loginIntoOcpConsole();
50
52
 
51
- loginTests.loginIntoOcpConsole();
53
+ test('Select test project and Developer role on DevConsole', async function (): Promise<void> {
54
+ await ocpMainPage.selectDeveloperRole();
55
+ await ocpMainPage.selectProject(projectName);
56
+ });
52
57
 
53
- test('Select test project and Developer role on DevConsole', async function (): Promise<void> {
54
- await ocpMainPage.selectDeveloperRole();
55
- await ocpMainPage.selectProject(projectName);
56
- });
58
+ test('Open import from git project page', async function (): Promise<void> {
59
+ ocpImportPage = await ocpMainPage.openImportFromGitPage();
60
+ });
57
61
 
58
- test('Open import from git project page', async function (): Promise<void> {
59
- ocpImportPage = await ocpMainPage.openImportFromGitPage();
60
- });
62
+ test('Fill and submit import data', async function (): Promise<void> {
63
+ ocpApplicationPage = await ocpImportPage.fitAndSubmitConfiguration(gitImportRepo, gitImportReference, projectLabel);
64
+ });
61
65
 
62
- test('Fill and submit import data', async function (): Promise<void> {
63
- ocpApplicationPage = await ocpImportPage.fitAndSubmitConfiguration(gitImportRepo, gitImportReference, projectLabel);
64
- });
66
+ test('Wait until application creates', async function (): Promise<void> {
67
+ await ocpApplicationPage.waitApplicationIcon();
68
+ });
65
69
 
66
- test('Wait until application creates', async function (): Promise<void> {
67
- await ocpApplicationPage.waitApplicationIcon();
68
- });
70
+ test('Check if application has worked link "Open Source Code"', async function (): Promise<void> {
71
+ await ocpApplicationPage.waitAndOpenEditSourceCodeIcon();
72
+ });
69
73
 
70
- test('Check if application has worked link "Open Source Code"', async function (): Promise<void> {
71
- await ocpApplicationPage.waitAndOpenEditSourceCodeIcon();
72
- });
74
+ loginTests.loginIntoChe();
73
75
 
74
- loginTests.loginIntoChe();
76
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
77
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
78
+ });
75
79
 
76
- workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
80
+ test('Registering the running workspace', function (): void {
81
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
82
+ });
77
83
 
78
- test('Registering the running workspace', async function (): Promise<void> {
79
- registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
80
- });
84
+ test('Check if application source code opens in workspace', async function (): Promise<void> {
85
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
86
+ });
81
87
 
82
- test('Check if application source code opens in workspace', async function (): Promise<void> {
83
- await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
84
- });
88
+ test('Check if project and files imported', async function (): Promise<void> {
89
+ const applicationSourceProjectName: string = StringUtil.getProjectNameFromGitUrl(gitImportRepo);
90
+ const projectSection: ViewSection = await new SideBarView().getContent().getSection(applicationSourceProjectName);
91
+ const isFileImported: ViewItem | undefined = await projectSection.findItem(BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
92
+ expect(isFileImported).not.eqls(undefined);
93
+ });
85
94
 
86
- test('Check if project and files imported', async function (): Promise<void> {
87
- const applicationSourceProjectName: string = StringUtil.getProjectNameFromGitUrl(gitImportRepo);
88
- const projectSection: ViewSection = await new SideBarView().getContent().getSection(applicationSourceProjectName);
89
- const isFileImported: ViewItem | undefined = await projectSection.findItem(BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
90
- expect(isFileImported).not.eqls(undefined);
91
- });
95
+ test('Stop and delete the workspace by API', async function (): Promise<void> {
96
+ await browserTabsUtil.closeAllTabsExceptCurrent();
97
+ testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
98
+ });
92
99
 
93
- loginTests.logoutFromChe();
100
+ loginTests.logoutFromChe();
94
101
 
95
- suiteTeardown('Delete project using ocp', async function (): Promise<void> {
96
- kubernetesCommandLineToolsExecutor.deleteProject(projectName);
97
- });
102
+ suiteTeardown('Delete project using ocp', function (): void {
103
+ kubernetesCommandLineToolsExecutor.deleteProject(projectName);
104
+ });
98
105
  });
@@ -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
@@ -12,18 +12,18 @@ import 'reflect-metadata';
12
12
 
13
13
  import { e2eContainer } from '../../configs/inversify.config';
14
14
  import {
15
- ActivityBar,
16
- ContextMenu,
17
- EditorView,
18
- Locators,
19
- ModalDialog,
20
- NewScmView,
21
- SideBarView,
22
- SingleScmProvider,
23
- TextEditor,
24
- ViewControl,
25
- ViewItem,
26
- ViewSection
15
+ ActivityBar,
16
+ ContextMenu,
17
+ EditorView,
18
+ Locators,
19
+ ModalDialog,
20
+ NewScmView,
21
+ SideBarView,
22
+ SingleScmProvider,
23
+ TextEditor,
24
+ ViewControl,
25
+ ViewItem,
26
+ ViewSection
27
27
  } from 'monaco-page-objects';
28
28
  import { expect } from 'chai';
29
29
  import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
@@ -37,9 +37,9 @@ import { DriverHelper } from '../../utils/DriverHelper';
37
37
  import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
38
38
  import { Logger } from '../../utils/Logger';
39
39
  import { LoginTests } from '../../tests-library/LoginTests';
40
- import { OAuthConstants } from '../../constants/OAuthConstants';
41
- import { BaseTestConstants } from '../../constants/BaseTestConstants';
42
- import { FactoryTestConstants } from '../../constants/FactoryTestConstants';
40
+ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
41
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
42
+ import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
43
43
 
44
44
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
45
45
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
@@ -49,152 +49,164 @@ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
49
49
 
50
50
  const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
51
51
 
52
- suite(`Create a workspace via launching a factory from the ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`, async function (): Promise<void> {
53
- const oauthPage: OauthPage = new OauthPage(driverHelper);
54
-
55
- let projectSection: ViewSection;
56
- let scmProvider: SingleScmProvider;
57
- let rest: SingleScmProvider[];
58
- let scmContextMenu: ContextMenu;
59
-
60
- // test specific data
61
- const timeToRefresh: number = 1500;
62
- const changesToCommit: string = (new Date()).getTime().toString();
63
- const fileToChange: string = 'Date.txt';
64
- const commitChangesButtonLabel: string = `Commit Changes on "${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
65
- const refreshButtonLabel: string = 'Refresh';
66
- const pushItemLabel: string = 'Push';
67
- let testRepoProjectName: string;
68
-
69
- loginTests.loginIntoChe();
70
- test(`Navigate to the factory URL`, async function (): Promise<void> {
71
- await browserTabsUtil.navigateTo(FactoryTestConstants.TS_SELENIUM_FACTORY_URL());
72
- });
73
-
74
- if (OAuthConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
75
- test(`Authorize with a ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth`, async function (): Promise<void> {
76
- await oauthPage.login();
77
- await oauthPage.waitOauthPage();
78
- await oauthPage.confirmAccess();
79
- });
80
- }
81
-
82
- workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
83
-
84
- test('Registering the running workspace', async function (): Promise<void> {
85
- registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
86
- });
87
-
88
- test('Wait the workspace readiness', async function (): Promise<void> {
89
- await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
90
- });
91
-
92
- test('Check if a project folder has been created', async function (): Promise<void> {
93
- testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
94
- Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
95
- projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
96
- });
97
-
98
- test('Check if the project files were imported', async function (): Promise<void> {
99
- const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
100
- Logger.debug(`projectSection.findItem: find ${label}`);
101
- const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
102
- expect(isFileImported).not.eqls(undefined);
103
- });
104
-
105
- test('Accept the project as a trusted one', async function (): Promise<void> {
106
- const buttonYesITrustTheAuthors: string = `Yes, I trust the authors`;
107
- const trustedProjectDialog: ModalDialog = new ModalDialog();
108
- await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.button);
109
- Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
110
- await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
111
- });
112
-
113
- test('Make changes to the file', async function (): Promise<void> {
114
- Logger.debug(`projectSection.openItem: "${fileToChange}"`);
115
- await projectSection.openItem(fileToChange);
116
- const editor: TextEditor = await new EditorView().openEditor(fileToChange) as TextEditor;
117
- await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
118
- Logger.debug(`editor.clearText`);
119
- await editor.clearText();
120
- Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
121
- await editor.typeTextAt(1, 1, changesToCommit);
122
- });
123
-
124
- test('Open a source control manager', async function (): Promise<void> {
125
- const viewSourceControl: string = `Source Control`;
126
- const sourceControl: ViewControl = await new ActivityBar().getViewControl(viewSourceControl) as ViewControl;
127
- Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
128
- await sourceControl.openView();
129
- const scmView: NewScmView = new NewScmView();
130
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
131
- [scmProvider, ...rest] = await scmView.getProviders();
132
- Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
133
- });
134
-
135
- test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
136
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
137
- await driverHelper.wait(timeToRefresh);
138
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
139
- await scmProvider.takeAction(refreshButtonLabel);
140
- // wait while changes counter will be refreshed
141
- await driverHelper.wait(timeToRefresh);
142
- const changes: number = await scmProvider.getChangeCount();
143
- Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
144
- expect(changes).eql(1);
145
- });
146
-
147
- test('Stage the changes', async function (): Promise<void> {
148
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
149
- Logger.debug(`scmProvider.openMoreActions`);
150
- scmContextMenu = await scmProvider.openMoreActions();
151
- await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
152
- Logger.debug(`scmContextMenu.select: "Changes" -> "Stage All Changes"`);
153
- await scmContextMenu.select('Changes', 'Stage All Changes');
154
- });
155
-
156
- test('Commit the changes', async function (): Promise<void> {
157
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
158
- Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
159
- await scmProvider.commitChanges('Commit ' + changesToCommit);
160
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
161
- await driverHelper.wait(timeToRefresh);
162
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
163
- await scmProvider.takeAction(refreshButtonLabel);
164
- // wait while changes counter will be refreshed
165
- await driverHelper.wait(timeToRefresh);
166
- const changes: number = await scmProvider.getChangeCount();
167
- Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
168
- expect(changes).eql(0);
169
- });
170
-
171
- test('Push the changes', async function (): Promise<void> {
172
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
173
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
174
- Logger.debug(`scmProvider.openMoreActions`);
175
- scmContextMenu = await scmProvider.openMoreActions();
176
- await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
177
- Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
178
- await scmContextMenu.select(pushItemLabel);
179
- });
180
-
181
- test('Check if the changes were pushed', async function (): Promise<void> {
182
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
183
- await driverHelper.wait(timeToRefresh);
184
- Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
185
- await scmProvider.takeAction(refreshButtonLabel);
186
- const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel), 'aria-disabled');
187
- expect(isCommitButtonDisabled).eql('true');
188
- });
189
-
190
- test('Stop the workspace', async function (): Promise<void> {
191
- await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
192
- await browserTabsUtil.closeAllTabsExceptCurrent();
193
- });
194
-
195
- test('Delete the workspace', async function (): Promise<void> {
196
- await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
197
- });
198
-
199
- loginTests.logoutFromChe();
200
- });
52
+ suite(
53
+ `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`,
54
+ function (): void {
55
+ const oauthPage: OauthPage = new OauthPage(driverHelper);
56
+
57
+ let projectSection: ViewSection;
58
+ let scmProvider: SingleScmProvider;
59
+ let rest: SingleScmProvider[];
60
+ let scmContextMenu: ContextMenu;
61
+
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
+ let testRepoProjectName: string;
70
+
71
+ loginTests.loginIntoChe();
72
+ test('Navigate to the factory URL', async function (): Promise<void> {
73
+ await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
74
+ });
75
+
76
+ if (OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
77
+ test(`Authorize with a ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth`, async function (): Promise<void> {
78
+ await oauthPage.login();
79
+ await oauthPage.waitOauthPage();
80
+ await oauthPage.confirmAccess();
81
+ });
82
+ }
83
+
84
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
85
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
86
+ });
87
+
88
+ test('Registering the running workspace', function (): void {
89
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
90
+ });
91
+
92
+ test('Wait the workspace readiness', async function (): Promise<void> {
93
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
94
+ });
95
+
96
+ test('Check if a project folder has been created', async function (): Promise<void> {
97
+ testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL);
98
+ Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
99
+ projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
100
+ });
101
+
102
+ test('Check if the project files were imported', async function (): Promise<void> {
103
+ const label: string = BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
104
+ Logger.debug(`projectSection.findItem: find ${label}`);
105
+ const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
106
+ expect(isFileImported).not.eqls(undefined);
107
+ });
108
+
109
+ test('Accept the project as a trusted one', async function (): Promise<void> {
110
+ const buttonYesITrustTheAuthors: string = 'Yes, I trust the authors';
111
+ const trustedProjectDialog: ModalDialog = new ModalDialog();
112
+ await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.button);
113
+ Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
114
+ await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
115
+ });
116
+
117
+ test('Make changes to the file', async function (): Promise<void> {
118
+ Logger.debug(`projectSection.openItem: "${fileToChange}"`);
119
+ await projectSection.openItem(fileToChange);
120
+ const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
121
+ await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
122
+ Logger.debug('editor.clearText');
123
+ await editor.clearText();
124
+ Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
125
+ await editor.typeTextAt(1, 1, changesToCommit);
126
+ });
127
+
128
+ test('Open a source control manager', async function (): Promise<void> {
129
+ const viewSourceControl: string = 'Source Control';
130
+ const sourceControl: ViewControl = (await new ActivityBar().getViewControl(viewSourceControl)) as ViewControl;
131
+ Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
132
+ await sourceControl.openView();
133
+ const scmView: NewScmView = new NewScmView();
134
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
135
+ [scmProvider, ...rest] = await scmView.getProviders();
136
+ Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
137
+ });
138
+
139
+ test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
140
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
141
+ await driverHelper.wait(timeToRefresh);
142
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
143
+ await scmProvider.takeAction(refreshButtonLabel);
144
+ // wait while changes counter will be refreshed
145
+ await driverHelper.wait(timeToRefresh);
146
+ const changes: number = await scmProvider.getChangeCount();
147
+ Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
148
+ expect(changes).eql(1);
149
+ });
150
+
151
+ test('Stage the changes', async function (): Promise<void> {
152
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
153
+ Logger.debug('scmProvider.openMoreActions');
154
+ scmContextMenu = await scmProvider.openMoreActions();
155
+ await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
156
+ Logger.debug('scmContextMenu.select: "Changes" -> "Stage All Changes"');
157
+ await scmContextMenu.select('Changes', 'Stage All Changes');
158
+ });
159
+
160
+ test('Commit the changes', async function (): Promise<void> {
161
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
162
+ Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
163
+ await scmProvider.commitChanges('Commit ' + changesToCommit);
164
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
165
+ await driverHelper.wait(timeToRefresh);
166
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
167
+ await scmProvider.takeAction(refreshButtonLabel);
168
+ // wait while changes counter will be refreshed
169
+ await driverHelper.wait(timeToRefresh);
170
+ const changes: number = await scmProvider.getChangeCount();
171
+ Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
172
+ expect(changes).eql(0);
173
+ });
174
+
175
+ test('Push the changes', async function (): Promise<void> {
176
+ await driverHelper.waitVisibility(
177
+ webCheCodeLocators.ScmView.actionConstructor(
178
+ `Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
179
+ )
180
+ );
181
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
182
+ Logger.debug('scmProvider.openMoreActions');
183
+ scmContextMenu = await scmProvider.openMoreActions();
184
+ await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
185
+ Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
186
+ await scmContextMenu.select(pushItemLabel);
187
+ });
188
+
189
+ test('Check if the changes were pushed', async function (): Promise<void> {
190
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
191
+ await driverHelper.wait(timeToRefresh);
192
+ Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
193
+ await scmProvider.takeAction(refreshButtonLabel);
194
+ const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
195
+ webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel),
196
+ 'aria-disabled'
197
+ );
198
+ expect(isCommitButtonDisabled).eql('true');
199
+ });
200
+
201
+ test('Stop the workspace', async function (): Promise<void> {
202
+ await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
203
+ await browserTabsUtil.closeAllTabsExceptCurrent();
204
+ });
205
+
206
+ test('Delete the workspace', async function (): Promise<void> {
207
+ await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
208
+ });
209
+
210
+ loginTests.logoutFromChe();
211
+ }
212
+ );