@eclipse-che/che-e2e 7.76.0-next-6068ce8 → 7.76.0-next-9fb1a12

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 (118) hide show
  1. package/CODE_STYLE.md +1 -1
  2. package/configs/inversify.config.ts +1 -7
  3. package/configs/mocharc.ts +11 -5
  4. package/configs/reporters.config.js +51 -0
  5. package/configs/sh-scripts/runFunctionalTests.sh +104 -0
  6. package/constants/API_TEST_CONSTANTS.ts +5 -2
  7. package/constants/BASE_TEST_CONSTANTS.ts +37 -7
  8. package/constants/MOCHA_CONSTANTS.ts +12 -2
  9. package/constants/REPORTER_CONSTANTS.ts +98 -5
  10. package/constants/TIMEOUT_CONSTANTS.ts +10 -22
  11. package/dist/configs/inversify.config.js +0 -5
  12. package/dist/configs/inversify.config.js.map +1 -1
  13. package/dist/configs/mocharc.js +18 -13
  14. package/dist/configs/mocharc.js.map +1 -1
  15. package/dist/constants/API_TEST_CONSTANTS.js +3 -2
  16. package/dist/constants/API_TEST_CONSTANTS.js.map +1 -1
  17. package/dist/constants/BASE_TEST_CONSTANTS.js +22 -0
  18. package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -1
  19. package/dist/constants/MOCHA_CONSTANTS.js +8 -4
  20. package/dist/constants/MOCHA_CONSTANTS.js.map +1 -1
  21. package/dist/constants/REPORTER_CONSTANTS.js +70 -2
  22. package/dist/constants/REPORTER_CONSTANTS.js.map +1 -1
  23. package/dist/constants/TIMEOUT_CONSTANTS.js +0 -8
  24. package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -1
  25. package/dist/specs/MochaHooks.js +14 -3
  26. package/dist/specs/MochaHooks.js.map +1 -1
  27. package/dist/specs/SmokeTest.spec.js +1 -1
  28. package/dist/specs/SmokeTest.spec.js.map +1 -1
  29. package/dist/specs/api/ContainerOverridesAPI.spec.js +2 -1
  30. package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
  31. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +9 -7
  32. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  33. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +2 -5
  34. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  35. package/dist/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.js +97 -0
  36. package/dist/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.js.map +1 -0
  37. package/dist/specs/api/PodOverridesAPI.spec.js +1 -1
  38. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  39. package/dist/specs/dashboard-samples/Documentation.spec.js +1 -1
  40. package/dist/specs/dashboard-samples/Documentation.spec.js.map +1 -1
  41. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +2 -1
  42. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  43. package/dist/specs/dashboard-samples/Quarkus.spec.js +1 -1
  44. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  45. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +2 -1
  46. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  47. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +1 -1
  48. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  49. package/dist/specs/factory/Factory.spec.js +1 -1
  50. package/dist/specs/factory/Factory.spec.js.map +1 -1
  51. package/dist/specs/factory/NoSetupRepoFactory.spec.js +1 -1
  52. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  53. package/dist/specs/factory/RefusedOAuthFactory.spec.js +1 -1
  54. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  55. package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js +1 -1
  56. package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js.map +1 -1
  57. package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js +3 -2
  58. package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js.map +1 -1
  59. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +2 -1
  60. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  61. package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js +6 -1
  62. package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js.map +1 -1
  63. package/dist/specs/web-terminal/WebTerminalTest.spec.js +2 -1
  64. package/dist/specs/web-terminal/WebTerminalTest.spec.js.map +1 -1
  65. package/dist/suites/disconnected-ocp/APITest.suite.js +14 -0
  66. package/dist/suites/disconnected-ocp/APITest.suite.js.map +1 -0
  67. package/dist/suites/disconnected-ocp/DynamicallyGeneratingAPITest.suite.js +13 -0
  68. package/dist/suites/disconnected-ocp/DynamicallyGeneratingAPITest.suite.js.map +1 -0
  69. package/dist/suites/disconnected-ocp/UITest.suite.js +19 -0
  70. package/dist/suites/disconnected-ocp/UITest.suite.js.map +1 -0
  71. package/dist/suites/online-ocp/APITest.suite.js +15 -0
  72. package/dist/suites/online-ocp/APITest.suite.js.map +1 -0
  73. package/dist/suites/online-ocp/DynamicallyGeneratingAPITest.suite.js +13 -0
  74. package/dist/suites/online-ocp/DynamicallyGeneratingAPITest.suite.js.map +1 -0
  75. package/dist/suites/online-ocp/UITest.suite.js +22 -0
  76. package/dist/suites/online-ocp/UITest.suite.js.map +1 -0
  77. package/dist/tests-library/LoginTests.js +3 -1
  78. package/dist/tests-library/LoginTests.js.map +1 -1
  79. package/dist/utils/DevWorkspaceConfigurationHelper.js +44 -2
  80. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  81. package/dist/utils/DevfilesRegistryHelper.js +22 -8
  82. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  83. package/dist/utils/KubernetesCommandLineToolsExecutor.js +15 -14
  84. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  85. package/package.json +11 -8
  86. package/specs/MochaHooks.ts +15 -3
  87. package/specs/SmokeTest.spec.ts +1 -1
  88. package/specs/api/ContainerOverridesAPI.spec.ts +2 -1
  89. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +10 -8
  90. package/specs/api/EmptyWorkspaceAPI.spec.ts +2 -6
  91. package/specs/api/InbuiltApplicationDevWorkspacesAPI.spec.ts +130 -0
  92. package/specs/api/PodOverridesAPI.spec.ts +1 -1
  93. package/specs/dashboard-samples/Documentation.spec.ts +1 -1
  94. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +2 -1
  95. package/specs/dashboard-samples/Quarkus.spec.ts +1 -1
  96. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +2 -1
  97. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +1 -1
  98. package/specs/factory/Factory.spec.ts +1 -1
  99. package/specs/factory/NoSetupRepoFactory.spec.ts +1 -1
  100. package/specs/factory/RefusedOAuthFactory.spec.ts +1 -1
  101. package/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts +1 -1
  102. package/specs/miscellaneous/KubedockPodmanTest.spec.ts +63 -59
  103. package/specs/miscellaneous/PredefinedNamespace.spec.ts +2 -1
  104. package/specs/miscellaneous/WorkspaceWithParent.spec.ts +9 -2
  105. package/specs/web-terminal/WebTerminalTest.spec.ts +2 -1
  106. package/suites/disconnected-ocp/APITest.suite.ts +11 -0
  107. package/suites/disconnected-ocp/DynamicallyGeneratingAPITest.suite.ts +10 -0
  108. package/suites/disconnected-ocp/UITest.suite.ts +16 -0
  109. package/suites/online-ocp/APITest.suite.ts +12 -0
  110. package/suites/online-ocp/DynamicallyGeneratingAPITest.suite.ts +10 -0
  111. package/suites/online-ocp/UITest.suite.ts +19 -0
  112. package/tests-library/LoginTests.ts +6 -1
  113. package/tsconfig.json +1 -1
  114. package/utils/DevWorkspaceConfigurationHelper.ts +36 -3
  115. package/utils/DevfilesRegistryHelper.ts +28 -9
  116. package/utils/IKubernetesCommandLineToolsExecutor.ts +1 -1
  117. package/utils/KubernetesCommandLineToolsExecutor.ts +14 -14
  118. package/configs/reporters-config.json +0 -6
@@ -33,11 +33,12 @@ import { expect } from 'chai';
33
33
  import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
34
34
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
35
35
  import { PLUGIN_TEST_CONSTANTS } from '../../constants/PLUGIN_TEST_CONSTANTS';
36
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
36
37
 
37
38
  const samples: string[] = PLUGIN_TEST_CONSTANTS.TS_SAMPLE_LIST.split(',');
38
39
 
39
40
  for (const sample of samples) {
40
- suite(`Check if recommended extensions installed for ${sample}`, function (): void {
41
+ suite(`Check if recommended extensions installed for ${sample} ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
41
42
  const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
42
43
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
43
44
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
@@ -25,7 +25,7 @@ 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
- suite('DevConsole Integration', function (): void {
28
+ suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
29
29
  let ocpImportPage: OcpImportFromGitPage;
30
30
  let ocpApplicationPage: OcpApplicationPage;
31
31
 
@@ -39,7 +39,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
39
39
  import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
40
40
 
41
41
  suite(
42
- `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`,
42
+ `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
43
43
  function (): void {
44
44
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
45
45
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
@@ -41,7 +41,7 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
41
41
  import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
42
42
 
43
43
  suite(
44
- `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without PAT/OAuth setup`,
44
+ `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without PAT/OAuth setup ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
45
45
  function (): void {
46
46
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
47
47
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
@@ -40,7 +40,7 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
40
40
  import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
41
41
 
42
42
  suite(
43
- `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`,
43
+ `Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
44
44
  function (): void {
45
45
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
46
46
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
@@ -23,7 +23,7 @@ import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
23
23
  const stackName: string = BASE_TEST_CONSTANTS.TS_SELENIUM_DASHBOARD_SAMPLE_NAME || 'Python';
24
24
  const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || 'python-hello-world';
25
25
 
26
- suite('"Start workspace with existed workspace name" test', function (): void {
26
+ suite(`"Start workspace with existed workspace name" test ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
27
27
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
28
28
  const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
29
29
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
@@ -18,75 +18,79 @@ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
18
18
  import { expect } from 'chai';
19
19
  import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
20
20
  import { ShellString } from 'shelljs';
21
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
21
22
 
22
- suite('Check possibility to manage containers within a workspace with kubedock and podman', function (): void {
23
- const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
24
- const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
25
- const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
26
- const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
27
- let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
28
- let workspaceName: string = '';
23
+ suite(
24
+ `Check possibility to manage containers within a workspace with kubedock and podman ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
25
+ function (): void {
26
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
27
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
28
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
29
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
30
+ let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
31
+ let workspaceName: string = '';
29
32
 
30
- const testScript: string =
31
- '# Enable Kubedock\n' +
32
- 'export KUBEDOCK_ENABLED=true\n' +
33
- 'echo KUBEDOCK_ENABLED\n' +
34
- '/entrypoint.sh\n' +
35
- 'cd $PROJECT_SOURCE\n' +
36
- 'export USER=$(oc whoami)\n' +
37
- 'export TKN=$(oc whoami -t)\n' +
38
- 'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
39
- 'export PROJECT=$(oc project -q)\n' +
40
- 'export IMG="${REG}/${PROJECT}/hello"\n' +
41
- 'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
42
- 'podman build -t ${IMG} .\n' +
43
- 'podman push --tls-verify=false ${IMG}\n' +
44
- 'podman run --rm ${IMG}';
33
+ const testScript: string =
34
+ '# Enable Kubedock\n' +
35
+ 'export KUBEDOCK_ENABLED=true\n' +
36
+ 'echo KUBEDOCK_ENABLED\n' +
37
+ '/entrypoint.sh\n' +
38
+ 'cd $PROJECT_SOURCE\n' +
39
+ 'export USER=$(oc whoami)\n' +
40
+ 'export TKN=$(oc whoami -t)\n' +
41
+ 'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
42
+ 'export PROJECT=$(oc project -q)\n' +
43
+ 'export IMG="${REG}/${PROJECT}/hello"\n' +
44
+ 'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
45
+ 'podman build -t ${IMG} .\n' +
46
+ 'podman push --tls-verify=false ${IMG}\n' +
47
+ 'podman run --rm ${IMG}';
45
48
 
46
- const factoryUrl: string = 'https://github.com/l0rd/dockerfile-hello-world';
49
+ const factoryUrl: string = 'https://github.com/l0rd/dockerfile-hello-world';
47
50
 
48
- loginTests.loginIntoChe();
51
+ loginTests.loginIntoChe();
49
52
 
50
- test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
51
- await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
52
- });
53
+ test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
54
+ await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
55
+ });
53
56
 
54
- test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
55
- await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
56
- workspaceName = WorkspaceHandlingTests.getWorkspaceName();
57
- expect(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined;
58
- });
57
+ test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
58
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
59
+ workspaceName = WorkspaceHandlingTests.getWorkspaceName();
60
+ expect(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined;
61
+ });
59
62
 
60
- test('Register running workspace', function (): void {
61
- registerRunningWorkspace(workspaceName);
62
- });
63
+ test('Register running workspace', function (): void {
64
+ registerRunningWorkspace(workspaceName);
65
+ });
63
66
 
64
- test('Wait workspace readiness', async function (): Promise<void> {
65
- await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
66
- });
67
+ test('Wait workspace readiness', async function (): Promise<void> {
68
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
69
+ });
67
70
 
68
- test('Check the project files were imported', async function (): Promise<void> {
69
- const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession();
70
- expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile'), 'Files not imported').not.undefined;
71
- });
71
+ test('Check the project files were imported', async function (): Promise<void> {
72
+ const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession();
73
+ expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile'), 'Files not imported').not.undefined;
74
+ });
72
75
 
73
- test('Create and check container runs using kubedock and podman', function (): void {
74
- kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
75
- kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
76
- kubernetesCommandLineToolsExecutor.loginToOcp();
77
- kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
78
- const output: ShellString = kubernetesCommandLineToolsExecutor.executeCommand(testScript);
79
- expect(output, 'Podman test script failed').contains('Hello from Kubedock!');
80
- });
76
+ test('Create and check container runs using kubedock and podman', function (): void {
77
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
78
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
79
+ kubernetesCommandLineToolsExecutor.loginToOcp();
80
+ kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
81
+ const output: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(testScript);
82
+ expect(output, 'Podman test script failed').contains('Hello from Kubedock!');
83
+ });
81
84
 
82
- test('Stop the workspace', async function (): Promise<void> {
83
- await workspaceHandlingTests.stopWorkspace(workspaceName);
84
- await browserTabsUtil.closeAllTabsExceptCurrent();
85
- });
85
+ test('Stop the workspace', async function (): Promise<void> {
86
+ await workspaceHandlingTests.stopWorkspace(workspaceName);
87
+ await browserTabsUtil.closeAllTabsExceptCurrent();
88
+ });
86
89
 
87
- test('Delete the workspace', async function (): Promise<void> {
88
- await workspaceHandlingTests.removeWorkspace(workspaceName);
89
- });
90
+ test('Delete the workspace', async function (): Promise<void> {
91
+ await workspaceHandlingTests.removeWorkspace(workspaceName);
92
+ });
90
93
 
91
- loginTests.logoutFromChe();
92
- });
94
+ loginTests.logoutFromChe();
95
+ }
96
+ );
@@ -16,8 +16,9 @@ import { LoginTests } from '../../tests-library/LoginTests';
16
16
  import { registerRunningWorkspace } from '../MochaHooks';
17
17
  import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
18
18
  import { ShellExecutor } from '../../utils/ShellExecutor';
19
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
19
20
 
20
- suite('Create predefined workspace and check it', function (): void {
21
+ suite(`Create predefined workspace and check it ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
21
22
  const predefinedNamespaceName: string = 'predefined-ns';
22
23
  const stackName: string = 'Empty Workspace';
23
24
 
@@ -10,7 +10,7 @@
10
10
  import { e2eContainer } from '../../configs/inversify.config';
11
11
  import { ShellExecutor } from '../../utils/ShellExecutor';
12
12
  import { InputBox, QuickOpenBox, QuickPickItem, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
13
- import { CLASSES } from '../../configs/inversify.types';
13
+ import { CLASSES, TYPES } from '../../configs/inversify.types';
14
14
  import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
15
15
  import { LoginTests } from '../../tests-library/LoginTests';
16
16
  import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
@@ -21,13 +21,15 @@ import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS';
21
21
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
22
22
  import { registerRunningWorkspace } from '../MochaHooks';
23
23
  import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
24
+ import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
24
25
 
25
- suite('Workspace using a parent test suite', function (): void {
26
+ suite(`Workspace using a parent test suite ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
26
27
  const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
27
28
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
28
29
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
29
30
  const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
30
31
  const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
32
+ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
31
33
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
32
34
  const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
33
35
  CLASSES.KubernetesCommandLineToolsExecutor
@@ -96,5 +98,10 @@ suite('Workspace using a parent test suite', function (): void {
96
98
  expect(envList).contains('DEVFILE_ENV_VAR=true').and.contains('PARENT_ENV_VAR=true');
97
99
  });
98
100
 
101
+ test('Stop and delete the workspace by API', async function (): Promise<void> {
102
+ await browserTabsUtil.closeAllTabsExceptCurrent();
103
+ testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
104
+ });
105
+
99
106
  loginTests.logoutFromChe();
100
107
  });
@@ -11,8 +11,9 @@ import { CLASSES } from '../../configs/inversify.types';
11
11
  import { e2eContainer } from '../../configs/inversify.config';
12
12
  import { LoginTests } from '../../tests-library/LoginTests';
13
13
  import { OcpMainPage } from '../../pageobjects/openshift/OcpMainPage';
14
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
14
15
 
15
- suite('Login to Openshift console and start WebTerminal', function (): void {
16
+ suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
16
17
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
17
18
  const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
18
19
 
@@ -0,0 +1,11 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/api/ContainerOverridesAPI.spec';
11
+ import '../../specs/api/PodOverridesAPI.spec';
@@ -0,0 +1,10 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/api/InbuiltApplicationDevWorkspacesAPI.spec';
@@ -0,0 +1,16 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/dashboard-samples/Quarkus.spec';
11
+ import '../../specs/dashboard-samples/RecommendedExtensions.spec';
12
+ import '../../specs/dashboard-samples/Documentation.spec';
13
+ import '../../specs/devconsole-intergration/DevConsoleIntegration.spec';
14
+ import '../../specs/miscellaneous/CreateWorkspaceWithExistedName.spec';
15
+ import '../../specs/miscellaneous/PredefinedNamespace.spec';
16
+ import '../../specs/miscellaneous/WorkspaceWithParent.spec';
@@ -0,0 +1,12 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/api/ContainerOverridesAPI.spec';
11
+ import '../../specs/api/EmptyWorkspaceAPI.spec';
12
+ import '../../specs/api/PodOverridesAPI.spec';
@@ -0,0 +1,10 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/api/InbuiltApplicationDevWorkspacesAPI.spec';
@@ -0,0 +1,19 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import '../../specs/SmokeTest.spec';
11
+ import '../../specs/dashboard-samples/EmptyWorkspace.spec';
12
+ import '../../specs/dashboard-samples/Quarkus.spec';
13
+ import '../../specs/dashboard-samples/RecommendedExtensions.spec';
14
+ import '../../specs/dashboard-samples/Documentation.spec';
15
+ import '../../specs/devconsole-intergration/DevConsoleIntegration.spec';
16
+ import '../../specs/miscellaneous/CreateWorkspaceWithExistedName.spec';
17
+ import '../../specs/miscellaneous/KubedockPodmanTest.spec';
18
+ import '../../specs/miscellaneous/PredefinedNamespace.spec';
19
+ import '../../specs/miscellaneous/WorkspaceWithParent.spec';
@@ -15,6 +15,7 @@ import { inject, injectable } from 'inversify';
15
15
  import { Dashboard } from '../pageobjects/dashboard/Dashboard';
16
16
  import { IOcpLoginPage } from '../pageobjects/login/interfaces/IOcpLoginPage';
17
17
  import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
18
+ import { registerRunningWorkspace } from '../specs/MochaHooks';
18
19
 
19
20
  @injectable()
20
21
  export class LoginTests {
@@ -40,7 +41,10 @@ export class LoginTests {
40
41
 
41
42
  loginIntoOcpConsole(): void {
42
43
  test('Login into ocp console', async (): Promise<void> => {
43
- const openshiftConsoleUrl: string = BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.replace('devspaces', 'console-openshift-console');
44
+ const openshiftConsoleUrl: string = BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.replace(
45
+ BASE_TEST_CONSTANTS.TESTING_APPLICATION_NAME(),
46
+ 'console-openshift-console'
47
+ );
44
48
  await this.browserTabsUtil.navigateTo(openshiftConsoleUrl);
45
49
  await this.ocpLoginPage.login();
46
50
  await this.browserTabsUtil.maximize();
@@ -50,6 +54,7 @@ export class LoginTests {
50
54
  logoutFromChe(): void {
51
55
  test('Logout', async (): Promise<void> => {
52
56
  await this.dashboard.logout();
57
+ registerRunningWorkspace('');
53
58
  });
54
59
  }
55
60
  }
package/tsconfig.json CHANGED
@@ -13,5 +13,5 @@
13
13
  "noImplicitReturns": false,
14
14
  "sourceMap": true
15
15
  },
16
- "include": [".eslintrc.js", "**/*.ts", "**/**/*.ts"]
16
+ "include": [".eslintrc.js", "**/*.ts", "**/**/*.ts", "**/reporters.config.js"]
17
17
  }
@@ -19,12 +19,16 @@ import { injectable } from 'inversify';
19
19
  import { IContextParams } from './IContextParams';
20
20
  import { e2eContainer } from '../configs/inversify.config';
21
21
  import { CLASSES, EXTERNAL_CLASSES } from '../configs/inversify.types';
22
+ import getDecorators from 'inversify-inject-decorators';
23
+
24
+ const { lazyInject } = getDecorators(e2eContainer);
22
25
 
23
26
  @injectable()
24
27
  export class DevWorkspaceConfigurationHelper {
25
- private generator: Generator = e2eContainer.get(EXTERNAL_CLASSES.Generator);
26
- private shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
27
-
28
+ @lazyInject(EXTERNAL_CLASSES.Generator)
29
+ private readonly generator!: Generator;
30
+ @lazyInject(CLASSES.ShellExecutor)
31
+ private readonly shellExecutor!: ShellExecutor;
28
32
  private readonly params: IContextParams;
29
33
 
30
34
  constructor(params: IContextParams) {
@@ -52,6 +56,7 @@ export class DevWorkspaceConfigurationHelper {
52
56
 
53
57
  async generateDevfileContext(): Promise<DevfileContext> {
54
58
  Logger.debug();
59
+
55
60
  if (!this.params.projects) {
56
61
  this.params.projects = [];
57
62
  }
@@ -67,6 +72,7 @@ export class DevWorkspaceConfigurationHelper {
67
72
  // write templates and then DevWorkspace in a single file
68
73
  getDevWorkspaceConfigurationYamlAsString(context: DevfileContext): string {
69
74
  Logger.debug();
75
+
70
76
  const allContentArray: any[] = context.devWorkspaceTemplates.map((template: V1alpha2DevWorkspaceTemplate): string =>
71
77
  YAML.stringify(template)
72
78
  );
@@ -74,4 +80,31 @@ export class DevWorkspaceConfigurationHelper {
74
80
 
75
81
  return allContentArray.join('---\n');
76
82
  }
83
+
84
+ getDevWorkspaceConfigurationsAsYaml(allContentString: string): string {
85
+ Logger.debug();
86
+ const content: any = {};
87
+ const contentArray: string[] = allContentString.split('---\n');
88
+ contentArray.forEach((e: any): void => {
89
+ e = YAML.parse(e);
90
+ e.kind === 'DevWorkspace'
91
+ ? (content.DevWorkspace = e)
92
+ : e.kind === 'DevWorkspaceTemplate'
93
+ ? (content.DevWorkspaceTemplate = e)
94
+ : Logger.error(
95
+ 'Problems with configuration parsing, string should be in format "DevWorkspace\\n---\\nDevWorkspaceTemplate"'
96
+ );
97
+ });
98
+
99
+ return content;
100
+ }
101
+ patchDevWorkspaceConfigWithBuildContainerAttribute(devfileContextDevWorkspace: any): void {
102
+ Logger.debug();
103
+ devfileContextDevWorkspace.spec.template.attributes = YAML.parse(`
104
+ controller.devfile.io/devworkspace-config:
105
+ name: devworkspace-config
106
+ namespace: openshift-devspaces
107
+ controller.devfile.io/scc: container-build
108
+ controller.devfile.io/storage-type: per-user`);
109
+ }
77
110
  }
@@ -12,13 +12,17 @@ import { Logger } from './Logger';
12
12
  import YAML from 'yaml';
13
13
  import { API_TEST_CONSTANTS, SUPPORTED_DEVFILE_REGISTRIES } from '../constants/API_TEST_CONSTANTS';
14
14
  import { injectable } from 'inversify';
15
+ import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
15
16
 
16
17
  @injectable()
17
18
  export class DevfilesRegistryHelper {
18
- async getInbuiltDevfilesRegistryContent(): Promise<AxiosResponse> {
19
+ async getInbuiltDevfilesRegistryContent(sampleNamePatterns?: string[]): Promise<any[]> {
19
20
  Logger.trace();
20
21
 
21
- return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL());
22
+ return this.filterSamples(
23
+ sampleNamePatterns,
24
+ await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL())
25
+ );
22
26
  }
23
27
 
24
28
  async getGitHubCheDevfileRegistryContent(): Promise<AxiosResponse> {
@@ -27,13 +31,13 @@ export class DevfilesRegistryHelper {
27
31
  return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL);
28
32
  }
29
33
 
30
- async collectPathsToDevfilesFromRegistry(): Promise<object[]> {
34
+ async collectPathsToDevfilesFromRegistry(isInbuilt: boolean = true, sampleNamePatterns?: string[]): Promise<object[]> {
31
35
  Logger.debug();
32
36
 
33
37
  const devfileSamples: object[] = [];
34
38
  const sampleNames: string[] = [];
35
- switch (API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) {
36
- case SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL:
39
+ switch (isInbuilt) {
40
+ case false:
37
41
  {
38
42
  const content: any[any] = await this.getGitHubCheDevfileRegistryContent();
39
43
  content.forEach((e: any): void => {
@@ -55,14 +59,17 @@ export class DevfilesRegistryHelper {
55
59
  Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
56
60
  }
57
61
  break;
58
- case SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL():
62
+ case true:
59
63
  {
60
- const content: any[any] = await this.getInbuiltDevfilesRegistryContent();
61
-
64
+ const content: any[any] = await this.getInbuiltDevfilesRegistryContent(sampleNamePatterns);
62
65
  for (const sample of content) {
66
+ const linkToDevWorkspaceYaml: any =
67
+ BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL +
68
+ '/devfile-registry' +
69
+ sample.links.devWorkspaces['che-incubator/che-code/latest'];
63
70
  devfileSamples.push({
64
71
  name: sample.displayName,
65
- link: sample.links.v2
72
+ devWorkspaceConfigurationString: await this.getContent(linkToDevWorkspaceYaml)
66
73
  });
67
74
  }
68
75
  Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
@@ -76,6 +83,18 @@ export class DevfilesRegistryHelper {
76
83
  return devfileSamples;
77
84
  }
78
85
 
86
+ async getEditorContent(entry: string): Promise<any> {
87
+ return await this.getContent(`${BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL}/${entry}`);
88
+ }
89
+
90
+ private filterSamples(sampleNamePatterns: string[] | undefined, content: any): Promise<any[]> {
91
+ if (sampleNamePatterns) {
92
+ const commonSampleNamePattern: RegExp = new RegExp(sampleNamePatterns.join('|'), 'i');
93
+ content = content.filter((e: any): boolean => commonSampleNamePattern.test(e.displayName));
94
+ }
95
+ return content;
96
+ }
97
+
79
98
  private async getContent(url: string, headers?: object): Promise<AxiosResponse> {
80
99
  Logger.trace(`${url}`);
81
100
 
@@ -20,7 +20,7 @@ export interface IKubernetesCommandLineToolsExecutor {
20
20
 
21
21
  applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString;
22
22
 
23
- executeCommand(commandToExecute: string, container: string): ShellString;
23
+ execInContainerCommand(commandToExecute: string, container: string): ShellString;
24
24
 
25
25
  applyYamlConfigurationAsStringOutput(yamlConfiguration: string): ShellString;
26
26
 
@@ -46,14 +46,14 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin
46
46
  }
47
47
 
48
48
  get namespace(): string | undefined {
49
- this._namespace =
50
- this._namespace !== undefined
51
- ? this._namespace
52
- : BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.includes('devspaces')
53
- ? OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME + '-devspaces'
54
- : BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.includes('che')
55
- ? OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME + '-che'
56
- : 'default';
49
+ if (!this._namespace) {
50
+ const applicationName: string = BASE_TEST_CONSTANTS.TESTING_APPLICATION_NAME();
51
+ if (applicationName === 'default') {
52
+ this._namespace = applicationName;
53
+ } else {
54
+ this._namespace = OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME + '-' + applicationName;
55
+ }
56
+ }
57
57
  return this._namespace;
58
58
  }
59
59
 
@@ -114,7 +114,7 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin
114
114
  return this.waitDevWorkspace();
115
115
  }
116
116
 
117
- executeCommand(commandToExecute: string, container: string = KubernetesCommandLineToolsExecutor.container): ShellString {
117
+ execInContainerCommand(commandToExecute: string, container: string = KubernetesCommandLineToolsExecutor.container): ShellString {
118
118
  Logger.debug(`${this.kubernetesCommandLineTool}`);
119
119
 
120
120
  return this.shellExecutor.executeCommand(
@@ -217,22 +217,22 @@ export class ContainerTerminal extends KubernetesCommandLineToolsExecutor {
217
217
  }
218
218
 
219
219
  ls(path: string = ''): ShellString {
220
- return this.shellExecutor.executeCommand('ls ' + path);
220
+ return this.execInContainerCommand('ls ' + path);
221
221
  }
222
222
 
223
223
  pwd(): ShellString {
224
- return this.shellExecutor.executeCommand('pwd');
224
+ return this.execInContainerCommand('pwd');
225
225
  }
226
226
 
227
227
  cd(path: string): ShellString {
228
- return this.shellExecutor.executeCommand('cd ' + path);
228
+ return this.execInContainerCommand('cd ' + path);
229
229
  }
230
230
 
231
231
  gitClone(repository: string): ShellString {
232
- return this.shellExecutor.executeCommand('git clone ' + repository);
232
+ return this.execInContainerCommand('git clone ' + repository);
233
233
  }
234
234
 
235
235
  removeFolder(path: string): ShellString {
236
- return this.shellExecutor.executeCommand('rm -rf ' + path);
236
+ return this.execInContainerCommand('rm -rf ' + path);
237
237
  }
238
238
  }
@@ -1,6 +0,0 @@
1
- {
2
- "reporterEnabled": "allure-mocha,dist/utils/CheReporter.js",
3
- "allureMochaReporterOptions": {
4
- "resultsDir": ".allure-results"
5
- }
6
- }