@eclipse-che/che-e2e 7.46.1-dev-cc22326 → 7.46.1-dev-957e450

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 (130) hide show
  1. package/dist/driver/CheReporter.js +2 -5
  2. package/dist/driver/CheReporter.js.map +1 -1
  3. package/dist/pageobjects/ide/Editor.js +1 -1
  4. package/dist/pageobjects/ide/Editor.js.map +1 -1
  5. package/dist/pageobjects/ide/PreviewWidget.js +3 -0
  6. package/dist/pageobjects/ide/PreviewWidget.js.map +1 -1
  7. package/dist/pageobjects/ide/ProjectTree.js +12 -6
  8. package/dist/pageobjects/ide/ProjectTree.js.map +1 -1
  9. package/dist/tests/devfiles/CSlashCPlusPlus.spec.js +2 -10
  10. package/dist/tests/devfiles/CSlashCPlusPlus.spec.js.map +1 -1
  11. package/dist/tests/devfiles/DevfileSmoke.spec.js +2 -10
  12. package/dist/tests/devfiles/DevfileSmoke.spec.js.map +1 -1
  13. package/dist/tests/devfiles/DotNetCore.spec.js +2 -10
  14. package/dist/tests/devfiles/DotNetCore.spec.js.map +1 -1
  15. package/dist/tests/devfiles/Go.spec.js +2 -10
  16. package/dist/tests/devfiles/Go.spec.js.map +1 -1
  17. package/dist/tests/devfiles/JavaMaven.spec.js +2 -10
  18. package/dist/tests/devfiles/JavaMaven.spec.js.map +1 -1
  19. package/dist/tests/devfiles/JavaSpringBoot.spec.js +2 -10
  20. package/dist/tests/devfiles/JavaSpringBoot.spec.js.map +1 -1
  21. package/dist/tests/devfiles/JavaVertx.spec.js +2 -10
  22. package/dist/tests/devfiles/JavaVertx.spec.js.map +1 -1
  23. package/dist/tests/devfiles/NodeJS.spec.js +2 -10
  24. package/dist/tests/devfiles/NodeJS.spec.js.map +1 -1
  25. package/dist/tests/devfiles/PHPSimple.spec.js +2 -10
  26. package/dist/tests/devfiles/PHPSimple.spec.js.map +1 -1
  27. package/dist/tests/devfiles/Python.spec.js +2 -10
  28. package/dist/tests/devfiles/Python.spec.js.map +1 -1
  29. package/dist/tests/devfiles/PythonDjango.spec.js +2 -10
  30. package/dist/tests/devfiles/PythonDjango.spec.js.map +1 -1
  31. package/dist/tests/devfiles/Quarkus.spec.js +2 -10
  32. package/dist/tests/devfiles/Quarkus.spec.js.map +1 -1
  33. package/dist/tests/devfiles/Scala.spec.js +2 -10
  34. package/dist/tests/devfiles/Scala.spec.js.map +1 -1
  35. package/dist/tests/e2e/FactoryUrl.spec.js +4 -9
  36. package/dist/tests/e2e/FactoryUrl.spec.js.map +1 -1
  37. package/dist/tests/e2e/GitPublishBranch.spec.js +2 -5
  38. package/dist/tests/e2e/GitPublishBranch.spec.js.map +1 -1
  39. package/dist/tests/e2e/GitSelfSignCert.spec.js +2 -0
  40. package/dist/tests/e2e/GitSelfSignCert.spec.js.map +1 -1
  41. package/dist/tests/e2e/GitSsh.spec.js +3 -6
  42. package/dist/tests/e2e/GitSsh.spec.js.map +1 -1
  43. package/dist/tests/e2e/OpenshiftConnector.spec.js +2 -5
  44. package/dist/tests/e2e/OpenshiftConnector.spec.js.map +1 -1
  45. package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js +3 -7
  46. package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js.map +1 -1
  47. package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js +3 -7
  48. package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js.map +1 -1
  49. package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js +3 -7
  50. package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js.map +1 -1
  51. package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js +2 -2
  52. package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js.map +1 -1
  53. package/dist/tests/e2e_happy_path/HappyPath.spec.js +13 -13
  54. package/dist/tests/e2e_happy_path/HappyPath.spec.js.map +1 -1
  55. package/dist/tests/intelij/IntelijOpenWorkspace.spec.js +2 -6
  56. package/dist/tests/intelij/IntelijOpenWorkspace.spec.js.map +1 -1
  57. package/dist/tests/load_test/LoadTest.spec.js +2 -5
  58. package/dist/tests/load_test/LoadTest.spec.js.map +1 -1
  59. package/dist/tests/login/LinkCheAndOcpUsers.spec.js +2 -2
  60. package/dist/tests/login/LinkCheAndOcpUsers.spec.js.map +1 -1
  61. package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js +4 -9
  62. package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js.map +1 -1
  63. package/dist/tests/plugins/InstallPluginUsingUI.spec.js +4 -10
  64. package/dist/tests/plugins/InstallPluginUsingUI.spec.js.map +1 -1
  65. package/dist/tests/plugins/JavaPlugin.spec.js +4 -8
  66. package/dist/tests/plugins/JavaPlugin.spec.js.map +1 -1
  67. package/dist/tests/plugins/PhpPlugin.spec.js +12 -10
  68. package/dist/tests/plugins/PhpPlugin.spec.js.map +1 -1
  69. package/dist/tests/plugins/PythonPlugin.spec.js +4 -8
  70. package/dist/tests/plugins/PythonPlugin.spec.js.map +1 -1
  71. package/dist/tests/plugins/TypescriptPlugin.spec.js +4 -8
  72. package/dist/tests/plugins/TypescriptPlugin.spec.js.map +1 -1
  73. package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js +3 -10
  74. package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js.map +1 -1
  75. package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js +3 -10
  76. package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js.map +1 -1
  77. package/dist/tests/plugins/VscodeValePlugin.spec.js +3 -10
  78. package/dist/tests/plugins/VscodeValePlugin.spec.js.map +1 -1
  79. package/dist/tests/plugins/VscodeXmlPlugin.spec.js +10 -22
  80. package/dist/tests/plugins/VscodeXmlPlugin.spec.js.map +1 -1
  81. package/dist/tests/plugins/VscodeYamlPlugin.spec.js +4 -8
  82. package/dist/tests/plugins/VscodeYamlPlugin.spec.js.map +1 -1
  83. package/dist/testsLibrary/CodeExecutionTests.js +52 -29
  84. package/dist/testsLibrary/CodeExecutionTests.js.map +1 -1
  85. package/dist/testsLibrary/WorkspaceHandlingTests.js +68 -11
  86. package/dist/testsLibrary/WorkspaceHandlingTests.js.map +1 -1
  87. package/driver/CheReporter.ts +2 -8
  88. package/package.json +1 -1
  89. package/pageobjects/ide/Editor.ts +1 -1
  90. package/pageobjects/ide/PreviewWidget.ts +3 -0
  91. package/pageobjects/ide/ProjectTree.ts +13 -8
  92. package/tests/devfiles/CSlashCPlusPlus.spec.ts +2 -9
  93. package/tests/devfiles/DevfileSmoke.spec.ts +2 -9
  94. package/tests/devfiles/DotNetCore.spec.ts +2 -9
  95. package/tests/devfiles/Go.spec.ts +2 -7
  96. package/tests/devfiles/JavaMaven.spec.ts +2 -9
  97. package/tests/devfiles/JavaSpringBoot.spec.ts +2 -9
  98. package/tests/devfiles/JavaVertx.spec.ts +2 -9
  99. package/tests/devfiles/NodeJS.spec.ts +2 -9
  100. package/tests/devfiles/PHPSimple.spec.ts +2 -9
  101. package/tests/devfiles/Python.spec.ts +2 -9
  102. package/tests/devfiles/PythonDjango.spec.ts +2 -9
  103. package/tests/devfiles/Quarkus.spec.ts +2 -9
  104. package/tests/devfiles/Scala.spec.ts +2 -10
  105. package/tests/e2e/FactoryUrl.spec.ts +4 -8
  106. package/tests/e2e/GitPublishBranch.spec.ts +2 -2
  107. package/tests/e2e/GitSelfSignCert.spec.ts +66 -65
  108. package/tests/e2e/GitSsh.spec.ts +3 -3
  109. package/tests/e2e/OpenshiftConnector.spec.ts +2 -2
  110. package/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.ts +2 -5
  111. package/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.ts +2 -5
  112. package/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.ts +2 -5
  113. package/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts +2 -2
  114. package/tests/e2e_happy_path/HappyPath.spec.ts +13 -10
  115. package/tests/intelij/IntelijOpenWorkspace.spec.ts +2 -4
  116. package/tests/load_test/LoadTest.spec.ts +2 -2
  117. package/tests/login/LinkCheAndOcpUsers.spec.ts +4 -3
  118. package/tests/plugins/GitHubPullRequestPlugin.spec.ts +4 -7
  119. package/tests/plugins/InstallPluginUsingUI.spec.ts +4 -9
  120. package/tests/plugins/JavaPlugin.spec.ts +4 -6
  121. package/tests/plugins/PhpPlugin.spec.ts +3 -9
  122. package/tests/plugins/PythonPlugin.spec.ts +4 -6
  123. package/tests/plugins/TypescriptPlugin.spec.ts +4 -6
  124. package/tests/plugins/VscodeKubernetesPlugin.spec.ts +3 -9
  125. package/tests/plugins/VscodeShellcheckPlugin.spec.ts +3 -9
  126. package/tests/plugins/VscodeValePlugin.spec.ts +3 -9
  127. package/tests/plugins/VscodeXmlPlugin.spec.ts +14 -23
  128. package/tests/plugins/VscodeYamlPlugin.spec.ts +4 -7
  129. package/testsLibrary/CodeExecutionTests.ts +43 -22
  130. package/testsLibrary/WorkspaceHandlingTests.ts +66 -9
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
- import { WorkspaceNameHandler } from '../..';
11
10
  import 'reflect-metadata';
12
11
  import { e2eContainer } from '../../inversify.config';
13
12
  import { CLASSES } from '../../inversify.types';
@@ -22,7 +21,6 @@ import { DebugView } from '../../pageobjects/ide/DebugView';
22
21
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
23
22
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
24
23
  import { Logger } from '../../utils/Logger';
25
- import CheReporter from '../../driver/CheReporter';
26
24
 
27
25
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
28
26
  const ide: Ide = e2eContainer.get(CLASSES.Ide);
@@ -31,7 +29,6 @@ const editor: Editor = e2eContainer.get(CLASSES.Editor);
31
29
  const topMenu: TopMenu = e2eContainer.get(CLASSES.TopMenu);
32
30
  const debugView: DebugView = e2eContainer.get(CLASSES.DebugView);
33
31
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
34
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
35
32
 
36
33
  const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/PhpPluginTest.yaml';
37
34
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
@@ -40,7 +37,6 @@ const subRootFolder: string = 'README.md';
40
37
 
41
38
  const fileFolderPath: string = `${projectName}`;
42
39
  const tabTitle: string = 'index.php';
43
- let workspaceName: string;
44
40
 
45
41
  suite(`The 'PhpPlugin' tests`, async () => {
46
42
  suite('Create workspace', async () => {
@@ -48,11 +44,9 @@ suite(`The 'PhpPlugin' tests`, async () => {
48
44
  await browserTabsUtil.navigateTo(factoryUrl);
49
45
  });
50
46
 
51
- test('Wait until created workspace is started', async () => {
52
- await ide.waitAndSwitchToIdeFrame();
53
- workspaceName = await workspaceNameHandler.getNameFromUrl();
54
- CheReporter.registerRunningWorkspace(workspaceName);
47
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
55
48
 
49
+ test('Wait until created workspace is started', async () => {
56
50
  await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
57
51
  await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
58
52
 
@@ -111,7 +105,7 @@ suite(`The 'PhpPlugin' tests`, async () => {
111
105
  suite('Stopping and deleting the workspace', async () => {
112
106
  test('Stop and remove workspace', async () => {
113
107
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
114
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
108
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
115
109
  return;
116
110
  }
117
111
 
@@ -17,7 +17,6 @@ import { Key } from 'selenium-webdriver';
17
17
  import { Editor } from '../../pageobjects/ide/Editor';
18
18
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
19
19
  import { Logger } from '../../utils/Logger';
20
- import CheReporter from '../../driver/CheReporter';
21
20
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
22
21
  import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
23
22
  import { PreferencesHandler } from '../../utils/PreferencesHandler';
@@ -36,7 +35,6 @@ const subRootFolder: string = '.vscode';
36
35
 
37
36
  const fileFolderPath: string = `${projectName}`;
38
37
  const tabTitle: string = 'hello-world.py';
39
- let workspaceName: string = 'python-hello-world';
40
38
 
41
39
  suite(`The 'PythonPlugin' test`, async () => {
42
40
  suite('Create workspace', async () => {
@@ -44,11 +42,11 @@ suite(`The 'PythonPlugin' test`, async () => {
44
42
  await browserTabsUtil.navigateTo(factoryUrl);
45
43
  });
46
44
 
47
- projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
45
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
48
46
 
49
- test('Wait until created workspace is started', async () => {
50
- CheReporter.registerRunningWorkspace(workspaceName);
47
+ projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
51
48
 
49
+ test('Set confirmExit preference to never', async () => {
52
50
  await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
53
51
  });
54
52
  });
@@ -78,7 +76,7 @@ suite(`The 'PythonPlugin' test`, async () => {
78
76
  suite('Stopping and deleting the workspace', async () => {
79
77
  test('Stop and remove workspace', async () => {
80
78
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
81
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
79
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
82
80
  return;
83
81
  }
84
82
 
@@ -23,7 +23,6 @@ import { Terminal } from '../../pageobjects/ide/Terminal';
23
23
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
24
24
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
25
25
  import { Logger } from '../../utils/Logger';
26
- import CheReporter from '../../driver/CheReporter';
27
26
  import { PreferencesHandler } from '../../utils/PreferencesHandler';
28
27
  import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
29
28
 
@@ -49,7 +48,6 @@ const fileFolderPath: string = `${projectName}`;
49
48
  const debugFileFolderPath: string = `${projectName}/app`;
50
49
  const debugFile: string = 'app.js';
51
50
  const tabTitle: string = 'typescript-node-debug.ts';
52
- let workspaceName: string = 'typescript-plugin';
53
51
 
54
52
  suite(`The 'TypescriptPlugin and Node-debug' tests`, async () => {
55
53
  suite('Create workspace', async () => {
@@ -57,11 +55,11 @@ suite(`The 'TypescriptPlugin and Node-debug' tests`, async () => {
57
55
  await browserTabsUtil.navigateTo(factoryUrl);
58
56
  });
59
57
 
60
- projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
58
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
61
59
 
62
- test('Wait until created workspace is started', async () => {
63
- CheReporter.registerRunningWorkspace(workspaceName);
60
+ projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
64
61
 
62
+ test('Set confirmExit preference to never', async () => {
65
63
  await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
66
64
  });
67
65
  });
@@ -160,7 +158,7 @@ suite(`The 'TypescriptPlugin and Node-debug' tests`, async () => {
160
158
  suite('Stopping and deleting the workspace', async () => {
161
159
  test('Stop and remove workspace', async () => {
162
160
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
163
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
161
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
164
162
  return;
165
163
  }
166
164
 
@@ -17,9 +17,7 @@ import { KubernetesPlugin } from '../../pageobjects/ide/plugins/KubernetesPlugin
17
17
  import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
18
18
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
19
19
  import { Logger } from '../../utils/Logger';
20
- import CheReporter from '../../driver/CheReporter';
21
20
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
22
- import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
23
21
  import { TopMenu } from '../../pageobjects/ide/TopMenu';
24
22
  import { QuickOpenContainer } from '../../pageobjects/ide/QuickOpenContainer';
25
23
  import { OpenDialogWidget, Buttons } from '../../pageobjects/ide/OpenDialogWidget';
@@ -29,7 +27,6 @@ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUti
29
27
  const ide: Ide = e2eContainer.get(CLASSES.Ide);
30
28
  const kubernetesPlugin: KubernetesPlugin = e2eContainer.get(CLASSES.KubernetesPlugin);
31
29
  const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
32
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
33
30
  const topMenu: TopMenu = e2eContainer.get(CLASSES.TopMenu);
34
31
  const quickOpenContainer: QuickOpenContainer = e2eContainer.get(CLASSES.QuickOpenContainer);
35
32
  const openDialogWidget: OpenDialogWidget = e2eContainer.get(CLASSES.OpenDialogWidget);
@@ -38,7 +35,6 @@ const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/t
38
35
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
39
36
  const sampleName: string = 'nodejs-web-app';
40
37
  const subRootFolder: string = 'app';
41
- let workspaceName: string;
42
38
 
43
39
  suite(`The 'VscodeKubernetesPlugin' test`, async () => {
44
40
  suite('Create workspace', async () => {
@@ -46,11 +42,9 @@ suite(`The 'VscodeKubernetesPlugin' test`, async () => {
46
42
  await browserTabsUtil.navigateTo(factoryUrl);
47
43
  });
48
44
 
49
- test('Wait until created workspace is started', async () => {
50
- await ide.waitAndSwitchToIdeFrame();
51
- workspaceName = await workspaceNameHandler.getNameFromUrl();
52
- CheReporter.registerRunningWorkspace(workspaceName);
45
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
53
46
 
47
+ test('Wait until created workspace is started', async () => {
54
48
  await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
55
49
  await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
56
50
 
@@ -79,7 +73,7 @@ suite(`The 'VscodeKubernetesPlugin' test`, async () => {
79
73
  suite('Stopping and deleting the workspace', async () => {
80
74
  test('Stop and remove workspace', async () => {
81
75
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
82
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
76
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
83
77
  return;
84
78
  }
85
79
 
@@ -19,9 +19,7 @@ import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
19
19
  import { Key } from 'selenium-webdriver';
20
20
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
21
21
  import { Logger } from '../../utils/Logger';
22
- import CheReporter from '../../driver/CheReporter';
23
22
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
24
- import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
25
23
 
26
24
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
27
25
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
@@ -29,7 +27,6 @@ const ide: Ide = e2eContainer.get(CLASSES.Ide);
29
27
  const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
30
28
  const editor: Editor = e2eContainer.get(CLASSES.Editor);
31
29
  const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
32
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
33
30
 
34
31
  const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/VscodeShellcheckPlugin.yaml';
35
32
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
@@ -37,7 +34,6 @@ const sampleName: string = 'nodejs-web-app';
37
34
  const subRootFolder: string = 'app';
38
35
  const pathToFile: string = `${sampleName}`;
39
36
  const fileName: string = 'test.sh';
40
- let workspaceName: string;
41
37
 
42
38
  suite(`The 'VscodeShellcheckPlugin' test`, async () => {
43
39
  suite('Create workspace', async () => {
@@ -52,11 +48,9 @@ suite(`The 'VscodeShellcheckPlugin' test`, async () => {
52
48
  await browserTabsUtil.navigateTo(factoryUrl);
53
49
  });
54
50
 
55
- test('Wait until created workspace is started', async () => {
56
- await ide.waitAndSwitchToIdeFrame();
57
- workspaceName = await workspaceNameHandler.getNameFromUrl();
58
- CheReporter.registerRunningWorkspace(workspaceName);
51
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
59
52
 
53
+ test('Wait until created workspace is started', async () => {
60
54
  await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
61
55
  await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
62
56
 
@@ -96,7 +90,7 @@ suite(`The 'VscodeShellcheckPlugin' test`, async () => {
96
90
  suite('Stopping and deleting the workspace', async () => {
97
91
  test('Stop and remove workspace', async () => {
98
92
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
99
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
93
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
100
94
  return;
101
95
  }
102
96
 
@@ -16,11 +16,9 @@ import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
16
16
  import { Editor } from '../../pageobjects/ide/Editor';
17
17
  import { TestConstants } from '../../TestConstants';
18
18
  import { TimeoutConstants } from '../../TimeoutConstants';
19
- import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
20
19
  import { Terminal } from '../../pageobjects/ide/Terminal';
21
20
  import { Logger } from '../../utils/Logger';
22
21
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
23
- import CheReporter from '../../driver/CheReporter';
24
22
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
25
23
 
26
24
  const ide: Ide = e2eContainer.get(CLASSES.Ide);
@@ -29,14 +27,12 @@ const editor: Editor = e2eContainer.get(CLASSES.Editor);
29
27
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
30
28
  const terminal: Terminal = e2eContainer.get(CLASSES.Terminal);
31
29
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
32
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
33
30
 
34
31
  const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/VscodeValePlugin.yaml';
35
32
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
36
33
  const projectName: string = 'che-docs';
37
34
  const pathToFile: string = `${projectName}/modules/administration-guide/partials`;
38
35
  const docFileName: string = 'assembly_authenticating-users.adoc';
39
- let workspaceName: string = '';
40
36
 
41
37
  suite('The "VscodeValePlugin" userstory', async () => {
42
38
  suite('Create workspace', async () => {
@@ -44,11 +40,9 @@ suite('The "VscodeValePlugin" userstory', async () => {
44
40
  await browserTabsUtil.navigateTo(factoryUrl);
45
41
  });
46
42
 
47
- test('Wait until created workspace is started', async () => {
48
- await ide.waitAndSwitchToIdeFrame();
49
- workspaceName = await workspaceNameHandler.getNameFromUrl();
50
- CheReporter.registerRunningWorkspace(workspaceName);
43
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
51
44
 
45
+ test('Wait until created workspace is started', async () => {
52
46
  await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
53
47
  await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
54
48
  });
@@ -81,7 +75,7 @@ suite('The "VscodeValePlugin" userstory', async () => {
81
75
  suite('Stopping and deleting the workspace', async () => {
82
76
  test('Stop and remove workspace', async () => {
83
77
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
84
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
78
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
85
79
  return;
86
80
  }
87
81
 
@@ -10,31 +10,31 @@
10
10
 
11
11
  import { Key } from 'selenium-webdriver';
12
12
  import { e2eContainer } from '../../inversify.config';
13
- import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
14
- import { Ide } from '../../pageobjects/ide/Ide';
15
13
  import { CLASSES } from '../../inversify.types';
16
14
  import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
17
15
  import { Editor } from '../../pageobjects/ide/Editor';
18
16
  import { TestConstants } from '../../TestConstants';
19
- import { TimeoutConstants } from '../../TimeoutConstants';
20
- import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
21
17
  import { Logger } from '../../utils/Logger';
22
- import CheReporter from '../../driver/CheReporter';
18
+ import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
19
+
23
20
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
21
+ import { PreferencesHandler } from '../../utils/PreferencesHandler';
22
+ import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
24
23
 
25
- const ide: Ide = e2eContainer.get(CLASSES.Ide);
24
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
26
25
  const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
27
26
  const editor: Editor = e2eContainer.get(CLASSES.Editor);
28
27
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
29
28
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
30
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
29
+ const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
31
30
 
32
- const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/VscodeXmlPlugin.yaml';
31
+ const devfileUrl: string = 'https://github.com/che-samples/web-nodejs-sample/tree/xml-plugin';
33
32
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
34
- const projectName: string = 'nodejs-web-app';
33
+ const projectName: string = 'web-nodejs-sample';
35
34
  const pathToFile: string = `${projectName}`;
36
35
  const xmlFileName: string = 'hello.xml';
37
- let workspaceName: string = '';
36
+ const subRootFolder: string = 'app';
37
+ let workspaceName: string = 'xml-plugin';
38
38
 
39
39
  suite('The "VscodeXmlPlugin" userstory', async () => {
40
40
  suite('Create workspace', async () => {
@@ -42,20 +42,12 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
42
42
  await browserTabsUtil.navigateTo(factoryUrl);
43
43
  });
44
44
 
45
- test('Wait until created workspace is started', async () => {
46
- await ide.waitAndSwitchToIdeFrame();
47
- workspaceName = await workspaceNameHandler.getNameFromUrl();
48
- CheReporter.registerRunningWorkspace(workspaceName);
45
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
49
46
 
50
- await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
51
- await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
52
- });
53
- });
47
+ projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
54
48
 
55
- suite('Check workspace readiness to work', async () => {
56
- test('Wait until project is imported', async () => {
57
- await projectTree.openProjectTreeContainer();
58
- await projectTree.waitProjectImported(projectName, 'app');
49
+ test('Set confirmExit preference to never', async () => {
50
+ await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
59
51
  });
60
52
  });
61
53
 
@@ -116,5 +108,4 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
116
108
  Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
117
109
  });
118
110
  });
119
-
120
111
  });
@@ -16,7 +16,6 @@ import { Editor } from '../../pageobjects/ide/Editor';
16
16
  import { TestConstants } from '../../TestConstants';
17
17
  import { Logger } from '../../utils/Logger';
18
18
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
19
- import CheReporter from '../../driver/CheReporter';
20
19
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
21
20
  import { PreferencesHandler } from '../../utils/PreferencesHandler';
22
21
  import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
@@ -36,19 +35,17 @@ const pathToFile: string = `${projectName}`;
36
35
  const yamlFileName: string = 'routes.yaml';
37
36
  const yamlSchema = { 'yaml-schema.json': '*.yaml' };
38
37
 
39
- let workspaceName: string = 'yaml-plugin';
40
-
41
38
  suite('The "VscodeYamlPlugin" userstory', async () => {
42
39
  suite('Create workspace', async () => {
43
40
  test('Create workspace using factory', async () => {
44
41
  await browserTabsUtil.navigateTo(factoryUrl);
45
42
  });
46
43
 
47
- projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
44
+ workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
48
45
 
49
- test('Wait until created workspace is started', async () => {
50
- CheReporter.registerRunningWorkspace(workspaceName);
46
+ projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
51
47
 
48
+ test('Set confirmExit preference to never', async () => {
52
49
  await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
53
50
  });
54
51
  });
@@ -97,7 +94,7 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
97
94
  suite('Delete workspace', async () => {
98
95
  test('Stop and remove workspace', async () => {
99
96
  if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
100
- await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
97
+ await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
101
98
  return;
102
99
  }
103
100
 
@@ -18,10 +18,10 @@ import { Terminal } from '../pageobjects/ide/Terminal';
18
18
  import { TopMenu } from '../pageobjects/ide/TopMenu';
19
19
  import { DialogWindow } from '../pageobjects/ide/DialogWindow';
20
20
  import { DriverHelper } from '../utils/DriverHelper';
21
- import { PreviewWidget } from '../pageobjects/ide/PreviewWidget';
22
- import { RightToolBar } from '../pageobjects/ide/RightToolBar';
23
21
  import { Logger } from '../utils/Logger';
24
22
  import { QuickOpenContainer } from '../pageobjects/ide/QuickOpenContainer';
23
+ import { WorkspaceHandlingTests } from './WorkspaceHandlingTests';
24
+ import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
25
25
 
26
26
  @injectable()
27
27
  export class CodeExecutionTests {
@@ -34,9 +34,9 @@ export class CodeExecutionTests {
34
34
  @inject(CLASSES.Ide) private readonly ide: Ide,
35
35
  @inject(CLASSES.DialogWindow) private readonly dialogWindow: DialogWindow,
36
36
  @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
37
- @inject(CLASSES.PreviewWidget) private readonly previewWidget: PreviewWidget,
38
- @inject(CLASSES.RightToolBar) private readonly rightToolBar: RightToolBar,
39
- @inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer) {}
37
+ @inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer,
38
+ @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil,
39
+ @inject(CLASSES.WorkspaceHandlingTests) private readonly workspaceHandlingTests: WorkspaceHandlingTests) {}
40
40
 
41
41
  public runTask(taskName: string, timeout: number) {
42
42
  test(`Run command '${taskName}'`, async () => {
@@ -66,6 +66,7 @@ export class CodeExecutionTests {
66
66
  public runTaskWithDialogShellAndOpenLink(taskName: string, expectedDialogText: string, timeout: number) {
67
67
  test(`Run command '${taskName}' expecting dialog shell`, async () => {
68
68
  await this.runTaskUsingQuickOpenContainer(taskName);
69
+ this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
69
70
  await this.dialogWindow.waitDialogAndOpenLink(expectedDialogText, timeout);
70
71
  });
71
72
  }
@@ -107,17 +108,24 @@ export class CodeExecutionTests {
107
108
  test(`Run command '${taskName}' expecting notification`, async () => {
108
109
  await this.runTaskUsingQuickOpenContainer(taskName);
109
110
  await this.ide.waitNotification(notificationText, timeout);
111
+ this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
110
112
  await this.ide.clickOnNotificationButton(notificationText, buttonText);
111
- CodeExecutionTests.lastApplicationUrl = await this.previewWidget.getUrl();
113
+ await this.driverHelper.wait(5_000);
114
+ CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
112
115
  });
113
116
  }
114
117
 
118
+ /**
119
+ * @deprecated This method should not be used, preview widget is no longer a valid page fragment.
120
+ */
115
121
  public runTaskWithNotificationAndOpenLinkPreviewNoUrl(taskName: string, notificationText: string, timeout: number) {
116
122
  test(`Run command '${taskName}' expecting notification`, async () => {
117
123
  await this.runTaskUsingQuickOpenContainer(taskName);
118
124
  await this.ide.waitNotification(notificationText, timeout);
125
+ this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
119
126
  await this.ide.clickOnNotificationButton(notificationText, 'Open In Preview');
120
- CodeExecutionTests.lastApplicationUrl = await this.previewWidget.getUrl();
127
+ await this.driverHelper.wait(5_000);
128
+ CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
121
129
  });
122
130
  }
123
131
 
@@ -125,24 +133,32 @@ export class CodeExecutionTests {
125
133
  test(`Run command '${taskName}' expecting notification with unexposed port`, async () => {
126
134
  await this.runTaskUsingQuickOpenContainer(taskName);
127
135
  await this.ide.waitNotificationAndConfirm(notificationText, timeout);
136
+ this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
128
137
  await this.ide.waitNotificationAndOpenLink(portOpenText, timeout);
129
- CodeExecutionTests.lastApplicationUrl = await this.previewWidget.getUrl();
138
+ await this.driverHelper.wait(5_000);
139
+ CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
130
140
  });
131
141
  }
132
142
 
133
143
  public verifyRunningApplication(locator: By, applicationCheckTimeout: number, polling: number) {
134
144
  test(`Verify running application by locator: '${locator}'`, async () => {
135
- await this.previewWidget.waitApplicationOpened(CodeExecutionTests.lastApplicationUrl, applicationCheckTimeout);
136
- try {
137
- await this.previewWidget.waitContentAvailable(locator, applicationCheckTimeout, polling);
138
- } catch (err) {
139
- // fix for preloader / application not available in preview widget
140
- // https://issues.redhat.com/browse/CRW-2175
141
- if (err instanceof error.TimeoutError) {
142
- Logger.warn(`CodeExecutionTests.verifyRunningApplication application not located, probably blocked by preloader or content not available. Retrying.`);
143
- await this.ide.waitIde();
144
- await this.previewWidget.refreshPage();
145
- await this.previewWidget.waitContentAvailable(locator, applicationCheckTimeout, polling);
145
+ let timeout: number = applicationCheckTimeout / polling;
146
+ let attempts: number = applicationCheckTimeout / timeout;
147
+ for (let i = 0; i < attempts; i++) {
148
+ try {
149
+ await this.driverHelper.waitPresence(locator, timeout);
150
+ } catch (err) {
151
+ if (err instanceof error.TimeoutError) {
152
+ if (i === attempts - 1) {
153
+ Logger.error(`CodeExecutionTests.verifyRunningApplication out of retries to wait for ${locator} presence.`);
154
+ throw err;
155
+ } else {
156
+ Logger.trace(`CodeExecutionTests.verifyRunningApplication timed out waiting for ${locator} presence. Retrying ${i}.`);
157
+ }
158
+ } else {
159
+ Logger.error(`CodeExecutionTests.verifyRunningApplication failed with unexpected exception.`);
160
+ throw err;
161
+ }
146
162
  }
147
163
  }
148
164
  });
@@ -152,16 +168,21 @@ export class CodeExecutionTests {
152
168
  return CodeExecutionTests.lastApplicationUrl;
153
169
  }
154
170
 
171
+ /**
172
+ * @deprecated This method should not be used, preview widget is no longer a valid page fragment.
173
+ */
155
174
  public refreshPreviewWindow() {
156
175
  test('Refreshing preview widget', async () => {
157
- await this.previewWidget.refreshPage();
176
+ Logger.warn(`Method is deprecated.`);
158
177
  });
159
178
  }
160
179
 
180
+ /**
181
+ * @deprecated This method should not be used, preview widget is no longer a valid page fragment.
182
+ */
161
183
  public closePreviewWidget() {
162
184
  test('Close preview widget', async () => {
163
- await this.rightToolBar.clickOnToolIcon('Preview');
164
- await this.previewWidget.waitPreviewWidgetAbsence();
185
+ Logger.warn(`Method is deprecated.`);
165
186
  });
166
187
  }
167
188
 
@@ -15,39 +15,56 @@ import { Dashboard } from '../pageobjects/dashboard/Dashboard';
15
15
  import { CreateWorkspace } from '../pageobjects/dashboard/CreateWorkspace';
16
16
  import { Workspaces } from '../pageobjects/dashboard/Workspaces';
17
17
  import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
18
- import { Logger } from '..';
18
+ import { Logger } from '../utils/Logger';
19
+ import { TimeoutConstants } from '../TimeoutConstants';
20
+ import { DriverHelper } from '../utils/DriverHelper';
21
+ import { Ide } from '../pageobjects/ide/Ide';
22
+ import { By, error } from 'selenium-webdriver';
19
23
 
20
24
  @injectable()
21
25
  export class WorkspaceHandlingTests {
22
26
 
27
+ private static START_WORKSPACE_PAGE_NAME_LOCATOR: By = By.xpath(`//div[@class="ui-container"]/div[@class="pf-c-page"]//div[@class="pf-c-content"]/h1`);
23
28
  private static workspaceName: string = 'undefined';
29
+ private static parentGUID: string;
24
30
 
25
31
  public static getWorkspaceName(): string {
26
32
  return WorkspaceHandlingTests.workspaceName;
27
33
  }
28
34
 
35
+ public static setWorkspaceName(workspaceName: string) {
36
+ WorkspaceHandlingTests.workspaceName = workspaceName;
37
+ }
38
+
39
+ public setWindowHandle(guid: string) {
40
+ WorkspaceHandlingTests.parentGUID = guid;
41
+ }
42
+
43
+ public getWindowHandle(): string {
44
+ return WorkspaceHandlingTests.parentGUID;
45
+ }
46
+
29
47
  constructor(
30
48
  @inject(CLASSES.Dashboard) private readonly dashboard: Dashboard,
31
49
  @inject(CLASSES.CreateWorkspace) private readonly createWorkspace: CreateWorkspace,
32
50
  @inject(CLASSES.Workspaces) private readonly workspaces: Workspaces,
33
- @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) {}
51
+ @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
52
+ @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil,
53
+ @inject(CLASSES.Ide) private readonly ide: Ide) {}
34
54
 
35
55
  public createAndOpenWorkspace(stack: string) {
36
- test(`Open 'New Workspace' page`, async () => {
56
+ test(`Create and open new workspace, stack:${stack}`, async () => {
37
57
  await this.dashboard.waitPage();
38
58
  await this.dashboard.clickCreateWorkspaceButton();
39
59
  await this.createWorkspace.waitPage();
40
- const parentGUID = await this.browserTabsUtil.getCurrentWindowHandle();
60
+ WorkspaceHandlingTests.parentGUID = await this.browserTabsUtil.getCurrentWindowHandle();
41
61
  await this.createWorkspace.clickOnSample(stack);
42
- await this.browserTabsUtil.switchToWindow(parentGUID);
43
- WorkspaceHandlingTests.workspaceName = await this.dashboard.getRecentWorkspaceName(10000);
44
- Logger.debug(`Workspace Name is: ${WorkspaceHandlingTests.workspaceName}`);
45
- await this.browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID, 10000);
62
+ await this.browserTabsUtil.waitAndSwitchToAnotherWindow(WorkspaceHandlingTests.parentGUID, TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
46
63
  });
47
64
  }
48
65
 
49
66
  public openExistingWorkspace(workspaceName: string) {
50
- test('Start workspace', async () => {
67
+ test('Open and start existing workspace', async () => {
51
68
  await this.dashboard.waitPage();
52
69
  await this.dashboard.clickWorkspacesButton();
53
70
  await this.workspaces.waitPage();
@@ -55,6 +72,46 @@ export class WorkspaceHandlingTests {
55
72
  });
56
73
  }
57
74
 
75
+ public obtainWorkspaceNameFromStartingPage() {
76
+ test('Obtain workspace name from workspace loader page', async() => {
77
+ try {
78
+ await this.driverHelper.waitVisibility(WorkspaceHandlingTests.START_WORKSPACE_PAGE_NAME_LOCATOR, TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT);
79
+ // it takes a while to update the element with the workspace name
80
+ await this.driverHelper.wait(10_000);
81
+ let startingWorkspaceLineContent = await this.driverHelper.getDriver().findElement(WorkspaceHandlingTests.START_WORKSPACE_PAGE_NAME_LOCATOR).getAttribute('innerHTML');
82
+ // cutting away leading text
83
+ WorkspaceHandlingTests.workspaceName = startingWorkspaceLineContent.substring('Starting workspace '.length).trim();
84
+ Logger.info(`Obtained workspace name from workspace loader page: ${WorkspaceHandlingTests.workspaceName}`);
85
+ } catch (err) {
86
+ Logger.error(`Failed to obtain workspace name from workspace loader page: ${err}`);
87
+ throw err;
88
+ }
89
+ });
90
+ }
91
+
92
+ public switchBackToFirstOpenIdeTabFromLeftToRight() {
93
+ test('WorkspaceHandlingTests.switchBackToIdeTab', async () => {
94
+ let tabs = await this.driverHelper.getDriver().getAllWindowHandles();
95
+ Logger.trace(`WorkspaceHandlingTests.switchBackToIdeTab Found ${tabs.length} window handles, iterating...`);
96
+ for (let i = 0; i < tabs.length; i++) {
97
+ await this.browserTabsUtil.switchToWindow(tabs[i]);
98
+ try {
99
+ await this.ide.waitIde(TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
100
+ Logger.info(`WorkspaceHandlingTests.switchBackToIdeTab located and switched to IDE tab`);
101
+ return;
102
+ } catch (err) {
103
+ if (err instanceof error.TimeoutError) {
104
+ Logger.warn(`WorkspaceHandlingTests.switchBackToIdeTab Locator timed out, trying with another window handle.`);
105
+ continue;
106
+ }
107
+ Logger.error(`WorkspaceHandlingTests.switchBackToIdeTab Received unexpected exception while trying to locate IDE tab:${err}`);
108
+ throw err;
109
+ }
110
+ }
111
+ Logger.error(`WorkspaceHandlingTests.switchBackToIdeTab Failed to locate IDE tab, out of window handles.`);
112
+ });
113
+ }
114
+
58
115
  public async stopWorkspace(workspaceName: string) {
59
116
  await this.dashboard.openDashboard();
60
117
  await this.dashboard.stopWorkspaceByUI(workspaceName);