@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
|
|
@@ -18,70 +18,72 @@ import { e2eContainer } from '../../configs/inversify.config';
|
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class OcpImportFromGitPage {
|
|
21
|
-
|
|
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
|
-
|
|
21
|
+
private static readonly GIT_URL_INPUT_LOCATOR: By = By.id('form-input-git-url-field');
|
|
22
|
+
private static readonly SHOW_ADVANCED_GIT_OPTIONS_LINK_LOCATOR: By = By.xpath(
|
|
23
|
+
'//*[text()="Show advanced Git options"]//ancestor::button'
|
|
24
|
+
);
|
|
25
|
+
private static readonly HIDE_ADVANCED_GIT_OPTIONS_LOCATOR: By = By.xpath('//*[text()="Hide advanced Git options"]');
|
|
26
|
+
private static readonly GIT_REFERENCE_INPUT_LOCATOR: By = By.id('form-input-git-ref-field');
|
|
27
|
+
private static readonly EDIT_IMPORT_STRATEGY_LINK_LOCATOR: By = By.xpath('//*[text()="Edit Import Strategy"]//ancestor::button');
|
|
28
|
+
private static readonly BUILDER_IMAGE_STRATEGY_ITEM_LOCATOR: By = By.xpath('//*[text()="Builder Image"]//parent::div//parent::div');
|
|
29
|
+
private static readonly ADD_LABEL_LINK_LOCATOR: By = By.xpath('//button[text()="Labels"]');
|
|
30
|
+
private static readonly ADD_LABEL_INPUT_LOCATOR: By = By.id('form-selector-labels-field');
|
|
31
|
+
private static readonly SUBMIT_BUTTON_LOCATOR: By = By.xpath('//*[@data-test-id="submit-button"]');
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
@inject(CLASSES.DriverHelper)
|
|
35
|
+
private readonly driverHelper: DriverHelper
|
|
36
|
+
) {}
|
|
37
|
+
|
|
38
|
+
async enterGitRepoUrl(gitRepoUrl: string): Promise<void> {
|
|
39
|
+
Logger.debug();
|
|
40
|
+
|
|
41
|
+
await this.driverHelper.enterValue(OcpImportFromGitPage.GIT_URL_INPUT_LOCATOR, gitRepoUrl);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async clickOnAdvancedOptionsButton(): Promise<void> {
|
|
45
|
+
Logger.debug();
|
|
46
|
+
|
|
47
|
+
if (!(await this.driverHelper.isVisible(OcpImportFromGitPage.HIDE_ADVANCED_GIT_OPTIONS_LOCATOR))) {
|
|
48
|
+
await this.driverHelper.waitAndClick(OcpImportFromGitPage.SHOW_ADVANCED_GIT_OPTIONS_LINK_LOCATOR);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async enterGitReference(gitReference: string): Promise<void> {
|
|
53
|
+
Logger.debug(`"${gitReference}"`);
|
|
54
|
+
|
|
55
|
+
await this.driverHelper.enterValue(OcpImportFromGitPage.GIT_REFERENCE_INPUT_LOCATOR, gitReference);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async selectBuilderImageImportStrategy(): Promise<void> {
|
|
59
|
+
Logger.debug();
|
|
60
|
+
|
|
61
|
+
await this.driverHelper.scrollToAndClick(OcpImportFromGitPage.EDIT_IMPORT_STRATEGY_LINK_LOCATOR);
|
|
62
|
+
await this.driverHelper.scrollToAndClick(OcpImportFromGitPage.BUILDER_IMAGE_STRATEGY_ITEM_LOCATOR);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async addLabel(label: string): Promise<void> {
|
|
66
|
+
Logger.debug(`"${label}"`);
|
|
67
|
+
|
|
68
|
+
await this.driverHelper.scrollToAndClick(OcpImportFromGitPage.ADD_LABEL_LINK_LOCATOR);
|
|
69
|
+
await this.driverHelper.scrollToAndEnterValue(OcpImportFromGitPage.ADD_LABEL_INPUT_LOCATOR, label);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async submitConfiguration(): Promise<OcpApplicationPage> {
|
|
73
|
+
Logger.debug();
|
|
74
|
+
|
|
75
|
+
await this.driverHelper.waitAndClick(OcpImportFromGitPage.SUBMIT_BUTTON_LOCATOR);
|
|
76
|
+
return e2eContainer.get(CLASSES.OcpApplicationPage);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async fitAndSubmitConfiguration(gitRepoUrl: string, gitReference: string, label: string): Promise<OcpApplicationPage> {
|
|
80
|
+
Logger.debug();
|
|
81
|
+
|
|
82
|
+
await this.enterGitRepoUrl(gitRepoUrl);
|
|
83
|
+
await this.clickOnAdvancedOptionsButton();
|
|
84
|
+
await this.enterGitReference(gitReference);
|
|
85
|
+
await this.selectBuilderImageImportStrategy();
|
|
86
|
+
await this.addLabel(label);
|
|
87
|
+
return await this.submitConfiguration();
|
|
88
|
+
}
|
|
87
89
|
}
|
|
@@ -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
|
|
@@ -13,97 +13,98 @@ import { DriverHelper } from '../../utils/DriverHelper';
|
|
|
13
13
|
import { CLASSES } from '../../configs/inversify.types';
|
|
14
14
|
import { By } from 'selenium-webdriver';
|
|
15
15
|
import { Logger } from '../../utils/Logger';
|
|
16
|
-
import {
|
|
16
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
17
17
|
import { OcpImportFromGitPage } from './OcpImportFromGitPage';
|
|
18
18
|
import { e2eContainer } from '../../configs/inversify.config';
|
|
19
19
|
|
|
20
20
|
@injectable()
|
|
21
21
|
export class OcpMainPage {
|
|
22
|
+
private static readonly MAIN_PAGE_HEADER_LOCATOR: By = By.id('page-main-header');
|
|
23
|
+
private static readonly SELECT_ROLE_BUTTON_LOCATOR: By = By.xpath('//*[@data-test-id="perspective-switcher-toggle"]');
|
|
24
|
+
private static readonly ADD_BUTTON_LOCATOR: By = By.xpath('//*[@data-test-id="+Add-header"]');
|
|
25
|
+
private static readonly IMPORT_FROM_GIT_ITEM_LOCATOR: By = By.xpath('//*[@data-test="item import-from-git"]');
|
|
26
|
+
private static readonly SELECT_PROJECT_DROPDOWN_LOCATOR: By = By.xpath('//div[@class="co-namespace-dropdown"]//button');
|
|
27
|
+
private static readonly PROJECT_FILTER_INPUT_LOCATOR: By = By.xpath('//*[@data-test="dropdown-text-filter"]');
|
|
28
|
+
private static readonly SKIP_TOUR_BUTTON_LOCATOR: By = By.xpath('//*[text()="Skip tour"]');
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
private static readonly SELECT_PROJECT_DROPDOWN_LOCATOR: By = By.xpath('//div[@class="co-namespace-dropdown"]//button');
|
|
28
|
-
private static readonly PROJECT_FILTER_INPUT_LOCATOR: By = By.xpath('//*[@data-test="dropdown-text-filter"]');
|
|
29
|
-
private static readonly SKIP_TOUR_BUTTON_LOCATOR: By = By.xpath('//*[text()="Skip tour"]');
|
|
30
|
+
constructor(
|
|
31
|
+
@inject(CLASSES.DriverHelper)
|
|
32
|
+
private readonly driverHelper: DriverHelper
|
|
33
|
+
) {}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
private static getRoleLocator(role: string): By {
|
|
36
|
+
return By.xpath(`//a//*[text()="${role}"]`);
|
|
37
|
+
}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
private static getProjectDropdownItemLocator(projectName: string): By {
|
|
40
|
+
return By.xpath(`//button//*[text()="${projectName}"]`);
|
|
41
|
+
}
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
async waitOpenMainPage(): Promise<void> {
|
|
44
|
+
Logger.debug();
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
await this.driverHelper.waitVisibility(OcpMainPage.MAIN_PAGE_HEADER_LOCATOR, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
47
|
+
}
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
async clickOnSelectRoleButton(): Promise<void> {
|
|
50
|
+
Logger.debug();
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
await this.driverHelper.waitAndClick(OcpMainPage.SELECT_ROLE_BUTTON_LOCATOR);
|
|
53
|
+
}
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
async clickAddToProjectButton(): Promise<void> {
|
|
56
|
+
Logger.debug();
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
await this.driverHelper.waitAndClick(OcpMainPage.ADD_BUTTON_LOCATOR);
|
|
59
|
+
}
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
async selectDeveloperRole(): Promise<void> {
|
|
62
|
+
Logger.debug();
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
await this.waitOpenMainPage();
|
|
65
|
+
await this.tryToSkipWebTour();
|
|
66
|
+
await this.clickOnSelectRoleButton();
|
|
67
|
+
await this.selectRole('Developer');
|
|
68
|
+
await this.tryToSkipWebTour();
|
|
69
|
+
}
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
await this.clickOnSelectRoleButton();
|
|
66
|
-
await this.selectRole('Developer');
|
|
67
|
-
await this.tryToSkipWebTour();
|
|
68
|
-
}
|
|
71
|
+
async selectImportFromGitMethod(): Promise<OcpImportFromGitPage> {
|
|
72
|
+
Logger.debug();
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
await this.driverHelper.waitAndClick(OcpMainPage.IMPORT_FROM_GIT_ITEM_LOCATOR);
|
|
75
|
+
return e2eContainer.get(CLASSES.OcpImportFromGitPage);
|
|
76
|
+
}
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
78
|
+
async openImportFromGitPage(): Promise<OcpImportFromGitPage> {
|
|
79
|
+
Logger.debug();
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
await this.clickAddToProjectButton();
|
|
82
|
+
return await this.selectImportFromGitMethod();
|
|
83
|
+
}
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
85
|
+
async selectProject(projectName: string): Promise<void> {
|
|
86
|
+
Logger.debug();
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
await this.driverHelper.waitAndClick(OcpMainPage.SELECT_PROJECT_DROPDOWN_LOCATOR);
|
|
89
|
+
await this.driverHelper.enterValue(OcpMainPage.PROJECT_FILTER_INPUT_LOCATOR, projectName);
|
|
90
|
+
await this.driverHelper.waitAndClick(OcpMainPage.getProjectDropdownItemLocator(projectName));
|
|
91
|
+
}
|
|
86
92
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
await this.driverHelper.waitAndClick(OcpMainPage.getProjectDropdownItemLocator(projectName));
|
|
90
|
-
}
|
|
93
|
+
private async selectRole(role: string): Promise<void> {
|
|
94
|
+
Logger.debug(`selecting role ${role}`);
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
await this.driverHelper.waitAndClick(OcpMainPage.getRoleLocator(role));
|
|
97
|
+
}
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
private async tryToSkipWebTour(): Promise<void> {
|
|
100
|
+
Logger.debug();
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
if (await this.driverHelper.isVisible(OcpMainPage.SKIP_TOUR_BUTTON_LOCATOR)) {
|
|
103
|
+
await this.driverHelper.waitAndClick(OcpMainPage.SKIP_TOUR_BUTTON_LOCATOR);
|
|
100
104
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Logger.debug(`${this.constructor.name}.${this.tryToSkipWebTour.name} - Welcome tour modal dialog was not located`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
105
|
+
Logger.debug('welcome tour modal dialog was located and skipped');
|
|
106
|
+
} else {
|
|
107
|
+
Logger.debug('welcome tour modal dialog was not located');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
109
110
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
kind: DevWorkspace
|
|
2
|
+
apiVersion: workspace.devfile.io/v1alpha2
|
|
3
|
+
metadata:
|
|
4
|
+
name: code-latest-pod-overrides
|
|
5
|
+
spec:
|
|
6
|
+
started: true
|
|
7
|
+
template:
|
|
8
|
+
attributes:
|
|
9
|
+
pod-overrides:
|
|
10
|
+
metadata:
|
|
11
|
+
annotations:
|
|
12
|
+
io.openshift.userns: "true"
|
|
13
|
+
io.kubernetes.cri-o.userns-mode: "auto:size=65536;map-to-root=true" # <-- user namespace
|
|
14
|
+
openshift.io/scc: container-build
|
|
15
|
+
spec:
|
|
16
|
+
runtimeClassName: kata
|
|
17
|
+
schedulerName: stork
|
|
18
|
+
projects:
|
|
19
|
+
- name: web-nodejs-sample
|
|
20
|
+
git:
|
|
21
|
+
remotes:
|
|
22
|
+
origin: "https://github.com/che-samples/web-nodejs-sample.git"
|
|
23
|
+
commands:
|
|
24
|
+
- id: say-hello
|
|
25
|
+
exec:
|
|
26
|
+
component: che-code-runtime-description
|
|
27
|
+
commandLine: echo "Hello from $(pwd)"
|
|
28
|
+
workingDir: ${PROJECT_SOURCE}/app
|
|
29
|
+
contributions:
|
|
30
|
+
- name: che-code
|
|
31
|
+
uri: http://plugin-registry.openshift-devspaces.svc.cluster.local:8080/v3/plugins/che-incubator/che-code/latest/devfile.yaml
|
|
32
|
+
components:
|
|
33
|
+
- name: che-code-runtime-description
|
|
34
|
+
container:
|
|
35
|
+
env:
|
|
36
|
+
- name: CODE_HOST
|
|
37
|
+
value: 0.0.0.0
|
package/specs/MochaHooks.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 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
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
import 'reflect-metadata';
|
|
12
12
|
import { CLASSES, TYPES } from '../configs/inversify.types';
|
|
13
13
|
import { CheApiRequestHandler } from '../utils/request-handlers/CheApiRequestHandler';
|
|
14
|
-
import {
|
|
14
|
+
import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
|
|
15
15
|
import * as monacoPageObjects from 'monaco-page-objects';
|
|
16
16
|
import * as vscodeExtensionTesterLocators from 'vscode-extension-tester-locators';
|
|
17
17
|
import { e2eContainer } from '../configs/inversify.config';
|
|
18
18
|
import { DriverHelper } from '../utils/DriverHelper';
|
|
19
19
|
import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
|
|
20
20
|
import { Logger } from '../utils/Logger';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
21
|
+
import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
|
|
22
|
+
import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
|
|
23
|
+
import { MONACO_CONSTANTS } from '../constants/MONACO_CONSTANTS';
|
|
24
24
|
|
|
25
25
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
26
26
|
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
|
|
@@ -28,51 +28,60 @@ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUt
|
|
|
28
28
|
let latestWorkspace: string = '';
|
|
29
29
|
|
|
30
30
|
export function registerRunningWorkspace(workspaceName: string): void {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
Logger.debug(`with workspaceName:${workspaceName}`);
|
|
32
|
+
latestWorkspace = workspaceName;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
exports.mochaHooks = {
|
|
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
|
-
|
|
36
|
+
beforeAll: [
|
|
37
|
+
function enableRequestInterceptor(): void {
|
|
38
|
+
if (BASE_TEST_CONSTANTS.TS_SELENIUM_REQUEST_INTERCEPTOR) {
|
|
39
|
+
CheApiRequestHandler.enableRequestInterceptor();
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
function enableResponseInterceptor(): void {
|
|
43
|
+
if (BASE_TEST_CONSTANTS.TS_SELENIUM_RESPONSE_INTERCEPTOR) {
|
|
44
|
+
CheApiRequestHandler.enableResponseInterceptor();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
function initMonacoPageObjects(): void {
|
|
48
|
+
// init vscode-extension-tester monaco-page-objects
|
|
49
|
+
monacoPageObjects.initPageObjects(
|
|
50
|
+
MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION,
|
|
51
|
+
MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION,
|
|
52
|
+
vscodeExtensionTesterLocators.getLocatorsPath(),
|
|
53
|
+
driverHelper.getDriver(),
|
|
54
|
+
'google-chrome'
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
function prolongTimeoutConstantsInDebugMode(): void {
|
|
58
|
+
if (BASE_TEST_CONSTANTS.TS_DEBUG_MODE) {
|
|
59
|
+
for (const [timeout, seconds] of Object.entries(TIMEOUT_CONSTANTS)) {
|
|
60
|
+
Object.defineProperty(TIMEOUT_CONSTANTS, timeout, {
|
|
61
|
+
value: seconds * 100
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
afterEach: [
|
|
68
|
+
// stop and remove running workspace
|
|
69
|
+
function (this: Mocha.Context): void {
|
|
70
|
+
if (this.currentTest?.state === 'failed') {
|
|
71
|
+
if (BASE_TEST_CONSTANTS.DELETE_WORKSPACE_ON_FAILED_TEST) {
|
|
72
|
+
Logger.info('Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete running workspace with API.');
|
|
73
|
+
// await
|
|
74
|
+
testWorkspaceUtil.stopAndDeleteWorkspaceByName(latestWorkspace);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
afterAll: [
|
|
80
|
+
async function stopTheDriver(): Promise<void> {
|
|
81
|
+
if (!BASE_TEST_CONSTANTS.TS_DEBUG_MODE && CHROME_DRIVER_CONSTANTS.TS_USE_WEB_DRIVER_FOR_TEST) {
|
|
82
|
+
await driverHelper.getDriver().quit();
|
|
83
|
+
Logger.info('Chrome driver session stopped.');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
78
87
|
};
|
package/specs/SmokeTest.spec.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 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
|
|
@@ -16,46 +16,53 @@ import { registerRunningWorkspace } from './MochaHooks';
|
|
|
16
16
|
import { Logger } from '../utils/Logger';
|
|
17
17
|
import { LoginTests } from '../tests-library/LoginTests';
|
|
18
18
|
import { StringUtil } from '../utils/StringUtil';
|
|
19
|
-
import {
|
|
19
|
+
import { FACTORY_TEST_CONSTANTS } from '../constants/FACTORY_TEST_CONSTANTS';
|
|
20
20
|
import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
|
|
21
21
|
import { expect } from 'chai';
|
|
22
|
-
import {
|
|
22
|
+
import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
|
|
23
23
|
|
|
24
24
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
25
25
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
26
26
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
27
27
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
28
28
|
|
|
29
|
-
suite(
|
|
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
|
-
|
|
29
|
+
suite('The SmokeTest userstory', function (): void {
|
|
30
|
+
const factoryUrl: string =
|
|
31
|
+
FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/che-incubator/quarkus-api-example.git';
|
|
32
|
+
let projectSection: ViewSection;
|
|
33
|
+
suite(`Create workspace from factory:${factoryUrl}`, function (): void {
|
|
34
|
+
loginTests.loginIntoChe();
|
|
35
|
+
test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
|
|
36
|
+
await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
|
|
37
|
+
});
|
|
38
|
+
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
|
|
39
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
40
|
+
});
|
|
41
|
+
test('Register running workspace', function (): void {
|
|
42
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
43
|
+
});
|
|
44
|
+
test('Wait workspace readiness', async function (): Promise<void> {
|
|
45
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
46
|
+
});
|
|
47
|
+
test('Check a project folder has been created', async function (): Promise<void> {
|
|
48
|
+
const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || StringUtil.getProjectNameFromGitUrl(factoryUrl);
|
|
49
|
+
projectSection = await new SideBarView().getContent().getSection(projectName);
|
|
50
|
+
Logger.debug(`new SideBarView().getContent().getSection: get ${projectName}`);
|
|
51
|
+
});
|
|
52
|
+
test('Check the project files was imported', async function (): Promise<void> {
|
|
53
|
+
Logger.debug(`projectSection.findItem: find ${BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME}`);
|
|
54
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(
|
|
55
|
+
BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME
|
|
56
|
+
);
|
|
57
|
+
expect(isFileImported).not.eqls(undefined);
|
|
58
|
+
});
|
|
59
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
60
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
61
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
62
|
+
});
|
|
63
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
64
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
65
|
+
});
|
|
66
|
+
loginTests.logoutFromChe();
|
|
67
|
+
});
|
|
61
68
|
});
|