@eclipse-che/che-e2e 7.73.0-dev-11985ec → 7.73.0-dev-62c0c9d
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.
- package/configs/inversify.config.ts +6 -6
- package/configs/inversify.types.ts +27 -27
- package/configs/mocharc.ts +21 -21
- package/constants/APITestConstants.ts +39 -38
- package/constants/BaseTestConstants.ts +44 -43
- package/constants/ChromeDriverConstants.ts +29 -29
- package/constants/FactoryTestConstants.ts +30 -30
- package/constants/MonacoConstants.ts +10 -10
- package/constants/OAuthConstants.ts +46 -46
- package/constants/PluginsTestConstants.ts +1 -1
- package/constants/ReporterConstants.ts +28 -28
- package/constants/TimeoutConstants.ts +101 -101
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +1 -1
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/APITestConstants.js +2 -2
- package/dist/constants/APITestConstants.js.map +1 -1
- package/dist/constants/BaseTestConstants.js +1 -1
- package/dist/constants/BaseTestConstants.js.map +1 -1
- package/dist/constants/ChromeDriverConstants.js +1 -1
- package/dist/constants/ChromeDriverConstants.js.map +1 -1
- package/dist/constants/FactoryTestConstants.js +2 -2
- package/dist/constants/FactoryTestConstants.js.map +1 -1
- package/dist/constants/MonacoConstants.js +1 -1
- package/dist/constants/MonacoConstants.js.map +1 -1
- package/dist/constants/OAuthConstants.js +1 -1
- package/dist/constants/OAuthConstants.js.map +1 -1
- package/dist/constants/PluginsTestConstants.js +1 -1
- package/dist/constants/ReporterConstants.js +1 -1
- package/dist/constants/ReporterConstants.js.map +1 -1
- package/dist/constants/TimeoutConstants.js.map +1 -1
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +8 -8
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +11 -11
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +14 -14
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +8 -8
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +21 -21
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +5 -5
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +10 -10
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +2 -2
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +6 -6
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +2 -2
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +2 -2
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +5 -5
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +11 -11
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +1 -1
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +7 -3
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +7 -5
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +9 -5
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +7 -3
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/{RecomendedExtentions.spec.js → RecommendedExtensions.spec.js} +7 -3
- package/dist/specs/dashboard-samples/{RecomendedExtentions.spec.js.map → RecommendedExtensions.spec.js.map} +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +3 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +3 -1
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +4 -2
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +4 -2
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +6 -2
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +3 -3
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +54 -74
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +10 -10
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +2 -2
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +7 -7
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +81 -81
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +38 -35
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +19 -10
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +2 -2
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +13 -11
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js +3 -3
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +20 -16
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/ChromeDriver.ts +44 -44
- package/driver/IDriver.ts +1 -1
- package/package.json +1 -1
- package/pageobjects/dashboard/CreateWorkspace.ts +52 -52
- package/pageobjects/dashboard/Dashboard.ts +72 -72
- package/pageobjects/dashboard/Workspaces.ts +138 -139
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +92 -93
- package/pageobjects/git-providers/OauthPage.ts +136 -136
- package/pageobjects/ide/CheCodeLocatorLoader.ts +40 -40
- package/pageobjects/login/interfaces/ICheLoginPage.ts +1 -1
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +1 -1
- package/pageobjects/login/kubernetes/DexLoginPage.ts +27 -27
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +11 -11
- package/pageobjects/login/openshift/OcpLoginPage.ts +50 -50
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +21 -21
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +14 -14
- package/pageobjects/login/openshift/RedHatLoginPage.ts +44 -41
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +23 -23
- package/pageobjects/openshift/OcpApplicationPage.ts +16 -16
- package/pageobjects/openshift/OcpImportFromGitPage.ts +54 -54
- package/pageobjects/openshift/OcpMainPage.ts +64 -64
- package/specs/MochaHooks.ts +44 -44
- package/specs/SmokeTest.spec.ts +35 -31
- package/specs/api/ContainerOverridesAPI.spec.ts +23 -23
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +93 -91
- package/specs/api/EmptyWorkspaceAPI.spec.ts +50 -50
- package/specs/api/PodOverridesAPI.spec.ts +29 -29
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +29 -25
- package/specs/dashboard-samples/Quarkus.spec.ts +31 -27
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +205 -0
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -64
- package/specs/factory/Factory.spec.ts +149 -147
- package/specs/factory/NoSetupRepoFactory.spec.ts +188 -186
- package/specs/factory/RefusedOAuthFactory.spec.ts +182 -180
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +52 -48
- package/tests-library/LoginTests.ts +29 -29
- package/tests-library/ProjectAndFileTests.ts +13 -13
- package/tests-library/WorkspaceHandlingTests.ts +84 -103
- package/utils/BrowserTabsUtil.ts +69 -69
- package/utils/CheReporter.ts +4 -6
- package/utils/DevWorkspaceConfigurationHelper.ts +58 -58
- package/utils/DevfilesRegistryHelper.ts +51 -51
- package/utils/DriverHelper.ts +599 -600
- package/utils/KubernetesCommandLineToolsExecutor.ts +166 -158
- package/utils/Logger.ts +98 -67
- package/utils/ScreenCatcher.ts +42 -42
- package/utils/ShellExecutor.ts +10 -10
- package/utils/StringUtil.ts +29 -30
- package/utils/request-handlers/CheApiRequestHandler.ts +84 -82
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +18 -18
- package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +1 -1
- package/utils/workspace/ApiUrlResolver.ts +23 -23
- package/utils/workspace/ITestWorkspaceUtil.ts +29 -29
- package/utils/workspace/TestWorkspaceUtil.ts +120 -116
- package/utils/workspace/WorkspaceStatus.ts +3 -3
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +0 -201
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
import 'reflect-metadata';
|
|
12
|
-
import {
|
|
12
|
+
import { inject, injectable } from 'inversify';
|
|
13
13
|
import { DriverHelper } from '../DriverHelper';
|
|
14
14
|
import { WorkspaceStatus } from './WorkspaceStatus';
|
|
15
15
|
import { error } from 'selenium-webdriver';
|
|
@@ -23,142 +23,146 @@ import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
|
23
23
|
|
|
24
24
|
@injectable()
|
|
25
25
|
export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
readonly polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
27
|
+
readonly attempts: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT / this.polling;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
constructor(
|
|
30
|
+
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
31
|
+
@inject(CLASSES.CheApiRequestHandler) private readonly processRequestHandler: CheApiRequestHandler,
|
|
32
|
+
@inject(CLASSES.ApiUrlResolver) private readonly apiUrlResolver: ApiUrlResolver
|
|
33
|
+
) { }
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
async waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus): Promise<void> {
|
|
36
|
+
Logger.debug();
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
let workspaceStatus: string = '';
|
|
39
|
+
let expectedStatus: boolean = false;
|
|
40
|
+
for (let i: number = 0; i < this.attempts; i++) {
|
|
41
|
+
const response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName));
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (response.status !== 200) {
|
|
44
|
+
throw new Error(`Can not get status of a workspace. Code: ${response.status} Data: ${response.data}`);
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
workspaceStatus = await response.data.status.phase;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
if (workspaceStatus === expectedWorkspaceStatus) {
|
|
50
|
+
expectedStatus = true;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (!expectedStatus) {
|
|
58
|
-
let waitTime: number = this.attempts * this.polling;
|
|
59
|
-
throw new error.TimeoutError(`The workspace was not stopped in ${waitTime} ms. Current status is: ${workspaceStatus}`);
|
|
60
|
-
}
|
|
54
|
+
await this.driverHelper.wait(this.polling);
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
if (!expectedStatus) {
|
|
58
|
+
let waitTime: number = this.attempts * this.polling;
|
|
59
|
+
throw new error.TimeoutError(`The workspace was not stopped in ${waitTime} ms. Current status is: ${workspaceStatus}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async stopWorkspaceByName(workspaceName: string): Promise<void> {
|
|
64
|
+
Logger.debug(`${workspaceName}`);
|
|
65
|
+
|
|
66
|
+
const stopWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
67
|
+
let stopWorkspaceResponse: AxiosResponse;
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
stopWorkspaceResponse = await this.processRequestHandler.patch(stopWorkspaceApiUrl, [{
|
|
71
|
+
'op': 'replace',
|
|
72
|
+
'path': '/spec/started',
|
|
73
|
+
'value': false
|
|
74
|
+
}]);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
Logger.error(`stop workspace call failed. URL used: ${stopWorkspaceApiUrl}`);
|
|
77
|
+
throw err;
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Logger.debug(`TestWorkspaceUtil.deleteWorkspaceByName: ${workspaceName}` );
|
|
87
|
-
|
|
88
|
-
const deleteWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
89
|
-
let deleteWorkspaceResponse: AxiosResponse;
|
|
90
|
-
let deleteWorkspaceStatus: boolean = false;
|
|
91
|
-
try {
|
|
92
|
-
deleteWorkspaceResponse = await this.processRequestHandler.delete(deleteWorkspaceApiUrl);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
|
95
|
-
Logger.error(`The workspace :${workspaceName} not found`);
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
Logger.error(`Delete workspace call failed. URL used: ${deleteWorkspaceStatus}`);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (deleteWorkspaceResponse.status !== 204) {
|
|
103
|
-
throw new Error(`Can not delete workspace. Code: ${deleteWorkspaceResponse.status} Data: ${deleteWorkspaceResponse.data}`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (let i: number = 0; i < this.attempts; i++) {
|
|
107
|
-
try {
|
|
108
|
-
deleteWorkspaceResponse = await this.processRequestHandler.get(deleteWorkspaceApiUrl);
|
|
109
|
-
} catch (error) {
|
|
110
|
-
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
|
111
|
-
deleteWorkspaceStatus = true;
|
|
112
|
-
Logger.debug(`TestWorkspaceUtil.stopWorkspaceByName: ${workspaceName} deleted successfully`);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (!deleteWorkspaceStatus) {
|
|
119
|
-
let waitTime: number = this.attempts * this.polling;
|
|
120
|
-
throw new error.TimeoutError(`The workspace was not deleted in ${waitTime} ms.`);
|
|
121
|
-
}
|
|
80
|
+
if (stopWorkspaceResponse.status !== 200) {
|
|
81
|
+
throw new Error(`Cannot stop workspace. Code: ${stopWorkspaceResponse.status} Data: ${stopWorkspaceResponse.data}`);
|
|
122
82
|
}
|
|
123
83
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
84
|
+
await this.waitWorkspaceStatus(workspaceName, WorkspaceStatus.STOPPED);
|
|
85
|
+
Logger.debug(`${workspaceName} stopped successfully`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// delete a workspace without stopping phase (similar with force deleting)
|
|
89
|
+
async deleteWorkspaceByName(workspaceName: string): Promise<void> {
|
|
90
|
+
Logger.debug(`${workspaceName}`);
|
|
91
|
+
|
|
92
|
+
const deleteWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
93
|
+
let deleteWorkspaceResponse: AxiosResponse;
|
|
94
|
+
let deleteWorkspaceStatus: boolean = false;
|
|
95
|
+
try {
|
|
96
|
+
deleteWorkspaceResponse = await this.processRequestHandler.delete(deleteWorkspaceApiUrl);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
|
99
|
+
Logger.error(`the workspace :${workspaceName} not found`);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
Logger.error(`delete workspace call failed. URL used: ${deleteWorkspaceStatus}`);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
127
105
|
|
|
128
|
-
|
|
129
|
-
|
|
106
|
+
if (deleteWorkspaceResponse.status !== 204) {
|
|
107
|
+
throw new Error(`Can not delete workspace. Code: ${deleteWorkspaceResponse.status} Data: ${deleteWorkspaceResponse.data}`);
|
|
130
108
|
}
|
|
131
109
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
110
|
+
for (let i: number = 0; i < this.attempts; i++) {
|
|
111
|
+
try {
|
|
112
|
+
deleteWorkspaceResponse = await this.processRequestHandler.get(deleteWorkspaceApiUrl);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
|
115
|
+
deleteWorkspaceStatus = true;
|
|
116
|
+
Logger.debug(`${workspaceName} deleted successfully`);
|
|
117
|
+
break;
|
|
139
118
|
}
|
|
119
|
+
}
|
|
140
120
|
}
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
122
|
+
if (!deleteWorkspaceStatus) {
|
|
123
|
+
let waitTime: number = this.attempts * this.polling;
|
|
124
|
+
throw new error.TimeoutError(`The workspace was not deleted in ${waitTime} ms.`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// stop workspace before deleting with checking stopping phase
|
|
129
|
+
async stopAndDeleteWorkspaceByName(workspaceName: string): Promise<void> {
|
|
130
|
+
Logger.debug();
|
|
131
|
+
|
|
132
|
+
await this.stopWorkspaceByName(workspaceName);
|
|
133
|
+
await this.deleteWorkspaceByName(workspaceName);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// stop all run workspaces in the namespace
|
|
137
|
+
async stopAllRunningWorkspaces(namespace: string): Promise<void> {
|
|
138
|
+
Logger.debug();
|
|
139
|
+
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
140
|
+
for (let i: number = 0; i < response.data.items.length; i++) {
|
|
141
|
+
Logger.info('the project is being stopped: ' + response.data.items[i].metadata.name);
|
|
142
|
+
await this.stopWorkspaceByName(response.data.items[i].metadata.name);
|
|
151
143
|
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// stop all run workspaces, check statuses and remove the workspaces
|
|
147
|
+
async stopAndDeleteAllRunningWorkspaces(namespace: string): Promise<void> {
|
|
148
|
+
Logger.debug();
|
|
149
|
+
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
150
|
+
await this.stopAllRunningWorkspaces(namespace);
|
|
151
|
+
for (let i: number = 0; i < response.data.items.length; i++) {
|
|
152
|
+
Logger.info('the project is being deleted: ' + response.data.items[i].metadata.name);
|
|
153
|
+
await this.deleteWorkspaceByName(response.data.items[i].metadata.name);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
152
156
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
// stop all run workspaces without stopping and waiting for of 'Stopped' phase
|
|
158
|
+
// similar with 'force' deleting
|
|
159
|
+
async deleteAllWorkspaces(namespace: string): Promise<void> {
|
|
160
|
+
Logger.debug();
|
|
161
|
+
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
158
162
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
+
for (let i: number = 0; i < response.data.items.length; i++) {
|
|
164
|
+
Logger.info('the project is being deleted .......: ' + response.data.items[i].metadata.name);
|
|
165
|
+
await this.deleteWorkspaceByName(response.data.items[i].metadata.name);
|
|
163
166
|
}
|
|
167
|
+
}
|
|
164
168
|
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
|
|
11
|
-
import {
|
|
12
|
-
ActivityBar,
|
|
13
|
-
ContextMenu,
|
|
14
|
-
ContextMenuItem,
|
|
15
|
-
EditorView,
|
|
16
|
-
ExtensionsViewItem,
|
|
17
|
-
ExtensionsViewSection,
|
|
18
|
-
Locators,
|
|
19
|
-
ModalDialog,
|
|
20
|
-
SideBarView,
|
|
21
|
-
TextEditor,
|
|
22
|
-
ViewItem,
|
|
23
|
-
ViewSection
|
|
24
|
-
} from 'monaco-page-objects';
|
|
25
|
-
import { registerRunningWorkspace } from '../MochaHooks';
|
|
26
|
-
import { LoginTests } from '../../tests-library/LoginTests';
|
|
27
|
-
import { e2eContainer } from '../../configs/inversify.config';
|
|
28
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
29
|
-
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
30
|
-
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
31
|
-
import { Logger } from '../../utils/Logger';
|
|
32
|
-
import { DriverHelper } from '../../utils/DriverHelper';
|
|
33
|
-
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
34
|
-
import { expect } from 'chai';
|
|
35
|
-
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
36
|
-
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
37
|
-
import { PluginsTestConstants } from '../../constants/PluginsTestConstants';
|
|
38
|
-
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
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
|
-
const samples: string[] = PluginsTestConstants.TS_SAMPLE_LIST.split(',');
|
|
47
|
-
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
48
|
-
|
|
49
|
-
suite(`Check if recommended extensions installed for ${samples}`, async function (): Promise<void> {
|
|
50
|
-
let projectSection: ViewSection;
|
|
51
|
-
let extensionsView: SideBarView | undefined;
|
|
52
|
-
let extensionSection: ExtensionsViewSection;
|
|
53
|
-
|
|
54
|
-
const extensionsListFileName: string = 'extensions.json';
|
|
55
|
-
let recommendedExtensions: any = {
|
|
56
|
-
recommendations: []
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
loginTests.loginIntoChe();
|
|
60
|
-
|
|
61
|
-
for (const sample of samples) {
|
|
62
|
-
workspaceHandlingTests.createAndOpenWorkspace(sample);
|
|
63
|
-
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
64
|
-
|
|
65
|
-
test('Registering the running workspace', async function (): Promise<void> {
|
|
66
|
-
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('Wait workspace readiness', async function (): Promise<void> {
|
|
70
|
-
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test('Wait until the project will be imported and accept it as trusted one', async function (): Promise<void> {
|
|
74
|
-
[projectSection] = await new SideBarView().getContent().getSections();
|
|
75
|
-
const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
76
|
-
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
77
|
-
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
78
|
-
expect(isFileImported).not.eqls(undefined);
|
|
79
|
-
try {
|
|
80
|
-
const buttonYesITrustTheAuthors: string = `Yes, I trust the authors`;
|
|
81
|
-
await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.button, TimeoutConstants.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
|
|
82
|
-
const trustedProjectDialog: ModalDialog = new ModalDialog();
|
|
83
|
-
Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
|
|
84
|
-
await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
|
|
85
|
-
} catch (e) {
|
|
86
|
-
Logger.debug(`Welcome modal dialog was not shown: ${e}`);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test(`Get recommended extensions list from ${extensionsListFileName}`, async function (): Promise<void> {
|
|
91
|
-
Logger.debug(`projectSection.findItem(item))?.select(): expand .vscode folder and open extensions.json.`);
|
|
92
|
-
await (await projectSection.findItem('.vscode'))?.select();
|
|
93
|
-
// time to expand project tree
|
|
94
|
-
await driverHelper.wait(TimeoutConstants.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT);
|
|
95
|
-
await (await projectSection.findItem(extensionsListFileName))?.select();
|
|
96
|
-
Logger.debug(`EditorView().openEditor(${extensionsListFileName})`);
|
|
97
|
-
const editor: TextEditor = await new EditorView().openEditor(extensionsListFileName) as TextEditor;
|
|
98
|
-
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
|
|
99
|
-
Logger.debug(`editor.getText(): get recommended extensions as text from editor, delete comments and parse to object.`);
|
|
100
|
-
recommendedExtensions = JSON.parse((await editor.getText()).replace(/\/\*[\s\S]*?\*\/|(?<=[^:])\/\/.*|^\/\/.*/g, '').trim());
|
|
101
|
-
Logger.debug(`recommendedExtensions.recommendations: Get recommendations clear names using map().`);
|
|
102
|
-
recommendedExtensions.recommendations = recommendedExtensions.recommendations.map((r: { split: (arg: string) => [any, any]; }) => {
|
|
103
|
-
const [publisher, name] = r.split('.');
|
|
104
|
-
return {publisher, name};
|
|
105
|
-
});
|
|
106
|
-
Logger.info(`Recommended extension for this workspace:\n${JSON.stringify(recommendedExtensions.recommendations)}.`);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test(`Open "Extensions" view section`, async function (): Promise<void> {
|
|
110
|
-
Logger.debug(`ActivityBar().getViewControl('Extensions'))?.openView(): open Extensions view.`);
|
|
111
|
-
extensionsView = await (await new ActivityBar().getViewControl('Extensions'))?.openView();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test(`Let extensions complete installation`, async function (): Promise<void> {
|
|
115
|
-
Logger.info(`Time for extensions installation TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT=${TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT}`);
|
|
116
|
-
await driverHelper.wait(TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test(`Check if extensions are installed and enabled`, async function (): Promise<void> {
|
|
120
|
-
this.retries(10);
|
|
121
|
-
Logger.debug(`ActivityBar().getViewControl('Extensions'))?.openView(): open Extensions view.`);
|
|
122
|
-
extensionsView = await (await new ActivityBar().getViewControl('Extensions'))?.openView();
|
|
123
|
-
|
|
124
|
-
Logger.debug(`extensionsView?.getContent().getSections(): get current section.`);
|
|
125
|
-
[extensionSection] = await extensionsView?.getContent().getSections() as ExtensionsViewSection[];
|
|
126
|
-
await driverHelper.waitAllPresence(webCheCodeLocators.ExtensionsViewSection.itemTitle, TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
|
|
127
|
-
|
|
128
|
-
for (const extension of recommendedExtensions.recommendations) {
|
|
129
|
-
Logger.info(`Check if ${JSON.stringify(extension)} are installed.`);
|
|
130
|
-
|
|
131
|
-
Logger.debug(`extensionSection.findItem(${extension.name}).`);
|
|
132
|
-
await extensionSection.findItem(extension.name);
|
|
133
|
-
|
|
134
|
-
// check if extension require reload the page
|
|
135
|
-
if (await driverHelper.isVisible((webCheCodeLocators.ExtensionsViewSection as any).requireReloadButton)) {
|
|
136
|
-
Logger.debug(`Extension require reload the editor. Refreshing the page..`);
|
|
137
|
-
await browserTabsUtil.refreshPage();
|
|
138
|
-
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
139
|
-
Logger.debug(`ActivityBar().getViewControl('Extensions'))?.openView(): open Extensions view.`);
|
|
140
|
-
extensionsView = await (await new ActivityBar().getViewControl('Extensions'))?.openView();
|
|
141
|
-
Logger.debug(`extensionsView?.getContent().getSections(): get current section.`);
|
|
142
|
-
[extensionSection] = await extensionsView?.getContent().getSections() as ExtensionsViewSection[];
|
|
143
|
-
await driverHelper.waitAllPresence(webCheCodeLocators.ExtensionsViewSection.itemTitle, TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
|
|
144
|
-
Logger.debug(`extensionSection.findItem(${extension.name}).`);
|
|
145
|
-
await extensionSection.findItem(extension.name);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
Logger.debug(`extensionsView?.getContent().getSections(): switch to marketplace section.`);
|
|
149
|
-
const [marketplaceSection]: ExtensionsViewSection[] = await extensionsView?.getContent().getSections() as ExtensionsViewSection[];
|
|
150
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ExtensionsViewSection.items, TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
|
|
151
|
-
|
|
152
|
-
Logger.debug(`marketplaceSection.getVisibleItems(): get all found items.`);
|
|
153
|
-
const allFinedItems: ExtensionsViewItem[] = await marketplaceSection.getVisibleItems();
|
|
154
|
-
|
|
155
|
-
let itemWithRightNameAndPublisher: ExtensionsViewItem | undefined;
|
|
156
|
-
for (const item of allFinedItems) {
|
|
157
|
-
Logger.debug(`Try to find extension published by ${extension.publisher}.`);
|
|
158
|
-
if (await item.getAuthor() === extension.publisher) {
|
|
159
|
-
itemWithRightNameAndPublisher = item;
|
|
160
|
-
Logger.debug(`Extension was found: ${await itemWithRightNameAndPublisher?.getTitle()}`);
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
if (itemWithRightNameAndPublisher === undefined) {
|
|
164
|
-
Logger.error(`Extension with publisher as ${extension.publisher} was not found.`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
Logger.debug(`itemWithRightNameAndPublisher?.isInstalled()`);
|
|
169
|
-
const isInstalled: boolean = await itemWithRightNameAndPublisher?.isInstalled() as boolean;
|
|
170
|
-
|
|
171
|
-
Logger.debug(`itemWithRightNameAndPublisher?.isInstalled(): ${isInstalled}.`);
|
|
172
|
-
expect(isInstalled).eqls(true);
|
|
173
|
-
|
|
174
|
-
Logger.debug(`itemWithRightNameAndPublisher.manage(): get context menu.`);
|
|
175
|
-
const extensionManageMenu: ContextMenu = await (itemWithRightNameAndPublisher as ExtensionsViewItem).manage();
|
|
176
|
-
|
|
177
|
-
Logger.debug(`extensionManageMenu.getItems(): get menu items.`);
|
|
178
|
-
const extensionMenuItems: ContextMenuItem[] = await extensionManageMenu.getItems();
|
|
179
|
-
let extensionMenuItemLabels: string = '';
|
|
180
|
-
for (const item of extensionMenuItems) {
|
|
181
|
-
Logger.trace(`extensionMenuItems -> item.getLabel(): get menu items names.`);
|
|
182
|
-
extensionMenuItemLabels += (await item.getLabel()) + ' ';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
Logger.debug(`extensionMenuItemLabels: ${extensionMenuItemLabels}.`);
|
|
186
|
-
expect(extensionMenuItemLabels).contains('Disable').and.not.contains('Enable');
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test('Stop the workspace', async function (): Promise<void> {
|
|
191
|
-
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
192
|
-
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test('Delete the workspace', async function (): Promise<void> {
|
|
196
|
-
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
loginTests.logoutFromChe();
|
|
201
|
-
});
|