@eclipse-che/che-e2e 7.73.0 → 7.74.0-dev-41d1364
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/.eslintignore +10 -0
- package/.eslintrc.js +183 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +10 -0
- package/README.md +47 -47
- package/configs/inversify.config.ts +14 -10
- package/configs/inversify.types.ts +29 -29
- package/configs/mocharc.ts +21 -24
- package/constants/API_TEST_CONSTANTS.ts +67 -0
- package/constants/BASE_TEST_CONSTANTS.ts +80 -0
- package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
- package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
- package/constants/MONACO_CONSTANTS.ts +25 -0
- package/constants/OAUTH_CONSTANTS.ts +67 -0
- package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
- package/constants/REPORTER_CONSTANTS.ts +53 -0
- package/constants/TIMEOUT_CONSTANTS.ts +131 -0
- package/dist/configs/inversify.config.js +14 -8
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +2 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -16
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +13 -13
- package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +17 -16
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +14 -14
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
- package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +15 -14
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +8 -8
- package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
- package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +15 -15
- package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
- package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +13 -13
- package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
- package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
- package/dist/driver/ChromeDriver.js +12 -16
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +18 -18
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +27 -27
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +42 -42
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +44 -33
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +37 -35
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +10 -10
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +10 -10
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +6 -6
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +23 -23
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +11 -11
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +10 -10
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +9 -9
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +15 -15
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +27 -24
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +17 -13
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +31 -18
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +18 -12
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +12 -2
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -8
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -9
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +47 -43
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +17 -10
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +28 -26
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +41 -36
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +37 -35
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +18 -5
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +7 -7
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +9 -7
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +61 -78
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +29 -24
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +44 -44
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +19 -10
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +25 -19
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +126 -128
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +53 -46
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +62 -39
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +18 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +9 -0
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +17 -9
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +36 -34
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
- package/dist/utils/workspace/ApiUrlResolver.js +5 -5
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
- package/dist/utils/workspace/TestWorkspaceUtil.js +36 -30
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js +2 -2
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/ChromeDriver.ts +45 -51
- package/driver/IDriver.ts +3 -3
- package/index.ts +9 -9
- package/package.json +59 -49
- package/pageobjects/dashboard/CreateWorkspace.ts +65 -56
- package/pageobjects/dashboard/Dashboard.ts +101 -100
- package/pageobjects/dashboard/Workspaces.ts +197 -166
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +151 -127
- package/pageobjects/git-providers/OauthPage.ts +177 -166
- package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
- package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
- package/pageobjects/login/kubernetes/DexLoginPage.ts +32 -31
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +16 -15
- package/pageobjects/login/openshift/OcpLoginPage.ts +62 -55
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +30 -25
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +16 -19
- package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -44
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +39 -35
- package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
- package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
- package/pageobjects/openshift/OcpMainPage.ts +69 -68
- package/resources/pod-overrides-airgap.yaml +37 -0
- package/specs/MochaHooks.ts +59 -50
- package/specs/SmokeTest.spec.ts +43 -36
- package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +107 -94
- package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
- package/specs/api/PodOverridesAPI.spec.ts +42 -32
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -27
- package/specs/dashboard-samples/Quarkus.spec.ts +34 -30
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -170
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -55
- package/specs/factory/Factory.spec.ts +178 -166
- package/specs/factory/NoSetupRepoFactory.spec.ts +227 -210
- package/specs/factory/RefusedOAuthFactory.spec.ts +219 -203
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -50
- package/tests-library/LoginTests.ts +34 -32
- package/tests-library/ProjectAndFileTests.ts +21 -18
- package/tests-library/WorkspaceHandlingTests.ts +98 -108
- package/tsconfig.json +15 -15
- package/utils/BrowserTabsUtil.ts +104 -98
- package/utils/CheReporter.ts +142 -148
- package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
- package/utils/DevfilesRegistryHelper.ts +67 -58
- package/utils/DriverHelper.ts +726 -701
- package/utils/KubernetesCommandLineToolsExecutor.ts +196 -172
- package/utils/Logger.ts +104 -75
- package/utils/ScreenCatcher.ts +59 -48
- package/utils/ShellExecutor.ts +19 -11
- package/utils/StringUtil.ts +40 -32
- package/utils/request-handlers/CheApiRequestHandler.ts +92 -87
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
- package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
- package/utils/workspace/ApiUrlResolver.ts +31 -26
- package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
- package/utils/workspace/TestWorkspaceUtil.ts +153 -142
- package/utils/workspace/WorkspaceStatus.ts +5 -5
- package/constants/APITestConstants.ts +0 -56
- package/constants/BaseTestConstants.ts +0 -65
- package/constants/ChromeDriverConstants.ts +0 -46
- package/constants/FactoryTestConstants.ts +0 -51
- package/constants/MonacoConstants.ts +0 -22
- package/constants/OAuthConstants.ts +0 -57
- package/constants/PluginsTestConstants.ts +0 -15
- package/constants/ReporterConstants.ts +0 -45
- package/constants/TimeoutConstants.ts +0 -113
- package/dist/constants/APITestConstants.js.map +0 -1
- package/dist/constants/BaseTestConstants.js.map +0 -1
- package/dist/constants/ChromeDriverConstants.js.map +0 -1
- package/dist/constants/FactoryTestConstants.js.map +0 -1
- package/dist/constants/MonacoConstants.js.map +0 -1
- package/dist/constants/OAuthConstants.js.map +0 -1
- package/dist/constants/PluginsTestConstants.js.map +0 -1
- package/dist/constants/ReporterConstants.js.map +0 -1
- package/dist/constants/TimeoutConstants.js.map +0 -1
- package/tslint.json +0 -126
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -12,107 +12,108 @@ import 'reflect-metadata';
|
|
|
12
12
|
import { CLASSES } from '../../configs/inversify.types';
|
|
13
13
|
import { By } from 'selenium-webdriver';
|
|
14
14
|
import { DriverHelper } from '../../utils/DriverHelper';
|
|
15
|
-
import {
|
|
15
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
16
16
|
import { Workspaces } from './Workspaces';
|
|
17
17
|
import { Logger } from '../../utils/Logger';
|
|
18
|
-
import {
|
|
18
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
19
19
|
|
|
20
20
|
@injectable()
|
|
21
21
|
export class Dashboard {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
22
|
+
private static readonly WORKSPACES_BUTTON: By = By.xpath('//div[@id="page-sidebar"]//a[contains(text(), "Workspaces (")]');
|
|
23
|
+
private static readonly CREATE_WORKSPACE_BUTTON: By = By.xpath('//div[@id="page-sidebar"]//a[text()="Create Workspace"]');
|
|
24
|
+
private static readonly LOADER_PAGE_STEP_TITLES: By = By.xpath('//*[@data-testid="step-title"]');
|
|
25
|
+
private static readonly STARTING_PAGE_LOADER: By = By.css('.main-page-loader');
|
|
26
|
+
private static readonly LOADER_ALERT: By = By.xpath('//*[@data-testid="loader-alert"]');
|
|
27
|
+
private static readonly LOGOUT_BUTTON: By = By.xpath('//button[text()="Logout"]');
|
|
28
|
+
private static readonly USER_SETTINGS_DROPDOWN: By = By.xpath('//header//button/span[text()!=""]//parent::button');
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
@inject(CLASSES.DriverHelper)
|
|
32
|
+
private readonly driverHelper: DriverHelper,
|
|
33
|
+
@inject(CLASSES.Workspaces) private readonly workspaces: Workspaces
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
async stopWorkspaceByUI(workspaceName: string): Promise<void> {
|
|
37
|
+
Logger.debug(`"${workspaceName}"`);
|
|
38
|
+
|
|
39
|
+
await this.clickWorkspacesButton();
|
|
40
|
+
await this.workspaces.waitPage();
|
|
41
|
+
await this.workspaces.waitWorkspaceListItem(workspaceName);
|
|
42
|
+
await this.workspaces.waitWorkspaceWithRunningStatus(workspaceName);
|
|
43
|
+
|
|
44
|
+
await this.workspaces.stopWorkspaceByActionsButton(workspaceName);
|
|
45
|
+
await this.workspaces.waitWorkspaceWithStoppedStatus(workspaceName);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async deleteStoppedWorkspaceByUI(workspaceName: string): Promise<void> {
|
|
49
|
+
Logger.debug(`"${workspaceName}"`);
|
|
50
|
+
|
|
51
|
+
await this.clickWorkspacesButton();
|
|
52
|
+
await this.workspaces.waitPage();
|
|
53
|
+
await this.workspaces.waitWorkspaceListItem(workspaceName);
|
|
54
|
+
await this.workspaces.deleteWorkspaceByActionsButton(workspaceName);
|
|
55
|
+
await this.workspaces.waitPage();
|
|
56
|
+
await this.workspaces.waitWorkspaceListItemAbsence(workspaceName);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async stopAndRemoveWorkspaceByUI(workspaceName: string): Promise<void> {
|
|
60
|
+
Logger.debug(`"${workspaceName}"`);
|
|
61
|
+
|
|
62
|
+
await this.stopWorkspaceByUI(workspaceName);
|
|
63
|
+
await this.workspaces.deleteWorkspaceByActionsButton(workspaceName);
|
|
64
|
+
await this.workspaces.waitWorkspaceListItemAbsence(workspaceName);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async openDashboard(): Promise<void> {
|
|
68
|
+
Logger.debug();
|
|
69
|
+
await this.driverHelper.getDriver().navigate().to(BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL);
|
|
70
|
+
await this.waitPage();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async waitPage(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
74
|
+
Logger.debug();
|
|
75
|
+
|
|
76
|
+
await this.driverHelper.waitVisibility(Dashboard.WORKSPACES_BUTTON, timeout);
|
|
77
|
+
await this.driverHelper.waitVisibility(Dashboard.CREATE_WORKSPACE_BUTTON, timeout);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async clickWorkspacesButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
81
|
+
Logger.debug();
|
|
82
|
+
|
|
83
|
+
await this.driverHelper.waitAndClick(Dashboard.WORKSPACES_BUTTON, timeout);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async clickCreateWorkspaceButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
87
|
+
Logger.debug();
|
|
88
|
+
|
|
89
|
+
await this.driverHelper.waitAndClick(Dashboard.CREATE_WORKSPACE_BUTTON, timeout);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getLoaderAlert(timeout: number = TIMEOUT_CONSTANTS.TS_WAIT_LOADER_PRESENCE_TIMEOUT): Promise<string> {
|
|
93
|
+
Logger.debug();
|
|
94
|
+
|
|
95
|
+
return await this.driverHelper.waitAndGetText(Dashboard.LOADER_ALERT, timeout);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async waitLoader(timeout: number = TIMEOUT_CONSTANTS.TS_WAIT_LOADER_PRESENCE_TIMEOUT): Promise<void> {
|
|
99
|
+
Logger.debug();
|
|
100
|
+
|
|
101
|
+
await this.driverHelper.waitAllPresence(Dashboard.LOADER_PAGE_STEP_TITLES, timeout);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async waitStartingPageLoaderDisappearance(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
105
|
+
Logger.debug();
|
|
106
|
+
|
|
107
|
+
await this.driverHelper.waitDisappearance(Dashboard.STARTING_PAGE_LOADER, timeout);
|
|
108
|
+
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async logout(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
112
|
+
Logger.debug();
|
|
113
|
+
|
|
114
|
+
await this.openDashboard();
|
|
115
|
+
await this.driverHelper.waitAndClick(Dashboard.USER_SETTINGS_DROPDOWN, timeout);
|
|
116
|
+
await this.driverHelper.waitAndClick(Dashboard.LOGOUT_BUTTON, timeout);
|
|
117
|
+
await this.driverHelper.waitDisappearance(Dashboard.USER_SETTINGS_DROPDOWN, timeout);
|
|
118
|
+
}
|
|
118
119
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -8,208 +8,239 @@
|
|
|
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';
|
|
15
15
|
import { Logger } from '../../utils/Logger';
|
|
16
|
-
import {
|
|
16
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
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(
|
|
29
|
+
@inject(CLASSES.DriverHelper)
|
|
30
|
+
private readonly driverHelper: DriverHelper
|
|
31
|
+
) {}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
async waitPage(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
34
|
+
Logger.debug();
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
await this.driverHelper.waitVisibility(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
async clickAddWorkspaceButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
|
|
40
|
+
Logger.debug();
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
await this.driverHelper.waitAndClick(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
|
|
43
|
+
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
async clickOpenButton(workspaceName: string, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
46
|
+
Logger.debug();
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
await this.driverHelper.waitAndClick(this.getOpenButtonLocator(workspaceName), timeout);
|
|
49
|
+
}
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
async waitWorkspaceListItem(
|
|
52
|
+
workspaceName: string,
|
|
53
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT
|
|
54
|
+
): Promise<void> {
|
|
55
|
+
Logger.debug(`"${workspaceName}"`);
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
|
|
60
|
+
}
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
async waitWorkspaceWithRunningStatus(
|
|
63
|
+
workspaceName: string,
|
|
64
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT
|
|
65
|
+
): Promise<void> {
|
|
66
|
+
Logger.debug(`"${workspaceName}"`);
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
const runningStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Running);
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
|
|
71
|
+
}
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
async waitWorkspaceWithStoppedStatus(
|
|
74
|
+
workspaceName: string,
|
|
75
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT
|
|
76
|
+
): Promise<void> {
|
|
77
|
+
Logger.debug(`"${workspaceName}"`);
|
|
67
78
|
|
|
68
|
-
|
|
79
|
+
const stoppedStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Stopped);
|
|
69
80
|
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
|
|
82
|
+
}
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
async clickWorkspaceListItem(
|
|
85
|
+
workspaceName: string,
|
|
86
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT
|
|
87
|
+
): Promise<void> {
|
|
88
|
+
Logger.debug(`"${workspaceName}"`);
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
77
91
|
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
|
|
93
|
+
}
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
async clickActionsButton(workspaceName: string): Promise<void> {
|
|
96
|
+
Logger.debug(`of the '${workspaceName}' list item`);
|
|
83
97
|
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
|
|
99
|
+
}
|
|
86
100
|
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
async waitActionsPopup(workspaceName: string, timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
102
|
+
Logger.debug(`of the '${workspaceName}' list item`);
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
await this.driverHelper.waitVisibility(this.getExpandedActionsLocator(workspaceName), timeout);
|
|
105
|
+
}
|
|
92
106
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
async openActionsPopup(workspaceName: string, timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
108
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
109
|
+
await this.clickActionsButton(workspaceName);
|
|
110
|
+
await this.waitActionsPopup(workspaceName, timeout);
|
|
111
|
+
}
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
async clickActionsDeleteButton(workspaceName: string): Promise<void> {
|
|
114
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
101
115
|
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Delete Workspace'));
|
|
117
|
+
}
|
|
104
118
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
async clickActionsStopWorkspaceButton(workspaceName: string): Promise<void> {
|
|
120
|
+
Logger.debug(`for the '${workspaceName}' list item`);
|
|
121
|
+
// todo: workaround because of issue CRW-3649
|
|
122
|
+
try {
|
|
123
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
124
|
+
} catch (e) {
|
|
125
|
+
Logger.warn(`for the '${workspaceName}' list item - popup was missed, try to click one more time (issue CRW-3649).`);
|
|
112
126
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
|
|
128
|
+
await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
117
131
|
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
async waitDeleteWorkspaceConfirmationWindow(timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
133
|
+
Logger.debug();
|
|
120
134
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
135
|
+
const confirmationWindowLocator: By = By.xpath('//div[@aria-label="Delete workspaces confirmation window"]');
|
|
136
|
+
|
|
137
|
+
await this.driverHelper.waitVisibility(confirmationWindowLocator, timeout);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async clickToDeleteConfirmationCheckbox(timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
|
|
141
|
+
Logger.debug('Workspaces.clickToDeleteConfirmationCheckbox');
|
|
142
|
+
|
|
143
|
+
const deleteConfirmationCheckboxLocator: By = By.xpath('//input[@data-testid="confirmation-checkbox"]');
|
|
144
|
+
|
|
145
|
+
await this.driverHelper.waitAndClick(deleteConfirmationCheckboxLocator, timeout);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async waitAndClickEnabledConfirmationWindowDeleteButton(
|
|
149
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT
|
|
150
|
+
): Promise<void> {
|
|
151
|
+
Logger.debug('Workspaces.waitEnabledConfirmationWindowDeleteButton');
|
|
152
|
+
|
|
153
|
+
const enabledConfirmationWindowDeleteButton: By = By.xpath('//button[@data-testid="delete-workspace-button" and not(@disabled)]');
|
|
154
|
+
|
|
155
|
+
await this.driverHelper.waitAndClick(enabledConfirmationWindowDeleteButton, timeout);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async deleteWorkspaceByActionsButton(
|
|
159
|
+
workspaceName: string,
|
|
160
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT
|
|
161
|
+
): Promise<void> {
|
|
162
|
+
Logger.debug('Workspaces.deleteWorkspaceByActionsButton');
|
|
163
|
+
|
|
164
|
+
await this.waitWorkspaceListItem(workspaceName, timeout);
|
|
165
|
+
await this.openActionsPopup(workspaceName, timeout);
|
|
166
|
+
await this.clickActionsDeleteButton(workspaceName);
|
|
167
|
+
await this.waitDeleteWorkspaceConfirmationWindow(timeout);
|
|
168
|
+
await this.clickToDeleteConfirmationCheckbox(timeout);
|
|
169
|
+
await this.waitAndClickEnabledConfirmationWindowDeleteButton(timeout);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async stopWorkspaceByActionsButton(
|
|
173
|
+
workspaceName: string,
|
|
174
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT
|
|
175
|
+
): Promise<void> {
|
|
176
|
+
Logger.debug('Workspaces.stopWorkspaceByActionsButton');
|
|
177
|
+
|
|
178
|
+
await this.waitWorkspaceListItem(workspaceName, timeout);
|
|
179
|
+
await this.openActionsPopup(workspaceName, timeout);
|
|
180
|
+
await this.clickActionsStopWorkspaceButton(workspaceName);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async waitWorkspaceListItemAbsence(
|
|
184
|
+
workspaceName: string,
|
|
185
|
+
timeout: number = TIMEOUT_CONSTANTS.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT
|
|
186
|
+
): Promise<void> {
|
|
187
|
+
Logger.debug(`Workspaces.waitWorkspaceListItemAbsence "${workspaceName}"`);
|
|
188
|
+
|
|
189
|
+
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
190
|
+
const attempts: number = Math.ceil(timeout / polling);
|
|
191
|
+
|
|
192
|
+
const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
|
|
193
|
+
|
|
194
|
+
await this.driverHelper.waitDisappearance(workspaceListItemLocator, attempts, polling);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async getAllCreatedWorkspacesNames(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string[]> {
|
|
198
|
+
Logger.debug('Workspaces.getAllCreatedWorkspacesNames');
|
|
199
|
+
|
|
200
|
+
const workspaceNames: string[] = [];
|
|
201
|
+
try {
|
|
202
|
+
const workspaceItems: WebElement[] = await this.driverHelper.waitAllPresence(
|
|
203
|
+
By.xpath(Workspaces.WORKSPACE_ITEM_TABLE_NAME_SECTION_XPATH),
|
|
204
|
+
timeout
|
|
205
|
+
);
|
|
206
|
+
for (const item of workspaceItems) {
|
|
207
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - try to get ${workspaceItems.indexOf(item)} items name`);
|
|
208
|
+
workspaceNames.push(await item.getText());
|
|
209
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - workspace name is "${workspaceNames[workspaceNames.length - 1]}"`);
|
|
210
|
+
}
|
|
211
|
+
} catch (e) {
|
|
212
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${e}`);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
Logger.debug(`Workspaces.getAllCreatedWorkspacesNames - ${workspaceNames.length} workspaces have been created in DevSpaces`);
|
|
216
|
+
return workspaceNames;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private getWorkspaceListItemLocator(workspaceName: string): string {
|
|
220
|
+
return `//tr[td/span/a[text()='${workspaceName}']]`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private getWorkspaceStatusLocator(workspaceName: string, workspaceStatus: WorkspaceStatusUI): By {
|
|
224
|
+
return By.xpath(
|
|
225
|
+
`${this.getWorkspaceListItemLocator(
|
|
226
|
+
workspaceName
|
|
227
|
+
)}//span[@data-testid='workspace-status-indicator']//*[local-name()='svg' and @fill='${workspaceStatus}']`
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private getActionsLocator(workspaceName: string): By {
|
|
232
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}/td/div/button[@aria-label='Actions']`);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private getExpandedActionsLocator(workspaceName: string): By {
|
|
236
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//button[@aria-label='Actions' and @aria-expanded='true']`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private getActionsPopupButtonLocator(workspaceName: string, buttonText: string): By {
|
|
240
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//li[@role='menuitem']//button[text()='${buttonText}']`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private getOpenButtonLocator(workspaceName: string): By {
|
|
244
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//td[@data-key=5]//a[text()='Open']`);
|
|
245
|
+
}
|
|
215
246
|
}
|