@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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { inject, injectable } from 'inversify';
|
|
12
12
|
import { DriverHelper } from '../../utils/DriverHelper';
|
|
13
13
|
import { CLASSES } from '../../configs/inversify.types';
|
|
14
14
|
import { By, WebElement } from 'selenium-webdriver';
|
|
@@ -16,200 +16,199 @@ import { Logger } from '../../utils/Logger';
|
|
|
16
16
|
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
17
17
|
|
|
18
18
|
export enum WorkspaceStatusUI {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Running = 'green',
|
|
20
|
+
Stopped = 'grey'
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@injectable()
|
|
24
24
|
export class Workspaces {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
private static readonly ADD_WORKSPACE_BUTTON_XPATH: string = `//button[text()='Add Workspace']`;
|
|
26
|
+
private static readonly WORKSPACE_ITEM_TABLE_NAME_SECTION_XPATH: string = `//td[@data-label="Name"]/span/a`;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
32
|
+
Logger.debug();
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
await this.driverHelper.waitVisibility(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
|
|
35
|
+
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
38
|
+
Logger.debug();
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
await this.driverHelper.waitAndClick(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
async clickOpenButton(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
44
|
+
Logger.debug();
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
await this.driverHelper.waitAndClick(this.getOpenButtonLocator(workspaceName), timeout);
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
50
|
+
Logger.debug(`"${workspaceName}"`);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
58
|
+
Logger.debug(`"${workspaceName}"`);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
const runningStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Running);
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
66
|
+
Logger.debug(`"${workspaceName}"`);
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
const stoppedStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Stopped);
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
|
|
71
|
+
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
74
|
+
Logger.debug(`"${workspaceName}"`);
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
async clickActionsButton(workspaceName: string): Promise<void> {
|
|
82
|
+
Logger.debug(`of the '${workspaceName}' list item`);
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
async waitActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
|
|
88
|
+
Logger.debug(`of the '${workspaceName}' list item`);
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
await this.driverHelper.waitVisibility(this.getExpandedActionsLocator(workspaceName), timeout);
|
|
91
|
+
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
async openActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
|
|
94
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
95
|
+
await this.clickActionsButton(workspaceName);
|
|
96
|
+
await this.waitActionsPopup(workspaceName, timeout);
|
|
97
|
+
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
async clickActionsDeleteButton(workspaceName: string): Promise<void> {
|
|
100
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Delete Workspace'));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async clickActionsStopWorkspaceButton(workspaceName: string): Promise<void> {
|
|
106
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
107
|
+
// todo: workaround because of issue CRW-3649
|
|
108
|
+
try {
|
|
109
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
110
|
+
} catch (e) {
|
|
111
|
+
Logger.warn(`for the '${workspaceName}' list item - popup was missed, try to click one more time (issue CRW-3649).`);
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// todo: workaround because of issue CRW-3649
|
|
108
|
-
try {
|
|
109
|
-
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
110
|
-
} catch (e) {
|
|
111
|
-
Logger.warn(`Workspaces.clickActionsStopWorkspaceButton for the '${workspaceName}' list item - popup was missed, try to click one more time (issue CRW-3649).`);
|
|
112
|
-
|
|
113
|
-
await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
|
|
114
|
-
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
115
|
-
}
|
|
113
|
+
await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
|
|
114
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
116
115
|
}
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
async waitDeleteWorkspaceConfirmationWindow(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
119
|
+
Logger.debug();
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
const confirmationWindowLocator: By = By.xpath(`//div[@aria-label='Delete workspaces confirmation window']`);
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
await this.driverHelper.waitVisibility(confirmationWindowLocator, timeout);
|
|
124
|
+
}
|
|
125
125
|
|
|
126
|
+
async clickToDeleteConfirmationCheckbox(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
127
|
+
Logger.debug(`Workspaces.clickToDeleteConfirmationCheckbox`);
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
Logger.debug(`Workspaces.clickToDeleteConfirmationCheckbox`);
|
|
129
|
+
const deleteConfirmationCheckboxLocator: By = By.xpath(`//input[@data-testid='confirmation-checkbox']`);
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
await this.driverHelper.waitAndClick(deleteConfirmationCheckboxLocator, timeout);
|
|
132
|
+
}
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
async waitAndClickEnabledConfirmationWindowDeleteButton(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
135
|
+
Logger.debug(`Workspaces.waitEnabledConfirmationWindowDeleteButton`);
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
Logger.debug(`Workspaces.waitEnabledConfirmationWindowDeleteButton`);
|
|
137
|
+
const enabledConfirmationWindowDeleteButton: By = By.xpath(`//button[@data-testid='delete-workspace-button' and not(@disabled)]`);
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
await this.driverHelper.waitAndClick(enabledConfirmationWindowDeleteButton, timeout);
|
|
140
|
+
}
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
async deleteWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
143
|
+
Logger.debug('Workspaces.deleteWorkspaceByActionsButton');
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
await this.waitWorkspaceListItem(workspaceName, timeout);
|
|
146
|
+
await this.openActionsPopup(workspaceName, timeout);
|
|
147
|
+
await this.clickActionsDeleteButton(workspaceName);
|
|
148
|
+
await this.waitDeleteWorkspaceConfirmationWindow(timeout);
|
|
149
|
+
await this.clickToDeleteConfirmationCheckbox(timeout);
|
|
150
|
+
await this.waitAndClickEnabledConfirmationWindowDeleteButton(timeout);
|
|
151
|
+
}
|
|
145
152
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
await this.clickActionsDeleteButton(workspaceName);
|
|
149
|
-
await this.waitDeleteWorkspaceConfirmationWindow(timeout);
|
|
150
|
-
await this.clickToDeleteConfirmationCheckbox(timeout);
|
|
151
|
-
await this.waitAndClickEnabledConfirmationWindowDeleteButton(timeout);
|
|
152
|
-
}
|
|
153
|
+
async stopWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
154
|
+
Logger.debug('Workspaces.stopWorkspaceByActionsButton');
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
await this.waitWorkspaceListItem(workspaceName, timeout);
|
|
157
|
+
await this.openActionsPopup(workspaceName, timeout);
|
|
158
|
+
await this.clickActionsStopWorkspaceButton(workspaceName);
|
|
159
|
+
}
|
|
156
160
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
await this.clickActionsStopWorkspaceButton(workspaceName);
|
|
160
|
-
}
|
|
161
|
+
async waitWorkspaceListItemAbsence(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
162
|
+
Logger.debug(`Workspaces.waitWorkspaceListItemAbsence "${workspaceName}"`);
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
165
|
+
const attempts: number = Math.ceil(timeout / polling);
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
const attempts: number = Math.ceil(timeout / polling);
|
|
167
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
await this.driverHelper.waitDisappearance(workspaceListItemLocator, attempts, polling);
|
|
170
|
+
}
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
async getAllCreatedWorkspacesNames(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string[]> {
|
|
173
|
+
Logger.debug('Workspaces.getAllCreatedWorkspacesNames');
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
} catch (e) {
|
|
185
|
-
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${e}`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${workspaceNames.length} workspaces have been created in DevSpaces`);
|
|
189
|
-
return workspaceNames;
|
|
175
|
+
const workspaceNames: string[] = [];
|
|
176
|
+
try {
|
|
177
|
+
const workspaceItems: WebElement[] = await this.driverHelper.waitAllPresence(By.xpath(Workspaces.WORKSPACE_ITEM_TABLE_NAME_SECTION_XPATH), timeout);
|
|
178
|
+
for (let item of workspaceItems) {
|
|
179
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - try to get ${workspaceItems.indexOf(item)} items name`);
|
|
180
|
+
workspaceNames.push(await item.getText());
|
|
181
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - workspace name is "${workspaceNames[workspaceNames.length - 1]}"`);
|
|
182
|
+
}
|
|
183
|
+
} catch (e) {
|
|
184
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${e}`);
|
|
190
185
|
}
|
|
191
186
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
187
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${workspaceNames.length} workspaces have been created in DevSpaces`);
|
|
188
|
+
return workspaceNames;
|
|
189
|
+
}
|
|
195
190
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
191
|
+
private getWorkspaceListItemLocator(workspaceName: string): string {
|
|
192
|
+
return `//tr[td/span/a[text()='${workspaceName}']]`;
|
|
193
|
+
}
|
|
199
194
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
private getWorkspaceStatusLocator(workspaceName: string, workspaceStatus: WorkspaceStatusUI): By {
|
|
196
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//span[@data-testid='workspace-status-indicator']//*[local-name()='svg' and @fill='${workspaceStatus}']`);
|
|
197
|
+
}
|
|
203
198
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
private getActionsLocator(workspaceName: string): By {
|
|
200
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}/td/div/button[@aria-label='Actions']`);
|
|
201
|
+
}
|
|
207
202
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
private getExpandedActionsLocator(workspaceName: string): By {
|
|
204
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//button[@aria-label='Actions' and @aria-expanded='true']`);
|
|
205
|
+
}
|
|
211
206
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
private getActionsPopupButtonLocator(workspaceName: string, buttonText: string): By {
|
|
208
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//li[@role='menuitem']//button[text()='${buttonText}']`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private getOpenButtonLocator(workspaceName: string): By {
|
|
212
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//td[@data-key=5]//a[text()='Open']`);
|
|
213
|
+
}
|
|
215
214
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
import { DriverHelper } from '../../../utils/DriverHelper';
|
|
11
|
-
import {
|
|
11
|
+
import { inject, injectable } from 'inversify';
|
|
12
12
|
import { CLASSES, TYPES } from '../../../configs/inversify.types';
|
|
13
13
|
import 'reflect-metadata';
|
|
14
14
|
import { By } from 'selenium-webdriver';
|
|
@@ -20,133 +20,132 @@ import { ProjectAndFileTests } from '../../../tests-library/ProjectAndFileTests'
|
|
|
20
20
|
|
|
21
21
|
@injectable()
|
|
22
22
|
export class WorkspaceDetails {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
private static readonly RUN_BUTTON_CSS: string = '#run-workspace-button[che-button-title=\'Run\']';
|
|
24
|
+
private static readonly OPEN_BUTTON_CSS: string = '#open-in-ide-button[che-button-title=\'Open\']';
|
|
25
|
+
private static readonly SAVE_BUTTON_CSS: string = 'button[name=\'save-button\']';
|
|
26
|
+
private static readonly ENABLED_SAVE_BUTTON_CSS: string = 'button[name=\'save-button\'][aria-disabled=\'false\']';
|
|
27
|
+
private static readonly WORKSPACE_DETAILS_LOADER_CSS: string = 'workspace-details-overview md-progress-linear';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
30
|
+
@inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil,
|
|
31
|
+
@inject(CLASSES.ProjectAndFileTests) private readonly testProjectAndFileCheCode: ProjectAndFileTests) { }
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
async waitLoaderDisappearance(attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
|
|
34
|
+
Logger.debug();
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.WORKSPACE_DETAILS_LOADER_CSS), attempts, polling);
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
async saveChanges(): Promise<void> {
|
|
40
|
+
Logger.debug();
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
await this.waitSaveButton();
|
|
43
|
+
await this.clickOnSaveButton();
|
|
44
|
+
await this.waitSaveButtonDisappearance();
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
async waitPage(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
48
|
+
Logger.debug(`workspace: "${workspaceName}"`);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
await this.waitWorkspaceTitle(workspaceName, timeout);
|
|
51
|
+
await this.waitOpenButton(timeout);
|
|
52
|
+
await this.waitRunButton(timeout);
|
|
53
|
+
await this.waitTabsPresence(timeout);
|
|
54
|
+
await this.waitLoaderDisappearance(timeout);
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
async waitWorkspaceTitle(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
58
|
+
Logger.debug(`title: "${workspaceName}"`);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
const workspaceTitleLocator: By = By.css(this.getWorkspaceTitleCssLocator(workspaceName));
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
await this.driverHelper.waitVisibility(workspaceTitleLocator, timeout);
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
async waitRunButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
66
|
+
Logger.debug();
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout);
|
|
69
|
+
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
async clickOnRunButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
72
|
+
Logger.debug();
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout);
|
|
75
|
+
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
async waitOpenButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
78
|
+
Logger.debug();
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout);
|
|
81
|
+
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
async openWorkspace(namespace: string, workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
84
|
+
Logger.debug(`"${namespace}/${workspaceName}"`);
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
await this.clickOnOpenButton(timeout);
|
|
87
|
+
await this.testProjectAndFileCheCode.waitWorkspaceReadinessForCheCodeEditor();
|
|
88
|
+
await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.STARTING);
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
async waitTabsPresence(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
92
|
+
Logger.debug('WorkspaceDetails.waitTabsPresence');
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const workspaceDetailsTabs: Array<string> = ['Overview', 'Projects', 'Containers', 'Servers',
|
|
95
|
+
'Env Variables', 'Volumes', 'Config', 'SSH', 'Plugins', 'Editors'];
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
for (const tabTitle of workspaceDetailsTabs) {
|
|
98
|
+
const workspaceDetailsTabLocator: By = By.xpath(this.getTabXpathLocator(tabTitle));
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
}
|
|
100
|
+
await this.driverHelper.waitVisibility(workspaceDetailsTabLocator, timeout);
|
|
102
101
|
}
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
async selectTab(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
105
|
+
Logger.debug(`WorkspaceDetails.selectTab ${tabTitle}`);
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
await this.clickOnTab(tabTitle, timeout);
|
|
108
|
+
await this.waitTabSelected(tabTitle, timeout);
|
|
109
|
+
}
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
private getWorkspaceTitleCssLocator(workspaceName: string): string {
|
|
112
|
+
return `che-row-toolbar[che-title='${workspaceName}']`;
|
|
113
|
+
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
private getTabXpathLocator(tabTitle: string): string {
|
|
116
|
+
return `//md-tabs-canvas//md-tab-item//span[text()='${tabTitle}']`;
|
|
117
|
+
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
private getSelectedTabXpathLocator(tabTitle: string): string {
|
|
120
|
+
return `//md-tabs-canvas[@role='tablist']//md-tab-item[@aria-selected='true']//span[text()='${tabTitle}']`;
|
|
121
|
+
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
private async waitSaveButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
124
|
+
await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
|
|
125
|
+
}
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
private async waitSaveButtonDisappearance(attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
|
|
128
|
+
await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.SAVE_BUTTON_CSS), attempts, polling);
|
|
129
|
+
}
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
private async clickOnSaveButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
132
|
+
await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
|
|
133
|
+
}
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
private async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
140
|
-
const workspaceDetailsTabLocator: By = By.xpath(this.getTabXpathLocator(tabTitle));
|
|
135
|
+
private async clickOnOpenButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
136
|
+
await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout);
|
|
137
|
+
}
|
|
141
138
|
|
|
139
|
+
private async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
140
|
+
const workspaceDetailsTabLocator: By = By.xpath(this.getTabXpathLocator(tabTitle));
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
await this.driverHelper.waitAndClick(workspaceDetailsTabLocator, timeout);
|
|
143
|
+
}
|
|
145
144
|
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
private async waitTabSelected(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
146
|
+
const selectedTabLocator: By = By.xpath(this.getSelectedTabXpathLocator(tabTitle));
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
await this.driverHelper.waitVisibility(selectedTabLocator, timeout);
|
|
149
|
+
}
|
|
151
150
|
|
|
152
151
|
}
|