@eclipse-che/che-e2e 7.74.0-dev-41d1364 → 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 (156) hide show
  1. package/.eslintrc.js +15 -1
  2. package/CODE_STYLE.md +144 -0
  3. package/configs/inversify.config.ts +26 -5
  4. package/configs/inversify.types.ts +17 -3
  5. package/constants/CHROME_DRIVER_CONSTANTS.ts +1 -13
  6. package/dist/configs/inversify.config.js +22 -1
  7. package/dist/configs/inversify.config.js.map +1 -1
  8. package/dist/configs/inversify.types.js +17 -3
  9. package/dist/configs/inversify.types.js.map +1 -1
  10. package/dist/constants/CHROME_DRIVER_CONSTANTS.js +1 -9
  11. package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -1
  12. package/dist/driver/ChromeDriver.js +1 -7
  13. package/dist/driver/ChromeDriver.js.map +1 -1
  14. package/dist/index.js +9 -3
  15. package/dist/index.js.map +1 -1
  16. package/dist/pageobjects/dashboard/CreateWorkspace.js +5 -5
  17. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  18. package/dist/pageobjects/dashboard/Dashboard.js +5 -6
  19. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  20. package/dist/pageobjects/dashboard/Workspaces.js +34 -39
  21. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  22. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +27 -28
  23. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  24. package/dist/pageobjects/git-providers/OauthPage.js +2 -2
  25. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
  26. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +18 -4
  27. package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
  28. package/dist/pageobjects/login/kubernetes/DexLoginPage.js +11 -11
  29. package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
  30. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +2 -2
  31. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
  32. package/dist/pageobjects/login/openshift/OcpLoginPage.js +20 -24
  33. package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
  34. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +10 -13
  35. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
  36. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +3 -3
  37. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
  38. package/dist/pageobjects/login/openshift/RedHatLoginPage.js +16 -20
  39. package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
  40. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +16 -15
  41. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
  42. package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
  43. package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
  44. package/dist/pageobjects/openshift/OcpImportFromGitPage.js +20 -20
  45. package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
  46. package/dist/pageobjects/openshift/OcpMainPage.js +25 -25
  47. package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
  48. package/dist/specs/MochaHooks.js +9 -6
  49. package/dist/specs/MochaHooks.js.map +1 -1
  50. package/dist/specs/SmokeTest.spec.js +6 -6
  51. package/dist/specs/SmokeTest.spec.js.map +1 -1
  52. package/dist/specs/api/ContainerOverridesAPI.spec.js +7 -14
  53. package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
  54. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +11 -19
  55. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  56. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +10 -16
  57. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  58. package/dist/specs/api/PodOverridesAPI.spec.js +7 -14
  59. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  60. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +5 -5
  61. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  62. package/dist/specs/dashboard-samples/Quarkus.spec.js +6 -6
  63. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  64. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +11 -11
  65. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  66. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +11 -12
  67. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  68. package/dist/specs/factory/Factory.spec.js +13 -16
  69. package/dist/specs/factory/Factory.spec.js.map +1 -1
  70. package/dist/specs/factory/NoSetupRepoFactory.spec.js +17 -18
  71. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  72. package/dist/specs/factory/RefusedOAuthFactory.spec.js +17 -19
  73. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  74. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +35 -41
  75. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  76. package/dist/tests-library/LoginTests.js +8 -8
  77. package/dist/tests-library/LoginTests.js.map +1 -1
  78. package/dist/tests-library/ProjectAndFileTests.js +2 -2
  79. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  80. package/dist/tests-library/WorkspaceHandlingTests.js +8 -8
  81. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  82. package/dist/utils/BrowserTabsUtil.js +4 -9
  83. package/dist/utils/BrowserTabsUtil.js.map +1 -1
  84. package/dist/utils/CheReporter.js +49 -23
  85. package/dist/utils/CheReporter.js.map +1 -1
  86. package/dist/utils/DevWorkspaceConfigurationHelper.js +27 -17
  87. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  88. package/dist/utils/DevfilesRegistryHelper.js +15 -5
  89. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  90. package/dist/utils/DriverHelper.js +9 -2
  91. package/dist/utils/DriverHelper.js.map +1 -1
  92. package/dist/utils/IContextParams.js +12 -0
  93. package/dist/utils/IContextParams.js.map +1 -0
  94. package/dist/utils/IKubernetesCommandLineToolsExecutor.js +3 -0
  95. package/dist/utils/IKubernetesCommandLineToolsExecutor.js.map +1 -0
  96. package/dist/utils/KubernetesCommandLineToolsExecutor.js +133 -98
  97. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  98. package/dist/utils/ScreenCatcher.js +8 -4
  99. package/dist/utils/ScreenCatcher.js.map +1 -1
  100. package/dist/utils/ShellExecutor.js +20 -9
  101. package/dist/utils/ShellExecutor.js.map +1 -1
  102. package/dist/utils/StringUtil.js +4 -2
  103. package/dist/utils/StringUtil.js.map +1 -1
  104. package/dist/utils/request-handlers/CheApiRequestHandler.js +2 -2
  105. package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
  106. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +2 -2
  107. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  108. package/dist/utils/workspace/ApiUrlResolver.js +2 -2
  109. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  110. package/dist/utils/workspace/TestWorkspaceUtil.js +4 -4
  111. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  112. package/driver/ChromeDriver.ts +0 -7
  113. package/index.ts +2 -0
  114. package/package.json +3 -3
  115. package/pageobjects/dashboard/CreateWorkspace.ts +5 -4
  116. package/pageobjects/dashboard/Dashboard.ts +3 -4
  117. package/pageobjects/dashboard/Workspaces.ts +40 -48
  118. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +23 -26
  119. package/pageobjects/ide/CheCodeLocatorLoader.ts +3 -1
  120. package/pageobjects/login/interfaces/ICheLoginPage.ts +1 -1
  121. package/pageobjects/login/interfaces/IOcpLoginPage.ts +1 -1
  122. package/pageobjects/login/kubernetes/DexLoginPage.ts +9 -9
  123. package/pageobjects/login/openshift/OcpLoginPage.ts +18 -30
  124. package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +6 -11
  125. package/pageobjects/login/openshift/OcpUserLoginPage.ts +1 -1
  126. package/pageobjects/login/openshift/RedHatLoginPage.ts +17 -16
  127. package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +16 -11
  128. package/pageobjects/openshift/OcpApplicationPage.ts +5 -4
  129. package/pageobjects/openshift/OcpImportFromGitPage.ts +18 -20
  130. package/pageobjects/openshift/OcpMainPage.ts +24 -25
  131. package/specs/MochaHooks.ts +3 -5
  132. package/specs/SmokeTest.spec.ts +4 -5
  133. package/specs/api/ContainerOverridesAPI.spec.ts +8 -2
  134. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +9 -7
  135. package/specs/api/EmptyWorkspaceAPI.spec.ts +8 -4
  136. package/specs/api/PodOverridesAPI.spec.ts +8 -3
  137. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +5 -5
  138. package/specs/dashboard-samples/Quarkus.spec.ts +7 -6
  139. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +8 -7
  140. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +12 -11
  141. package/specs/factory/Factory.spec.ts +8 -12
  142. package/specs/factory/NoSetupRepoFactory.spec.ts +10 -11
  143. package/specs/factory/RefusedOAuthFactory.spec.ts +8 -10
  144. package/specs/miscellaneous/PredefinedNamespace.spec.ts +40 -44
  145. package/tests-library/LoginTests.ts +3 -3
  146. package/tests-library/WorkspaceHandlingTests.ts +2 -2
  147. package/utils/BrowserTabsUtil.ts +7 -9
  148. package/utils/CheReporter.ts +26 -20
  149. package/utils/DevWorkspaceConfigurationHelper.ts +9 -24
  150. package/utils/DevfilesRegistryHelper.ts +8 -3
  151. package/utils/DriverHelper.ts +14 -12
  152. package/utils/IContextParams.ts +26 -0
  153. package/utils/IKubernetesCommandLineToolsExecutor.ts +42 -0
  154. package/utils/KubernetesCommandLineToolsExecutor.ts +133 -101
  155. package/utils/ShellExecutor.ts +10 -7
  156. package/utils/StringUtil.ts +6 -1
@@ -7,14 +7,15 @@
7
7
  *
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
- import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
10
+ import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
11
11
  import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigurationHelper';
12
12
  import { ShellString } from 'shelljs';
13
13
  import { expect } from 'chai';
14
14
  import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
15
15
  import { StringUtil } from '../../utils/StringUtil';
16
- // import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper';
17
16
  import { Logger } from '../../utils/Logger';
17
+ import { e2eContainer } from '../../configs/inversify.config';
18
+ import { CLASSES } from '../../configs/inversify.types';
18
19
 
19
20
  /**
20
21
  * dynamically generating tests
@@ -23,7 +24,8 @@ import { Logger } from '../../utils/Logger';
23
24
  // todo: skipped while don`t use to avoid sending useless requests
24
25
  // eslint-disable-next-line @typescript-eslint/require-await
25
26
  void (async function (): Promise<void> {
26
- // const devfilesRegistryHelper: DevfilesRegistryHelper = new DevfilesRegistryHelper();
27
+ // const devfilesRegistryHelper: DevfilesRegistryHelper = e2eContainer.get(CLASSES.DevfilesRegistryHelper);
28
+
27
29
  const devfileSamples: any = [];
28
30
  // devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry();
29
31
 
@@ -33,7 +35,7 @@ void (async function (): Promise<void> {
33
35
  this.timeout(1500000); // 25 minutes because build of Quarkus sample takes 20+ minutes
34
36
  let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper;
35
37
  let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
36
- let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
38
+ let containerTerminal: ContainerTerminal;
37
39
  let devfileContext: DevfileContext;
38
40
  let devWorkspaceName: string | undefined;
39
41
  let clonedProjectName: string;
@@ -46,9 +48,9 @@ void (async function (): Promise<void> {
46
48
  });
47
49
  devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
48
50
  devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
49
-
50
- kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName);
51
- containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
51
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
52
+ kubernetesCommandLineToolsExecutor.workspaceName = devWorkspaceName;
53
+ containerTerminal = e2eContainer.get(CLASSES.ContainerTerminal);
52
54
  kubernetesCommandLineToolsExecutor.loginToOcp();
53
55
  });
54
56
 
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
- import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
10
+ import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
11
11
  import { expect } from 'chai';
12
12
  import { ShellString } from 'shelljs';
13
13
  import { StringUtil } from '../../utils/StringUtil';
@@ -15,6 +15,8 @@ import { DevWorkspaceConfigurationHelper } from '../../utils/DevWorkspaceConfigu
15
15
  import { DevfileContext } from '@eclipse-che/che-devworkspace-generator/lib/api/devfile-context';
16
16
  import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS';
17
17
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
18
+ import { e2eContainer } from '../../configs/inversify.config';
19
+ import { CLASSES } from '../../configs/inversify.types';
18
20
 
19
21
  suite('Empty workspace API test', function (): void {
20
22
  // works only for root user
@@ -25,7 +27,7 @@ suite('Empty workspace API test', function (): void {
25
27
  let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
26
28
  let devfileContext: DevfileContext;
27
29
  let devWorkspaceName: string | undefined;
28
- let containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal;
30
+ let containerTerminal: ContainerTerminal;
29
31
 
30
32
  const gitRepository: string = 'https://github.com/crw-qe/web-nodejs-sample';
31
33
 
@@ -38,8 +40,10 @@ suite('Empty workspace API test', function (): void {
38
40
  });
39
41
  devfileContext = await devWorkspaceConfigurationHelper.generateDevfileContext();
40
42
  devWorkspaceName = devfileContext?.devWorkspace?.metadata?.name;
41
- kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(devWorkspaceName, namespace);
42
- containerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
43
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
44
+ kubernetesCommandLineToolsExecutor.workspaceName = devWorkspaceName;
45
+ kubernetesCommandLineToolsExecutor.namespace = namespace;
46
+ containerTerminal = e2eContainer.get(CLASSES.ContainerTerminal);
43
47
  });
44
48
 
45
49
  test('Create empty workspace', function (): void {
@@ -14,14 +14,19 @@ import YAML from 'yaml';
14
14
  import { expect } from 'chai';
15
15
  import { ShellExecutor } from '../../utils/ShellExecutor';
16
16
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
17
+ import { e2eContainer } from '../../configs/inversify.config';
18
+ import { CLASSES } from '../../configs/inversify.types';
17
19
 
18
20
  suite('Test defining pod overrides via attribute.', function (): void {
19
21
  const pathToSampleFile: string = path.resolve(
20
22
  `resources/pod-overrides${BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED() ? '-airgap' : ''}.yaml`
21
23
  );
22
24
  const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name;
23
- const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName);
24
-
25
+ const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
26
+ CLASSES.KubernetesCommandLineToolsExecutor
27
+ );
28
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
29
+ const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
25
30
  suiteSetup('Login into OC client', function (): void {
26
31
  kubernetesCommandLineToolsExecutor.loginToOcp();
27
32
  });
@@ -32,7 +37,7 @@ suite('Test defining pod overrides via attribute.', function (): void {
32
37
 
33
38
  test('Apply pod-overrides sample as DevWorkspace with OC client', function (): void {
34
39
  kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
35
- ShellExecutor.wait(5);
40
+ shellExecutor.wait(5);
36
41
  });
37
42
 
38
43
  test('Check that fields are overridden in the Deployment for DevWorkspace', function (): void {
@@ -17,14 +17,14 @@ import { LoginTests } from '../../tests-library/LoginTests';
17
17
  import { registerRunningWorkspace } from '../MochaHooks';
18
18
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
19
19
 
20
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
21
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
22
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
23
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
24
-
25
20
  const stackName: string = 'Empty Workspace';
26
21
 
27
22
  suite(`${stackName} test`, function (): void {
23
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
24
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
25
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
26
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
27
+
28
28
  loginTests.loginIntoChe();
29
29
 
30
30
  test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
@@ -19,17 +19,18 @@ import { Logger } from '../../utils/Logger';
19
19
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
20
20
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
21
21
 
22
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
23
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
24
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
25
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
26
-
27
22
  const stackName: string = 'Java 11 with Quarkus';
28
- const projectName: string = 'quarkus-quickstarts';
29
23
 
30
24
  suite(`The ${stackName} userstory`, function (): void {
25
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
26
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
27
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
28
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
29
+
31
30
  let projectSection: ViewSection;
32
31
 
32
+ const projectName: string = 'quarkus-quickstarts';
33
+
33
34
  loginTests.loginIntoChe();
34
35
 
35
36
  test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
@@ -37,16 +37,17 @@ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
37
37
  import { PLUGIN_TEST_CONSTANTS } from '../../constants/PLUGIN_TEST_CONSTANTS';
38
38
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
39
39
 
40
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
41
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
42
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
43
- const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
44
-
45
- const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
46
40
  const samples: string[] = PLUGIN_TEST_CONSTANTS.TS_SAMPLE_LIST.split(',');
47
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
48
41
 
49
42
  suite(`Check if recommended extensions installed for ${samples}`, function (): void {
43
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
44
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
45
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
46
+ const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
47
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
48
+ const cheCodeLocatorLoader: CheCodeLocatorLoader = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
49
+ const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
50
+
50
51
  let projectSection: ViewSection;
51
52
  let extensionsView: SideBarView | undefined;
52
53
  let extensionSection: ExtensionsViewSection;
@@ -25,18 +25,19 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
25
25
  import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
26
26
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
27
27
 
28
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
29
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
30
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
31
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
32
- const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
33
- const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
34
-
35
- let ocpImportPage: OcpImportFromGitPage;
36
- let ocpApplicationPage: OcpApplicationPage;
37
- const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor();
38
-
39
28
  suite('DevConsole Integration', function (): void {
29
+ let ocpImportPage: OcpImportFromGitPage;
30
+ let ocpApplicationPage: OcpApplicationPage;
31
+
32
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
33
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
34
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
35
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
36
+ const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
37
+ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
38
+ const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
39
+ CLASSES.KubernetesCommandLineToolsExecutor
40
+ );
40
41
  // test specific data
41
42
  const gitImportRepo: string = 'https://github.com/crw-qe/summit-lab-spring-music.git';
42
43
  const gitImportReference: string = 'pipeline';
@@ -28,7 +28,6 @@ import {
28
28
  import { expect } from 'chai';
29
29
  import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
30
30
  import { StringUtil } from '../../utils/StringUtil';
31
- import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
32
31
  import { registerRunningWorkspace } from '../MochaHooks';
33
32
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
34
33
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
@@ -41,18 +40,16 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
41
40
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
42
41
  import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
43
42
 
44
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
45
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
46
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
47
- const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
48
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
49
-
50
- const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
51
-
52
43
  suite(
53
44
  `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`,
54
45
  function (): void {
55
- const oauthPage: OauthPage = new OauthPage(driverHelper);
46
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
47
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
48
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
49
+ const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
50
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
51
+ const webCheCodeLocators: Locators = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
52
+ const oauthPage: OauthPage = e2eContainer.get(CLASSES.OauthPage);
56
53
 
57
54
  let projectSection: ViewSection;
58
55
  let scmProvider: SingleScmProvider;
@@ -131,7 +128,7 @@ suite(
131
128
  Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
132
129
  await sourceControl.openView();
133
130
  const scmView: NewScmView = new NewScmView();
134
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
131
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
135
132
  [scmProvider, ...rest] = await scmView.getProviders();
136
133
  Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
137
134
  });
@@ -158,7 +155,6 @@ suite(
158
155
  });
159
156
 
160
157
  test('Commit the changes', async function (): Promise<void> {
161
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
162
158
  Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
163
159
  await scmProvider.commitChanges('Commit ' + changesToCommit);
164
160
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
@@ -45,18 +45,18 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
45
45
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
46
46
  import WebDriverError = error.WebDriverError;
47
47
 
48
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
49
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
50
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
51
- const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
52
- const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
53
- const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
54
- const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
55
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
56
-
57
48
  suite(
58
49
  `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup`,
59
50
  function (): void {
51
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
52
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
53
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
54
+ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
55
+ const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
56
+ const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
57
+ const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
58
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
59
+
60
60
  let projectSection: ViewSection;
61
61
  let scmProvider: SingleScmProvider;
62
62
  let scmContextMenu: ContextMenu;
@@ -173,7 +173,7 @@ suite(
173
173
  Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
174
174
  await sourceControl.openView();
175
175
  const scmView: NewScmView = new NewScmView();
176
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
176
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
177
177
  let rest: SingleScmProvider[];
178
178
  [scmProvider, ...rest] = await scmView.getProviders();
179
179
  Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
@@ -201,7 +201,6 @@ suite(
201
201
  });
202
202
 
203
203
  test('Commit the changes', async function (): Promise<void> {
204
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
205
204
  Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
206
205
  await scmProvider.commitChanges('Commit ' + changesToCommit);
207
206
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
@@ -44,17 +44,16 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
44
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);
53
-
54
47
  suite(
55
48
  `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`,
56
49
  function (): void {
57
- const oauthPage: OauthPage = new OauthPage(driverHelper);
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);
58
57
 
59
58
  let projectSection: ViewSection;
60
59
  let scmProvider: SingleScmProvider;
@@ -170,7 +169,7 @@ suite(
170
169
  Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
171
170
  await sourceControl.openView();
172
171
  const scmView: NewScmView = new NewScmView();
173
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
172
+ await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
174
173
  let rest: SingleScmProvider[];
175
174
  [scmProvider, ...rest] = await scmView.getProviders();
176
175
  Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
@@ -198,7 +197,6 @@ suite(
198
197
  });
199
198
 
200
199
  test('Commit the changes', async function (): Promise<void> {
201
- await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
202
200
  Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
203
201
  await scmProvider.commitChanges('Commit ' + changesToCommit);
204
202
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
@@ -8,80 +8,76 @@
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
10
  import { e2eContainer } from '../../configs/inversify.config';
11
- import { assert } from 'chai';
11
+ import { expect } from 'chai';
12
12
  import { CLASSES } from '../../configs/inversify.types';
13
13
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
14
14
  import { Logger } from '../../utils/Logger';
15
15
  import { LoginTests } from '../../tests-library/LoginTests';
16
16
  import { registerRunningWorkspace } from '../MochaHooks';
17
+ import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
18
+ import { ShellExecutor } from '../../utils/ShellExecutor';
17
19
 
18
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
19
- const util: any = require('node:util');
20
- const exec: any = util.promisify(require('node:child_process').exec);
21
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
22
- 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';
23
23
 
24
- async function runShellScript(shellCommandToExecution: string): Promise<string> {
25
- const { stdout, stderr } = await exec(shellCommandToExecution);
26
- console.log(stdout);
27
- console.error(stderr);
28
- return stdout;
29
- }
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);
30
30
 
31
- suite('Create predefined workspace and check it ', function (): void {
32
- let workspaceName: string = '';
33
-
34
- const setEditRightsForUser: string = `oc adm policy add-role-to-user edit user -n ${predefinedNamespaceName}`;
35
- const getDevWorkspaceFromPredefinedNameSpace: string = `oc get dw -n ${predefinedNamespaceName}`;
36
- const deletePredefinedNamespace: string = `oc delete project ${predefinedNamespaceName}`;
37
- const createPredefinedProjectCommand: string =
38
- 'cat <<EOF | oc apply -f - \n' +
39
- 'kind: Namespace\n' +
40
- 'apiVersion: v1\n' +
41
- 'metadata:\n' +
42
- ` name: ${predefinedNamespaceName}\n` +
43
- ' labels:\n' +
44
- ' app.kubernetes.io/part-of: che.eclipse.org\n' +
45
- ' app.kubernetes.io/component: workspaces-namespace\n' +
46
- ' annotations:\n' +
47
- ' che.eclipse.org/username: user\n' +
48
- 'EOF';
49
- // create a predefined namespace for user using shell script and login into user dashboard
50
- suiteSetup(async function (): Promise<void> {
31
+ suiteSetup(function (): void {
32
+ // create a predefined namespace for user using shell script and login into user dashboard
51
33
  Logger.info('Test prerequisites:');
52
34
  Logger.info(
53
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'
54
36
  );
55
37
  Logger.info(' (2) "oc" client installed and logged into test OCP cluster with admin rights.');
56
-
57
- await runShellScript(createPredefinedProjectCommand);
58
- await runShellScript(setEditRightsForUser);
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);
59
52
  });
60
53
 
61
- suiteTeardown(async (): Promise<void> => {
54
+ suiteTeardown(function (): void {
62
55
  const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
63
56
  try {
64
- await runShellScript(deletePredefinedNamespace);
57
+ kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
58
+ kubernetesCommandLineToolsExecutor.deleteProject(predefinedNamespaceName);
65
59
  } catch (e) {
66
60
  Logger.error(`Cannot remove the predefined project: ${workspaceName}, please fix it manually: ${e}`);
67
61
  }
68
62
  });
69
63
 
70
- loginTests.loginIntoChe();
64
+ loginTests.loginIntoChe('user');
71
65
  // create the Empty workspace using CHE Dashboard
72
- test(`Create and open new workspace, stack:${'Empty Workspace'}`, async function (): Promise<void> {
73
- await workspaceHandlingTests.createAndOpenWorkspace('Empty Workspace');
66
+ test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
67
+ await workspaceHandlingTests.createAndOpenWorkspace(stackName);
74
68
  });
75
69
  test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
76
70
  await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
77
71
  });
78
72
 
79
73
  // verify that just created workspace with unique name is present in the predefined namespace
80
- test('Validate the created workspace is present in predefined namespace', async function (): Promise<void> {
81
- workspaceName = WorkspaceHandlingTests.getWorkspaceName();
74
+ test('Validate the created workspace is present in predefined namespace', function (): void {
75
+ const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
82
76
  registerRunningWorkspace(workspaceName);
83
- const ocDevWorkspaceOutput: string = await runShellScript(getDevWorkspaceFromPredefinedNameSpace);
84
- assert.isTrue(ocDevWorkspaceOutput.includes(workspaceName));
77
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
78
+ kubernetesCommandLineToolsExecutor.namespace = predefinedNamespaceName;
79
+ const ocDevWorkspaceOutput: string = kubernetesCommandLineToolsExecutor.getDevWorkspaceYamlConfiguration();
80
+ expect(ocDevWorkspaceOutput).includes(workspaceName);
85
81
  });
86
82
 
87
83
  loginTests.logoutFromChe();
@@ -27,12 +27,12 @@ export class LoginTests {
27
27
  @inject(CLASSES.Dashboard) private readonly dashboard: Dashboard
28
28
  ) {}
29
29
 
30
- loginIntoChe(): void {
30
+ loginIntoChe(userName?: string, password?: string): void {
31
31
  test('Login', async (): Promise<void> => {
32
32
  if (!(await this.browserTabsUtil.getCurrentUrl()).includes(BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL)) {
33
33
  await this.browserTabsUtil.navigateTo(BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL);
34
34
  }
35
- await this.productLoginPage.login();
35
+ await this.productLoginPage.login(userName, password);
36
36
  await this.browserTabsUtil.maximize();
37
37
  await this.dashboard.waitStartingPageLoaderDisappearance();
38
38
  });
@@ -42,7 +42,7 @@ export class LoginTests {
42
42
  test('Login into ocp console', async (): Promise<void> => {
43
43
  const openshiftConsoleUrl: string = BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.replace('devspaces', 'console-openshift-console');
44
44
  await this.browserTabsUtil.navigateTo(openshiftConsoleUrl);
45
- this.ocpLoginPage.login();
45
+ await this.ocpLoginPage.login();
46
46
  await this.browserTabsUtil.maximize();
47
47
  });
48
48
  }
@@ -22,7 +22,7 @@ import { By, error } from 'selenium-webdriver';
22
22
 
23
23
  @injectable()
24
24
  export class WorkspaceHandlingTests {
25
- private static WORKSPACE_NAME_LOCATOR: By = By.xpath('//h1[contains(.,"Starting workspace ")]');
25
+ private static WORKSPACE_NAME: By = By.xpath('//h1[contains(.,"Starting workspace ")]');
26
26
  private static workspaceName: string = 'undefined';
27
27
  private static parentGUID: string;
28
28
 
@@ -82,7 +82,7 @@ export class WorkspaceHandlingTests {
82
82
  try {
83
83
  const startingWorkspaceLineContent: string = await this.driverHelper
84
84
  .getDriver()
85
- .findElement(WorkspaceHandlingTests.WORKSPACE_NAME_LOCATOR)
85
+ .findElement(WorkspaceHandlingTests.WORKSPACE_NAME)
86
86
  .getText();
87
87
  Logger.trace(`obtained starting workspace getText():${startingWorkspaceLineContent}`);
88
88
  // cutting away leading text
@@ -12,7 +12,6 @@ import { inject, injectable } from 'inversify';
12
12
  import { CLASSES } from '../configs/inversify.types';
13
13
  import { DriverHelper } from './DriverHelper';
14
14
  import { Logger } from './Logger';
15
- import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
16
15
  import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
17
16
 
18
17
  @injectable()
@@ -24,6 +23,7 @@ export class BrowserTabsUtil {
24
23
 
25
24
  async switchToWindow(windowHandle: string): Promise<void> {
26
25
  Logger.debug();
26
+
27
27
  await this.driverHelper.getDriver().switchTo().window(windowHandle);
28
28
  }
29
29
 
@@ -42,14 +42,7 @@ export class BrowserTabsUtil {
42
42
  async navigateTo(url: string): Promise<void> {
43
43
  Logger.debug(`${url}`);
44
44
 
45
- await this.driverHelper.getDriver().navigate().to(url);
46
- }
47
-
48
- async navigateAndWaitToUrl(url: string, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_WAIT_FOR_URL): Promise<void> {
49
- Logger.trace(`${url}`);
50
-
51
- await this.navigateTo(url);
52
- await this.waitURL(url, timeout);
45
+ await this.driverHelper.navigateToUrl(url);
53
46
  }
54
47
 
55
48
  async waitAndSwitchToAnotherWindow(currentWindowHandle: string, timeout: number): Promise<void> {
@@ -77,11 +70,14 @@ export class BrowserTabsUtil {
77
70
  }
78
71
 
79
72
  async getCurrentUrl(): Promise<string> {
73
+ Logger.trace();
74
+
80
75
  return await this.driverHelper.getDriver().getCurrentUrl();
81
76
  }
82
77
 
83
78
  async waitURL(expectedUrl: string, timeout: number): Promise<void> {
84
79
  Logger.trace(`${expectedUrl}`);
80
+
85
81
  try {
86
82
  await this.driverHelper.getDriver().wait(async (): Promise<boolean | undefined> => {
87
83
  const currentUrl: string = await this.driverHelper.getDriver().getCurrentUrl();
@@ -98,6 +94,7 @@ export class BrowserTabsUtil {
98
94
 
99
95
  async maximize(): Promise<void> {
100
96
  Logger.trace();
97
+
101
98
  if (CHROME_DRIVER_CONSTANTS.TS_SELENIUM_LAUNCH_FULLSCREEN) {
102
99
  Logger.debug('TS_SELENIUM_LAUNCH_FULLSCREEN is set to true, maximizing window.');
103
100
  await this.driverHelper.getDriver().manage().window().maximize();
@@ -106,6 +103,7 @@ export class BrowserTabsUtil {
106
103
 
107
104
  async closeAllTabsExceptCurrent(): Promise<void> {
108
105
  Logger.trace();
106
+
109
107
  const allTabsHandles: string[] = await this.getAllWindowHandles();
110
108
  const currentTabHandle: string = await this.getCurrentWindowHandle();
111
109
  allTabsHandles.splice(allTabsHandles.indexOf(currentTabHandle), 1);