@eclipse-che/che-e2e 7.74.0-dev-1d09cb7 → 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 +13 -9
- 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} +12 -12
- package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +16 -16
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +13 -13
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
- package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +14 -13
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +7 -7
- package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
- package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +14 -14
- 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} +12 -12
- 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 +11 -11
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +16 -16
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +28 -28
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +36 -25
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +20 -18
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +9 -9
- 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 +5 -5
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +5 -5
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +13 -13
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +5 -5
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +6 -6
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +5 -5
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +8 -8
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +5 -5
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +4 -4
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +6 -6
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +26 -23
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +11 -11
- 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 +26 -15
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +17 -11
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +12 -3
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +5 -5
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +7 -7
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +41 -41
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +14 -9
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +25 -25
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +37 -34
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +33 -33
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +12 -3
- 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 +7 -5
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +16 -13
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +19 -14
- 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 +17 -8
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +19 -13
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +64 -66
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +28 -24
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +18 -19
- 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 +15 -7
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +27 -27
- 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 +3 -3
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
- package/dist/utils/workspace/TestWorkspaceUtil.js +21 -19
- 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 +44 -50
- package/driver/IDriver.ts +3 -3
- package/index.ts +9 -9
- package/package.json +59 -49
- package/pageobjects/dashboard/CreateWorkspace.ts +64 -55
- package/pageobjects/dashboard/Dashboard.ts +101 -100
- package/pageobjects/dashboard/Workspaces.ts +196 -164
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +150 -125
- 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 +31 -30
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +15 -14
- package/pageobjects/login/openshift/OcpLoginPage.ts +61 -54
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +29 -24
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +15 -18
- package/pageobjects/login/openshift/RedHatLoginPage.ts +48 -46
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +38 -34
- package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
- package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
- package/pageobjects/openshift/OcpMainPage.ts +69 -68
- package/specs/MochaHooks.ts +59 -50
- package/specs/SmokeTest.spec.ts +43 -40
- package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +106 -95
- package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
- package/specs/api/PodOverridesAPI.spec.ts +42 -33
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -31
- package/specs/dashboard-samples/Quarkus.spec.ts +34 -34
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -174
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +61 -52
- package/specs/factory/Factory.spec.ts +178 -168
- package/specs/factory/NoSetupRepoFactory.spec.ts +226 -211
- package/specs/factory/RefusedOAuthFactory.spec.ts +218 -204
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -54
- package/tests-library/LoginTests.ts +34 -32
- package/tests-library/ProjectAndFileTests.ts +21 -18
- package/tests-library/WorkspaceHandlingTests.ts +98 -89
- package/tsconfig.json +15 -15
- package/utils/BrowserTabsUtil.ts +103 -97
- package/utils/CheReporter.ts +141 -145
- package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
- package/utils/DevfilesRegistryHelper.ts +67 -58
- package/utils/DriverHelper.ts +726 -700
- package/utils/KubernetesCommandLineToolsExecutor.ts +196 -180
- package/utils/Logger.ts +102 -125
- package/utils/ScreenCatcher.ts +57 -46
- package/utils/ShellExecutor.ts +19 -11
- package/utils/StringUtil.ts +40 -32
- package/utils/request-handlers/CheApiRequestHandler.ts +91 -88
- 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 +152 -145
- package/utils/workspace/WorkspaceStatus.ts +5 -5
- package/constants/APITestConstants.ts +0 -57
- package/constants/BaseTestConstants.ts +0 -68
- 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) 2021 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,20 +11,20 @@
|
|
|
11
11
|
import 'reflect-metadata';
|
|
12
12
|
import { e2eContainer } from '../../configs/inversify.config';
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
ActivityBar,
|
|
15
|
+
ContextMenu,
|
|
16
|
+
EditorView,
|
|
17
|
+
error,
|
|
18
|
+
InputBox,
|
|
19
|
+
Locators,
|
|
20
|
+
ModalDialog,
|
|
21
|
+
NewScmView,
|
|
22
|
+
SideBarView,
|
|
23
|
+
SingleScmProvider,
|
|
24
|
+
TextEditor,
|
|
25
|
+
ViewControl,
|
|
26
|
+
ViewItem,
|
|
27
|
+
ViewSection
|
|
28
28
|
} from 'monaco-page-objects';
|
|
29
29
|
import { expect } from 'chai';
|
|
30
30
|
import { registerRunningWorkspace } from '../MochaHooks';
|
|
@@ -37,11 +37,11 @@ import { DriverHelper } from '../../utils/DriverHelper';
|
|
|
37
37
|
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
|
|
38
38
|
import { StringUtil } from '../../utils/StringUtil';
|
|
39
39
|
import { Logger } from '../../utils/Logger';
|
|
40
|
-
import {
|
|
40
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
41
41
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
42
|
+
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
43
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
44
|
+
import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
|
|
45
45
|
import WebDriverError = error.WebDriverError;
|
|
46
46
|
|
|
47
47
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
@@ -51,212 +51,226 @@ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocato
|
|
|
51
51
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
52
52
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
53
53
|
|
|
54
|
-
suite(
|
|
55
|
-
|
|
54
|
+
suite(
|
|
55
|
+
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`,
|
|
56
|
+
function (): void {
|
|
57
|
+
const oauthPage: OauthPage = new OauthPage(driverHelper);
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let scmContextMenu: ContextMenu;
|
|
59
|
+
let projectSection: ViewSection;
|
|
60
|
+
let scmProvider: SingleScmProvider;
|
|
61
|
+
let scmContextMenu: ContextMenu;
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
// test specific data
|
|
64
|
+
const timeToRefresh: number = 1500;
|
|
65
|
+
const changesToCommit: string = new Date().getTime().toString();
|
|
66
|
+
const fileToChange: string = 'Date.txt';
|
|
67
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
68
|
+
const refreshButtonLabel: string = 'Refresh';
|
|
69
|
+
const pushItemLabel: string = 'Push';
|
|
70
|
+
const label: string = BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
71
|
+
let testRepoProjectName: string;
|
|
72
|
+
const isPrivateRepo: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
loginTests.loginIntoChe();
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
|
|
77
|
+
await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
|
|
78
|
+
});
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
if (OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
|
|
81
|
+
test(`Authorize with a ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise<void> {
|
|
82
|
+
await oauthPage.login();
|
|
83
|
+
await oauthPage.waitOauthPage();
|
|
84
|
+
await oauthPage.denyAccess();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
|
|
89
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
90
|
+
});
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
test('The workspace starts with access deny flag in the url', async function (): Promise<void> {
|
|
93
|
+
expect(await driverHelper.getDriver().getCurrentUrl()).contains('&error_code=access_denied');
|
|
94
|
+
});
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
test('Registering the running workspace', function (): void {
|
|
97
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
98
|
+
});
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
test('Wait the workspace readiness', async function (): Promise<void> {
|
|
101
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
102
|
+
});
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
test('Check if a project folder has been created', async function (): Promise<void> {
|
|
105
|
+
testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
106
|
+
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
107
|
+
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
|
|
108
|
+
});
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
110
|
+
test('Accept the project as a trusted one', async function (): Promise<void> {
|
|
111
|
+
// click somewhere to trigger "Welcome Content" dialog
|
|
112
|
+
try {
|
|
113
|
+
await driverHelper.waitAndClick(webCheCodeLocators.Workbench.notificationItem);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
Logger.info(`Click on ${webCheCodeLocators.Workbench.notificationItem} to get "Welcome Content" dialog ${e as string}`);
|
|
116
|
+
}
|
|
117
|
+
// "Welcome Content" dialog can be shown before of after dialog with an error for private repo
|
|
118
|
+
try {
|
|
119
|
+
const buttonYesITrustTheAuthors: string = 'Yes, I trust the authors';
|
|
120
|
+
await driverHelper.waitVisibility(
|
|
121
|
+
webCheCodeLocators.WelcomeContent.text,
|
|
122
|
+
TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
|
|
123
|
+
);
|
|
124
|
+
const welcomeContentDialog: ModalDialog = new ModalDialog();
|
|
125
|
+
Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
|
|
126
|
+
await welcomeContentDialog.pushButton(buttonYesITrustTheAuthors);
|
|
127
|
+
await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
|
|
128
|
+
} catch (e) {
|
|
129
|
+
Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
|
|
130
|
+
if (!FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
131
|
+
throw new WebDriverError(e as string);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
137
|
+
test('Check that project can not be cloned', async function (): Promise<void> {
|
|
138
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message);
|
|
139
|
+
const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog();
|
|
140
|
+
const message: string = await workspaceDoesNotExistDialog.getMessage();
|
|
141
|
+
expect(message).contains('space does not exist');
|
|
142
|
+
});
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
test('Check that project files were not imported', async function (): Promise<void> {
|
|
145
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
146
|
+
expect(isFileImported).eqls(undefined);
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
test('Check if the project files were imported', async function (): Promise<void> {
|
|
150
|
+
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
151
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
152
|
+
// projectSection.findItem(label) can return undefined but test will goes on
|
|
153
|
+
expect(isFileImported).not.eqls(undefined);
|
|
154
|
+
});
|
|
144
155
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
test('Make changes to the file', async function (): Promise<void> {
|
|
157
|
+
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
|
|
158
|
+
await projectSection.openItem(fileToChange);
|
|
159
|
+
const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
|
|
160
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
|
|
161
|
+
Logger.debug('editor.clearText');
|
|
162
|
+
await editor.clearText();
|
|
163
|
+
Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
|
|
164
|
+
await editor.typeTextAt(1, 1, changesToCommit);
|
|
165
|
+
});
|
|
152
166
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
test('Open a source control manager', async function (): Promise<void> {
|
|
168
|
+
const viewSourceControl: string = 'Source Control';
|
|
169
|
+
const sourceControl: ViewControl = (await new ActivityBar().getViewControl(viewSourceControl)) as ViewControl;
|
|
170
|
+
Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
|
|
171
|
+
await sourceControl.openView();
|
|
172
|
+
const scmView: NewScmView = new NewScmView();
|
|
173
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
174
|
+
let rest: SingleScmProvider[];
|
|
175
|
+
[scmProvider, ...rest] = await scmView.getProviders();
|
|
176
|
+
Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
|
|
177
|
+
});
|
|
163
178
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
|
|
180
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
181
|
+
await driverHelper.wait(timeToRefresh);
|
|
182
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
183
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
184
|
+
// wait while changes counter will be refreshed
|
|
185
|
+
await driverHelper.wait(timeToRefresh);
|
|
186
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
187
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
188
|
+
expect(changes).eql(1);
|
|
189
|
+
});
|
|
174
190
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
184
|
-
expect(changes).eql(1);
|
|
185
|
-
});
|
|
191
|
+
test('Stage the changes', async function (): Promise<void> {
|
|
192
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
193
|
+
Logger.debug('scmProvider.openMoreActions');
|
|
194
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
195
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
|
|
196
|
+
Logger.debug('scmContextMenu.select: "Changes" -> "Stage All Changes"');
|
|
197
|
+
await scmContextMenu.select('Changes', 'Stage All Changes');
|
|
198
|
+
});
|
|
186
199
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
test('Commit the changes', async function (): Promise<void> {
|
|
201
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
202
|
+
Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
|
|
203
|
+
await scmProvider.commitChanges('Commit ' + changesToCommit);
|
|
204
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
205
|
+
await driverHelper.wait(timeToRefresh);
|
|
206
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
207
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
208
|
+
// wait while changes counter will be refreshed
|
|
209
|
+
await driverHelper.wait(timeToRefresh);
|
|
210
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
211
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
212
|
+
expect(changes).eql(0);
|
|
213
|
+
});
|
|
195
214
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
215
|
+
test('Push the changes', async function (): Promise<void> {
|
|
216
|
+
await driverHelper.waitVisibility(
|
|
217
|
+
webCheCodeLocators.ScmView.actionConstructor(
|
|
218
|
+
`Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
|
|
219
|
+
)
|
|
220
|
+
);
|
|
221
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
222
|
+
Logger.debug('scmProvider.openMoreActions');
|
|
223
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
224
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
225
|
+
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
226
|
+
await scmContextMenu.select(pushItemLabel);
|
|
227
|
+
});
|
|
210
228
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
217
|
-
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
218
|
-
await scmContextMenu.select(pushItemLabel);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
test('Insert git credentials which were asked after push', async function(): Promise<void> {
|
|
222
|
-
try {
|
|
223
|
-
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
224
|
-
} catch (e) {
|
|
225
|
-
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
229
|
+
test('Insert git credentials which were asked after push', async function (): Promise<void> {
|
|
230
|
+
try {
|
|
231
|
+
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
226
234
|
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
expect(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
|
|
236
|
+
}
|
|
237
|
+
const input: InputBox = new InputBox();
|
|
238
|
+
await input.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
239
|
+
await input.confirm();
|
|
240
|
+
await driverHelper.wait(timeToRefresh);
|
|
241
|
+
await input.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
|
|
242
|
+
await input.confirm();
|
|
243
|
+
await driverHelper.wait(timeToRefresh);
|
|
244
|
+
});
|
|
237
245
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
test('Check if the changes were pushed', async function (): Promise<void> {
|
|
247
|
+
try {
|
|
248
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
249
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
250
|
+
} catch (e) {
|
|
251
|
+
Logger.info(
|
|
252
|
+
'Check you use correct credentials.' +
|
|
253
|
+
'For bitbucket.org ensure you use an app password: https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/;' +
|
|
254
|
+
'For github.com - personal access token instead of password.'
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
|
|
258
|
+
webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel),
|
|
259
|
+
'aria-disabled'
|
|
260
|
+
);
|
|
261
|
+
expect(isCommitButtonDisabled).eql('true');
|
|
262
|
+
});
|
|
263
|
+
}
|
|
251
264
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
265
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
266
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
267
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
268
|
+
});
|
|
256
269
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
270
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
271
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
272
|
+
});
|
|
260
273
|
|
|
261
|
-
|
|
262
|
-
}
|
|
274
|
+
loginTests.logoutFromChe();
|
|
275
|
+
}
|
|
276
|
+
);
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
1
10
|
import { e2eContainer } from '../../configs/inversify.config';
|
|
2
11
|
import { assert } from 'chai';
|
|
3
12
|
import { CLASSES } from '../../configs/inversify.types';
|
|
@@ -13,66 +22,67 @@ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.
|
|
|
13
22
|
const predefinedNamespaceName: string = 'predefined-ns';
|
|
14
23
|
|
|
15
24
|
async function runShellScript(shellCommandToExecution: string): Promise<string> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
const { stdout, stderr } = await exec(shellCommandToExecution);
|
|
26
|
+
console.log(stdout);
|
|
27
|
+
console.error(stderr);
|
|
28
|
+
return stdout;
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
suite(
|
|
23
|
-
|
|
31
|
+
suite('Create predefined workspace and check it ', function (): void {
|
|
32
|
+
let workspaceName: string = '';
|
|
24
33
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
const setEditRightsForUser: string = `oc adm policy add-role-to-user edit user -n ${predefinedNamespaceName}`;
|
|
35
|
+
const getDevWorkspaceFromPredefinedNameSpace: string = `oc get dw -n ${predefinedNamespaceName}`;
|
|
36
|
+
const deletePredefinedNamespace: string = `oc delete project ${predefinedNamespaceName}`;
|
|
37
|
+
const createPredefinedProjectCommand: string =
|
|
38
|
+
'cat <<EOF | oc apply -f - \n' +
|
|
39
|
+
'kind: Namespace\n' +
|
|
40
|
+
'apiVersion: v1\n' +
|
|
41
|
+
'metadata:\n' +
|
|
42
|
+
` name: ${predefinedNamespaceName}\n` +
|
|
43
|
+
' labels:\n' +
|
|
44
|
+
' app.kubernetes.io/part-of: che.eclipse.org\n' +
|
|
45
|
+
' app.kubernetes.io/component: workspaces-namespace\n' +
|
|
46
|
+
' annotations:\n' +
|
|
47
|
+
' che.eclipse.org/username: user\n' +
|
|
48
|
+
'EOF';
|
|
49
|
+
// create a predefined namespace for user using shell script and login into user dashboard
|
|
50
|
+
suiteSetup(async function (): Promise<void> {
|
|
51
|
+
Logger.info('Test prerequisites:');
|
|
52
|
+
Logger.info(
|
|
53
|
+
' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_OCP_USERNAME and TS_SELENIUM_OCP_PASSWORD variables'
|
|
54
|
+
);
|
|
55
|
+
Logger.info(' (2) "oc" client installed and logged into test OCP cluster with admin rights.');
|
|
44
56
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
await runShellScript(createPredefinedProjectCommand);
|
|
58
|
+
await runShellScript(setEditRightsForUser);
|
|
59
|
+
});
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
suiteTeardown(async (): Promise<void> => {
|
|
62
|
+
const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
|
|
63
|
+
try {
|
|
64
|
+
await runShellScript(deletePredefinedNamespace);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
Logger.error(`Cannot remove the predefined project: ${workspaceName}, please fix it manually: ${e}`);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
loginTests.loginIntoChe();
|
|
71
|
+
// create the Empty workspace using CHE Dashboard
|
|
72
|
+
test(`Create and open new workspace, stack:${'Empty Workspace'}`, async function (): Promise<void> {
|
|
73
|
+
await workspaceHandlingTests.createAndOpenWorkspace('Empty Workspace');
|
|
74
|
+
});
|
|
75
|
+
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
|
|
76
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
77
|
+
});
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
// verify that just created workspace with unique name is present in the predefined namespace
|
|
80
|
+
test('Validate the created workspace is present in predefined namespace', async function (): Promise<void> {
|
|
81
|
+
workspaceName = WorkspaceHandlingTests.getWorkspaceName();
|
|
82
|
+
registerRunningWorkspace(workspaceName);
|
|
83
|
+
const ocDevWorkspaceOutput: string = await runShellScript(getDevWorkspaceFromPredefinedNameSpace);
|
|
84
|
+
assert.isTrue(ocDevWorkspaceOutput.includes(workspaceName));
|
|
85
|
+
});
|
|
74
86
|
|
|
75
|
-
|
|
87
|
+
loginTests.logoutFromChe();
|
|
76
88
|
});
|
|
77
|
-
|
|
78
|
-
|