@eclipse-che/che-e2e 7.63.0 → 7.64.0-dev-db63138
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/README.md +11 -37
- package/build/dockerfiles/entrypoint.sh +1 -1
- package/configs/inversify.config.ts +11 -26
- package/configs/inversify.types.ts +3 -33
- package/configs/mocharc.ts +9 -3
- package/configs/sh-scripts/initDefaultValues.sh +0 -5
- package/constants/TestConstants.ts +34 -96
- package/dist/configs/inversify.config.js +8 -23
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +3 -33
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +11 -4
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/TestConstants.js +31 -86
- package/dist/constants/TestConstants.js.map +1 -1
- package/dist/driver/ChromeDriver.js +1 -1
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/pageobjects/dashboard/CreateWorkspace.js +3 -11
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +16 -1
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +1 -3
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +150 -0
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -0
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +65 -0
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -0
- package/dist/pageobjects/login/OcpRedHatLoginPage.js +67 -0
- package/dist/pageobjects/login/OcpRedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/RedHatLoginPage.js +78 -0
- package/dist/pageobjects/login/RedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js +3 -21
- package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/CheLoginPage.js +0 -33
- package/dist/pageobjects/openshift/CheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpLoginPage.js +0 -14
- package/dist/pageobjects/openshift/OcpLoginPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +2 -2
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/devfiles/EmptyWorkspace.spec.js +1 -0
- package/dist/specs/devfiles/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/devfiles/Quarkus.spec.js +50 -0
- package/dist/specs/devfiles/Quarkus.spec.js.map +1 -0
- package/dist/specs/factory/Factory.spec.js +160 -0
- package/dist/specs/factory/Factory.spec.js.map +1 -0
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +228 -0
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -0
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +220 -0
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -0
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +66 -0
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -0
- package/dist/tests-library/LoginTests.js +10 -2
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +3 -6
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +2 -21
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/DriverHelper.js +11 -73
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/Logger.js +5 -0
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/Sanitizer.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/vsc/GitUtil.js +41 -0
- package/dist/utils/vsc/GitUtil.js.map +1 -0
- package/dist/utils/workspace/ApiUrlResolver.js +0 -3
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +2 -192
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +1 -1
- package/index.ts +37 -0
- package/package.json +9 -5
- package/pageobjects/dashboard/CreateWorkspace.ts +4 -15
- package/pageobjects/dashboard/Dashboard.ts +29 -4
- package/pageobjects/dashboard/Workspaces.ts +1 -3
- package/pageobjects/git-providers/OauthPage.ts +156 -0
- package/pageobjects/ide/CheCodeLocatorLoader.ts +69 -0
- package/pageobjects/login/OcpRedHatLoginPage.ts +49 -0
- package/pageobjects/login/RedHatLoginPage.ts +62 -0
- package/pageobjects/login/RegularUserOcpCheLoginPage.ts +1 -20
- package/pageobjects/openshift/CheLoginPage.ts +6 -55
- package/pageobjects/openshift/OcpLoginPage.ts +0 -21
- package/specs/MochaHooks.ts +2 -2
- package/specs/devfiles/EmptyWorkspace.spec.ts +1 -0
- package/specs/devfiles/Quarkus.spec.ts +52 -0
- package/specs/factory/Factory.spec.ts +199 -0
- package/specs/factory/NoSetupRepoFactory.spec.ts +272 -0
- package/specs/factory/RefusedOAuthFactory.spec.ts +260 -0
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +74 -0
- package/tests-library/LoginTests.ts +9 -1
- package/tests-library/WorkspaceHandlingTests.ts +3 -7
- package/utils/BrowserTabsUtil.ts +2 -24
- package/utils/DriverHelper.ts +9 -84
- package/utils/Logger.ts +5 -0
- package/utils/Sanitizer.ts +0 -1
- package/utils/request-handlers/CheApiRequestHandler.ts +1 -1
- package/utils/vsc/GitUtil.ts +28 -0
- package/utils/workspace/ApiUrlResolver.ts +0 -4
- package/utils/workspace/ITestWorkspaceUtil.ts +1 -56
- package/utils/workspace/TestWorkspaceUtil.ts +2 -243
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js +0 -97
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js.map +0 -1
- package/dist/pageobjects/login/MultiUserLoginPage.js +0 -49
- package/dist/pageobjects/login/MultiUserLoginPage.js.map +0 -1
- package/dist/pageobjects/login/UpdateAccountInformationPage.js +0 -74
- package/dist/pageobjects/login/UpdateAccountInformationPage.js.map +0 -1
- package/dist/pageobjects/third-parties/GitLoginPage.js +0 -85
- package/dist/pageobjects/third-parties/GitLoginPage.js.map +0 -1
- package/dist/pageobjects/third-parties/GitOauthAppsSettings.js +0 -110
- package/dist/pageobjects/third-parties/GitOauthAppsSettings.js.map +0 -1
- package/dist/specs/login/LinkCheAndOcpUsers.spec.js +0 -40
- package/dist/specs/login/LinkCheAndOcpUsers.spec.js.map +0 -1
- package/dist/utils/WorkspaceNameHandler.js +0 -60
- package/dist/utils/WorkspaceNameHandler.js.map +0 -1
- package/dist/utils/request-handlers/tokens/CheMultiuserTokenHandler.js +0 -50
- package/dist/utils/request-handlers/tokens/CheMultiuserTokenHandler.js.map +0 -1
- package/dist/utils/request-handlers/tokens/ITokenHandler.js +0 -12
- package/dist/utils/request-handlers/tokens/ITokenHandler.js.map +0 -1
- package/dist/utils/vsc/CheGitApi.js +0 -42
- package/dist/utils/vsc/CheGitApi.js.map +0 -1
- package/dist/utils/vsc/github/GitHubUtil.js +0 -126
- package/dist/utils/vsc/github/GitHubUtil.js.map +0 -1
- package/files/devfiles/plugins/GitHubPullRequestPlugin.yaml +0 -11
- package/files/devfiles/plugins/InstallPluginUsingUI.yaml +0 -3
- package/files/devfiles/plugins/Java11PluginTest.yaml +0 -17
- package/files/devfiles/plugins/PhpPluginTest.yaml +0 -47
- package/files/devfiles/plugins/PythonPluginTest.yaml +0 -14
- package/files/devfiles/plugins/TypescriptNodeDebug2PluginTest.yaml +0 -49
- package/files/devfiles/plugins/VscodeKubernetesPlugin.yaml +0 -12
- package/files/devfiles/plugins/VscodeShellcheckPlugin.yaml +0 -12
- package/files/devfiles/plugins/VscodeValePlugin.yaml +0 -42
- package/files/devfiles/plugins/VscodeXmlPlugin.yaml +0 -12
- package/files/devfiles/plugins/VscodeYamlPlugin.yaml +0 -12
- package/files/happy-path/containers-happy-path.yaml +0 -127
- package/files/happy-path/happy-path-workspace.yaml +0 -95
- package/files/happy-path/petclinic-classpath.txt +0 -49
- package/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +0 -95
- package/pageobjects/login/MultiUserLoginPage.ts +0 -33
- package/pageobjects/login/UpdateAccountInformationPage.ts +0 -70
- package/pageobjects/third-parties/GitLoginPage.ts +0 -81
- package/pageobjects/third-parties/GitOauthAppsSettings.ts +0 -110
- package/specs/login/LinkCheAndOcpUsers.spec.ts +0 -49
- package/utils/WorkspaceNameHandler.ts +0 -48
- package/utils/request-handlers/tokens/CheMultiuserTokenHandler.ts +0 -41
- package/utils/request-handlers/tokens/ITokenHandler.ts +0 -14
- package/utils/vsc/CheGitApi.ts +0 -22
- package/utils/vsc/github/GitHubUtil.ts +0 -110
|
@@ -19,24 +19,19 @@ import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
|
19
19
|
export class CheLoginPage {
|
|
20
20
|
|
|
21
21
|
constructor(
|
|
22
|
-
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
|
|
22
|
+
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
|
|
23
|
+
}
|
|
23
24
|
|
|
24
25
|
async waitEclipseCheLoginFormPage() {
|
|
25
|
-
|
|
26
|
+
Logger.debug('CheLoginPage.waitEclipseCheLoginFormPage');
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
await this.driverHelper.waitVisibility(By.id('login'), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
async inputUserNameEclipseCheLoginPage(userName: string) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
await this.driverHelper.enterValue(By.id('login'), userName);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async inputPaswordEclipseCheLoginPage(passw: string) {
|
|
37
|
-
Logger.debug(`CheLoginPage.inputPaswordEclipseCheLoginPage password: "${passw}"`);
|
|
32
|
+
Logger.debug(`CheLoginPage.inputUserNameEclipseCheLoginPage username: "${userName}"`);
|
|
38
33
|
|
|
39
|
-
|
|
34
|
+
await this.driverHelper.enterValue(By.id('login'), userName);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
async clickEclipseCheLoginButton() {
|
|
@@ -44,48 +39,4 @@ export class CheLoginPage {
|
|
|
44
39
|
|
|
45
40
|
await this.driverHelper.waitAndClick(By.id('submit-login'));
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
async isFirstBrokerLoginPageVisible(): Promise<boolean> {
|
|
49
|
-
Logger.debug('CheLoginPage.waitFirstBrokerLoginPage');
|
|
50
|
-
|
|
51
|
-
return await this.driverHelper.isVisible(By.id('kc-update-profile-form'));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async waitFirstBrokerLoginPage() {
|
|
55
|
-
Logger.debug('CheLoginPage.waitFirstBrokerLoginPage');
|
|
56
|
-
|
|
57
|
-
await this.driverHelper.waitVisibility(By.id('kc-update-profile-form'), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async enterEmailFirstBrokerLoginPage(email: string) {
|
|
61
|
-
Logger.debug(`CheLoginPage.enterEmailFirstBrokerLoginPage "${email}"`);
|
|
62
|
-
|
|
63
|
-
await this.driverHelper.enterValue(By.id('email'), email);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async enterFirstNameBrokerLoginPage(firstName: string) {
|
|
67
|
-
Logger.debug(`CheLoginPage.enterFirstNameBrokerLoginPage "${firstName}"`);
|
|
68
|
-
|
|
69
|
-
await this.driverHelper.enterValue(By.id('firstName'), firstName);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async enterLastNameBrokerLoginPage(lastName: string) {
|
|
73
|
-
Logger.debug(`CheLoginPage.enterLastNameBrokerLoginPage "${lastName}"`);
|
|
74
|
-
|
|
75
|
-
await this.driverHelper.enterValue(By.id('lastName'), lastName);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async clickOnSubmitButton() {
|
|
79
|
-
Logger.debug('CheLoginPage.clickOnSubmitButton');
|
|
80
|
-
|
|
81
|
-
const submitButtonlocator: By = By.css('input[type=submit]');
|
|
82
|
-
await this.driverHelper.waitAndClick(submitButtonlocator);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async waitDisappearanceBrokerLoginPage() {
|
|
86
|
-
Logger.debug('CheLoginPage.waitDisappearanceBrokerLoginPage');
|
|
87
|
-
|
|
88
|
-
await this.driverHelper.waitDisappearance(By.id('kc-update-profile-form'));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
42
|
}
|
|
@@ -24,12 +24,6 @@ export class OcpLoginPage {
|
|
|
24
24
|
constructor(
|
|
25
25
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
26
26
|
|
|
27
|
-
async openLoginPageOpenShift(url: string) {
|
|
28
|
-
Logger.debug('OcpLoginPage.openLoginPageOpenShift');
|
|
29
|
-
|
|
30
|
-
await this.driverHelper.navigateToUrl(url);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
27
|
async waitOpenShiftLoginWelcomePage() {
|
|
34
28
|
Logger.debug('OcpLoginPage.waitOpenShiftLoginWelcomePage');
|
|
35
29
|
|
|
@@ -95,19 +89,4 @@ export class OcpLoginPage {
|
|
|
95
89
|
|
|
96
90
|
await this.driverHelper.waitDisappearance(By.xpath(OcpLoginPage.LOGIN_PAGE_OPENSHIFT_XPATH));
|
|
97
91
|
}
|
|
98
|
-
|
|
99
|
-
async isLinkAccountPageVisible(): Promise<boolean> {
|
|
100
|
-
Logger.debug('OcpLoginPage.isLinkAccountPageVisible');
|
|
101
|
-
|
|
102
|
-
const linkAccountLocator: By = By.id(`linkAccount`);
|
|
103
|
-
return await this.driverHelper.waitVisibilityBoolean(linkAccountLocator, 3, 5000);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async clickOnLinkAccountButton() {
|
|
107
|
-
Logger.debug('OcpLoginPage.clickOnLinkAccountButton');
|
|
108
|
-
|
|
109
|
-
const linkAccountLocator: By = By.id(`linkAccount`);
|
|
110
|
-
this.driverHelper.waitAndClick(linkAccountLocator);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
92
|
}
|
package/specs/MochaHooks.ts
CHANGED
|
@@ -34,7 +34,7 @@ exports.mochaHooks = {
|
|
|
34
34
|
beforeAll: [
|
|
35
35
|
async function enableRequestInterceptor() {
|
|
36
36
|
if (TestConstants.TS_SELENIUM_REQUEST_INTERCEPTOR) {
|
|
37
|
-
CheApiRequestHandler.
|
|
37
|
+
CheApiRequestHandler.enableRequestInterceptor();
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
async function enableResponseInterceptor() {
|
|
@@ -47,7 +47,7 @@ exports.mochaHooks = {
|
|
|
47
47
|
monacoPageObjects.initPageObjects(TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_USE_VERSION, TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION, vscodeExtensionTesterLocators.getLocatorsPath(), driverHelper.getDriver(), 'google-chrome');
|
|
48
48
|
},
|
|
49
49
|
async function prolongTimeoutConstantsInDebugMode() {
|
|
50
|
-
if (TestConstants.TS_DEBUG_MODE
|
|
50
|
+
if (TestConstants.TS_DEBUG_MODE) {
|
|
51
51
|
for (let [timeout, seconds] of Object.entries(TimeoutConstants)) {
|
|
52
52
|
Object.defineProperty(TimeoutConstants, timeout, {value: seconds * 100});
|
|
53
53
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*********************************************************************
|
|
2
|
+
* Copyright (c) 2019 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
10
|
+
|
|
11
|
+
import { SideBarView, ViewSection } from 'monaco-page-objects';
|
|
12
|
+
import { registerRunningWorkspace } from '../MochaHooks';
|
|
13
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
14
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
15
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
16
|
+
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
17
|
+
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
18
|
+
import { Logger } from '../../utils/Logger';
|
|
19
|
+
|
|
20
|
+
const stackName: string = 'Java 11 with Quarkus';
|
|
21
|
+
const projectName: string = 'quarkus-quickstarts';
|
|
22
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
23
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
24
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
25
|
+
|
|
26
|
+
suite(`The ${stackName} userstory`, async function () {
|
|
27
|
+
let projectSection: ViewSection;
|
|
28
|
+
suite(`Create workspace from ${stackName} simple`, async function () {
|
|
29
|
+
loginTests.loginIntoChe();
|
|
30
|
+
workspaceHandlingTests.createAndOpenWorkspace(stackName);
|
|
31
|
+
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
32
|
+
test('Register running workspace', async () => {
|
|
33
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
34
|
+
});
|
|
35
|
+
test('Wait workspace readiness', async function () {
|
|
36
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
37
|
+
});
|
|
38
|
+
test('Check a project folder has been created', async function () {
|
|
39
|
+
projectSection = await new SideBarView().getContent().getSection(projectName);
|
|
40
|
+
Logger.debug(`new SideBarView().getContent().getSection: get ${projectName}`);
|
|
41
|
+
});
|
|
42
|
+
test('Check the project files was imported', async function () {
|
|
43
|
+
const label: string = 'devfile.yaml';
|
|
44
|
+
await projectSection.findItem(label);
|
|
45
|
+
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
46
|
+
});
|
|
47
|
+
test('Stopping and deleting the workspace', async function () {
|
|
48
|
+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
49
|
+
});
|
|
50
|
+
loginTests.logoutFromChe();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*********************************************************************
|
|
2
|
+
* Copyright (c) 2021 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
10
|
+
|
|
11
|
+
import 'reflect-metadata';
|
|
12
|
+
|
|
13
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
14
|
+
import {
|
|
15
|
+
ActivityBar,
|
|
16
|
+
ContextMenu,
|
|
17
|
+
EditorView,
|
|
18
|
+
Locators,
|
|
19
|
+
ModalDialog,
|
|
20
|
+
NewScmView,
|
|
21
|
+
SideBarView,
|
|
22
|
+
SingleScmProvider,
|
|
23
|
+
TextEditor,
|
|
24
|
+
ViewControl,
|
|
25
|
+
ViewItem,
|
|
26
|
+
ViewSection
|
|
27
|
+
} from 'monaco-page-objects';
|
|
28
|
+
import { TestConstants } from '../../constants/TestConstants';
|
|
29
|
+
import { expect } from 'chai';
|
|
30
|
+
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
|
|
31
|
+
import { GitUtil } from '../../utils/vsc/GitUtil';
|
|
32
|
+
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
33
|
+
import { registerRunningWorkspace } from '../MochaHooks';
|
|
34
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
35
|
+
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
36
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
37
|
+
import { DriverHelper } from '../../utils/DriverHelper';
|
|
38
|
+
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
39
|
+
import { Logger } from '../../utils/Logger';
|
|
40
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
41
|
+
|
|
42
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
43
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
44
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
45
|
+
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
46
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
47
|
+
|
|
48
|
+
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
|
|
49
|
+
|
|
50
|
+
suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository`, async function () {
|
|
51
|
+
const oauthPage: OauthPage = new OauthPage(driverHelper);
|
|
52
|
+
|
|
53
|
+
let projectSection: ViewSection;
|
|
54
|
+
let scmProvider: SingleScmProvider;
|
|
55
|
+
let rest: SingleScmProvider[];
|
|
56
|
+
let scmContextMenu: ContextMenu;
|
|
57
|
+
const gitUtilCheCode: GitUtil = new GitUtil();
|
|
58
|
+
|
|
59
|
+
// test specific data
|
|
60
|
+
const timeToRefresh: number = 1500;
|
|
61
|
+
const changesToCommit: string = (new Date()).getTime().toString();
|
|
62
|
+
const fileToChange: string = 'Date.txt';
|
|
63
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
64
|
+
const refreshButtonLabel: string = 'Refresh';
|
|
65
|
+
const pushItemLabel: string = 'Push';
|
|
66
|
+
const testRepoProjectName: string = gitUtilCheCode.getProjectNameFromGitUrl(TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
67
|
+
|
|
68
|
+
loginTests.loginIntoChe();
|
|
69
|
+
test(`Navigate to the factory URL`, async function () {
|
|
70
|
+
await browserTabsUtil.navigateTo(TestConstants.TS_SELENIUM_FACTORY_URL());
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (TestConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
|
|
74
|
+
test(`Authorize with a ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth`, async function () {
|
|
75
|
+
await oauthPage.login();
|
|
76
|
+
await oauthPage.waitOauthPage();
|
|
77
|
+
await oauthPage.confirmAccess();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
82
|
+
|
|
83
|
+
test('Registering the running workspace', async function () {
|
|
84
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('Wait the workspace readiness', async function () {
|
|
88
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('Check if a project folder has been created', async function () {
|
|
92
|
+
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
93
|
+
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName as unknown as string);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('Check if the project files were imported', async function () {
|
|
97
|
+
const label: string = TestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
98
|
+
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
99
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
100
|
+
expect(isFileImported).not.eqls(undefined);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('Accept the project as a trusted one', async function () {
|
|
104
|
+
const buttonYesITrustTheAuthors: string = `Yes, I trust the authors`;
|
|
105
|
+
const trustedProjectDialog: ModalDialog = new ModalDialog();
|
|
106
|
+
await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.button);
|
|
107
|
+
Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
|
|
108
|
+
await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('Make changes to the file', async function () {
|
|
112
|
+
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
|
|
113
|
+
await projectSection.openItem(fileToChange);
|
|
114
|
+
const editor: TextEditor = await new EditorView().openEditor(fileToChange) as TextEditor;
|
|
115
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
|
|
116
|
+
Logger.debug(`editor.clearText`);
|
|
117
|
+
await editor.clearText();
|
|
118
|
+
Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
|
|
119
|
+
await editor.typeTextAt(1, 1, changesToCommit);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('Open a source control manager', async function () {
|
|
123
|
+
const viewSourceControl: string = `Source Control`;
|
|
124
|
+
const sourceControl: ViewControl = await new ActivityBar().getViewControl(viewSourceControl) as ViewControl;
|
|
125
|
+
Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
|
|
126
|
+
await sourceControl.openView();
|
|
127
|
+
const scmView: NewScmView = new NewScmView();
|
|
128
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
129
|
+
[scmProvider, ...rest] = await scmView.getProviders();
|
|
130
|
+
Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('Check if the changes is displayed in the source control manager', async function () {
|
|
134
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
135
|
+
await driverHelper.wait(timeToRefresh);
|
|
136
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
137
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
138
|
+
// wait while changes counter will be refreshed
|
|
139
|
+
await driverHelper.wait(timeToRefresh);
|
|
140
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
141
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
142
|
+
expect(changes).eql(1);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('Stage the changes', async function () {
|
|
146
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
147
|
+
Logger.debug(`scmProvider.openMoreActions`);
|
|
148
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
149
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
|
|
150
|
+
Logger.debug(`scmContextMenu.select: "Changes" -> "Stage All Changes"`);
|
|
151
|
+
await scmContextMenu.select('Changes', 'Stage All Changes');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('Commit the changes', async function () {
|
|
155
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
156
|
+
Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
|
|
157
|
+
await scmProvider.commitChanges('Commit ' + changesToCommit);
|
|
158
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
159
|
+
await driverHelper.wait(timeToRefresh);
|
|
160
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
161
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
162
|
+
// wait while changes counter will be refreshed
|
|
163
|
+
await driverHelper.wait(timeToRefresh);
|
|
164
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
165
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
166
|
+
expect(changes).eql(0);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('Push the changes', async function () {
|
|
170
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
|
|
171
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
172
|
+
Logger.debug(`scmProvider.openMoreActions`);
|
|
173
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
174
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
175
|
+
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
176
|
+
await scmContextMenu.select(pushItemLabel);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test('Check if the changes were pushed', async function () {
|
|
180
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
181
|
+
await driverHelper.wait(timeToRefresh);
|
|
182
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
183
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
184
|
+
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel), 'aria-disabled');
|
|
185
|
+
expect(isCommitButtonDisabled).eql('true');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test(`Stop and remove the workspace`, async function () {
|
|
189
|
+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
loginTests.logoutFromChe();
|
|
193
|
+
|
|
194
|
+
suiteTeardown('Close the browser', async function () {
|
|
195
|
+
if (!TestConstants.TS_DEBUG_MODE) {
|
|
196
|
+
await driverHelper.getDriver().close();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/*********************************************************************
|
|
2
|
+
* Copyright (c) 2021 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
10
|
+
|
|
11
|
+
import 'reflect-metadata';
|
|
12
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
13
|
+
import {
|
|
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
|
+
} from 'monaco-page-objects';
|
|
29
|
+
import { expect } from 'chai';
|
|
30
|
+
import { GitUtil } from '../../utils/vsc/GitUtil';
|
|
31
|
+
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
32
|
+
import WebDriverError = error.WebDriverError;
|
|
33
|
+
import { registerRunningWorkspace } from '../MochaHooks';
|
|
34
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
35
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
36
|
+
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
37
|
+
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
38
|
+
import { DriverHelper } from '../../utils/DriverHelper';
|
|
39
|
+
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
40
|
+
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
|
|
41
|
+
import { GitProviderType, TestConstants } from '../../constants/TestConstants';
|
|
42
|
+
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
43
|
+
import { Logger } from '../../utils/Logger';
|
|
44
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
45
|
+
|
|
46
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
47
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
48
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
49
|
+
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
|
|
50
|
+
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
51
|
+
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
52
|
+
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
|
|
53
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
54
|
+
|
|
55
|
+
suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup`, async function () {
|
|
56
|
+
|
|
57
|
+
let projectSection: ViewSection;
|
|
58
|
+
let scmProvider: SingleScmProvider;
|
|
59
|
+
let rest: SingleScmProvider[];
|
|
60
|
+
let scmContextMenu: ContextMenu;
|
|
61
|
+
const gitUtilCheCode: GitUtil = new GitUtil();
|
|
62
|
+
|
|
63
|
+
// test specific data
|
|
64
|
+
let numberOfCreatedWorkspaces: number = 0;
|
|
65
|
+
const timeToRefresh: number = 1500;
|
|
66
|
+
const changesToCommit: string = (new Date()).getTime().toString();
|
|
67
|
+
const fileToChange: string = 'Date.txt';
|
|
68
|
+
const pushItemLabel: string = 'Push';
|
|
69
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
70
|
+
const refreshButtonLabel: string = 'Refresh';
|
|
71
|
+
const label: string = TestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
72
|
+
const testRepoProjectName: string = gitUtilCheCode.getProjectNameFromGitUrl(TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
73
|
+
const isPrivateRepo: string = TestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
74
|
+
|
|
75
|
+
loginTests.loginIntoChe();
|
|
76
|
+
|
|
77
|
+
test('Get number of previously created workspaces', async function () {
|
|
78
|
+
await dashboard.clickWorkspacesButton();
|
|
79
|
+
await workspaces.waitPage();
|
|
80
|
+
numberOfCreatedWorkspaces = (await workspaces.getAllCreatedWorkspacesNames()).length;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function () {
|
|
84
|
+
await browserTabsUtil.navigateTo(TestConstants.TS_SELENIUM_FACTORY_URL());
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (TestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
88
|
+
|
|
89
|
+
test(`Check that workspace cannot be created without OAuth for ${isPrivateRepo} repo`, async function () {
|
|
90
|
+
await dashboard.waitLoader();
|
|
91
|
+
const loaderAlert: string = await dashboard.getLoaderAlert();
|
|
92
|
+
expect(loaderAlert).contains('Failed to create the workspace')
|
|
93
|
+
.and.contains('Cause: Unsupported OAuth provider ');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test(`Check that workspace was not created`, async function () {
|
|
97
|
+
await dashboard.openDashboard();
|
|
98
|
+
await dashboard.clickWorkspacesButton();
|
|
99
|
+
await workspaces.waitPage();
|
|
100
|
+
const allCreatedWorkspacesNames: string[] = await workspaces.getAllCreatedWorkspacesNames();
|
|
101
|
+
expect(allCreatedWorkspacesNames).has.length(numberOfCreatedWorkspaces);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
loginTests.logoutFromChe();
|
|
105
|
+
|
|
106
|
+
} else {
|
|
107
|
+
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
108
|
+
|
|
109
|
+
test('Registering the running workspace', async function () {
|
|
110
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('Wait the workspace readiness', async function () {
|
|
114
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('Check if a project folder has been created', async function () {
|
|
118
|
+
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
119
|
+
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName as unknown as string);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('Accept the project as a trusted one', async function () {
|
|
123
|
+
// click somewhere to trigger "Welcome Content" dialog
|
|
124
|
+
try {
|
|
125
|
+
await driverHelper.waitAndClick(webCheCodeLocators.Workbench.notificationItem);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
Logger.info(`Click on ${webCheCodeLocators.Workbench.notificationItem} to get "Welcome Content" dialog ${e as string}`);
|
|
128
|
+
}
|
|
129
|
+
// "Welcome Content" dialog can be shown before of after dialog with an error for private repo
|
|
130
|
+
try {
|
|
131
|
+
const buttonYesITrustTheAuthors: string = `Yes, I trust the authors`;
|
|
132
|
+
await driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.text, TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
|
|
133
|
+
const welcomeContentDialog: ModalDialog = new ModalDialog();
|
|
134
|
+
Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
|
|
135
|
+
await welcomeContentDialog.pushButton(buttonYesITrustTheAuthors);
|
|
136
|
+
await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
|
|
139
|
+
if (!TestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
140
|
+
throw new WebDriverError(e as string);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('Check if the project files were imported', async function () {
|
|
146
|
+
Logger.debug(`projectSection.findItem: find ${label}`);
|
|
147
|
+
const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
|
|
148
|
+
// projectSection.findItem(label) can return undefined but test will goes on
|
|
149
|
+
expect(isFileImported).not.eqls(undefined);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('Make changes to the file', async function () {
|
|
153
|
+
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
|
|
154
|
+
await projectSection.openItem(fileToChange);
|
|
155
|
+
const editor: TextEditor = await new EditorView().openEditor(fileToChange) as TextEditor;
|
|
156
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
|
|
157
|
+
Logger.debug(`editor.clearText`);
|
|
158
|
+
await editor.clearText();
|
|
159
|
+
Logger.debug(`editor.typeTextAt: "${changesToCommit}"`);
|
|
160
|
+
await editor.typeTextAt(1, 1, changesToCommit);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('Open a source control manager', async function () {
|
|
164
|
+
const viewSourceControl: string = `Source Control`;
|
|
165
|
+
const sourceControl: ViewControl = await new ActivityBar().getViewControl(viewSourceControl) as ViewControl;
|
|
166
|
+
Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
|
|
167
|
+
await sourceControl.openView();
|
|
168
|
+
const scmView: NewScmView = new NewScmView();
|
|
169
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
170
|
+
[scmProvider, ...rest] = await scmView.getProviders();
|
|
171
|
+
Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test('Check if the changes is displayed in the source control manager', async function () {
|
|
175
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
176
|
+
await driverHelper.wait(timeToRefresh);
|
|
177
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
178
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
179
|
+
// wait while changes counter will be refreshed
|
|
180
|
+
await driverHelper.wait(timeToRefresh);
|
|
181
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
182
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
183
|
+
expect(changes).eql(1);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('Stage the changes', async function () {
|
|
187
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
188
|
+
Logger.debug(`scmProvider.openMoreActions`);
|
|
189
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
190
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
|
|
191
|
+
Logger.debug(`scmContextMenu.select: "Changes" -> "Stage All Changes"`);
|
|
192
|
+
await scmContextMenu.select('Changes', 'Stage All Changes');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('Commit the changes', async function () {
|
|
196
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
|
|
197
|
+
Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
|
|
198
|
+
await scmProvider.commitChanges('Commit ' + changesToCommit);
|
|
199
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
200
|
+
await driverHelper.wait(timeToRefresh);
|
|
201
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
202
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
203
|
+
// wait while changes counter will be refreshed
|
|
204
|
+
await driverHelper.wait(timeToRefresh);
|
|
205
|
+
const changes: number = await scmProvider.getChangeCount();
|
|
206
|
+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
|
|
207
|
+
expect(changes).eql(0);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test('Push the changes', async function () {
|
|
211
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
|
|
212
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
213
|
+
Logger.debug(`scmProvider.openMoreActions`);
|
|
214
|
+
scmContextMenu = await scmProvider.openMoreActions();
|
|
215
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
216
|
+
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
217
|
+
await scmContextMenu.select(pushItemLabel);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
if (TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER === GitProviderType.GITHUB) {
|
|
221
|
+
test('Decline GitHub Extension', async function () {
|
|
222
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details);
|
|
223
|
+
const gitHaExtensionDialog: ModalDialog = new ModalDialog();
|
|
224
|
+
await gitHaExtensionDialog.pushButton('Cancel');
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
test('Insert git credentials which were asked after push', async function () {
|
|
229
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Input.inputBox);
|
|
233
|
+
} catch (e) {
|
|
234
|
+
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
235
|
+
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066`);
|
|
236
|
+
}
|
|
237
|
+
const input: InputBox = new InputBox();
|
|
238
|
+
await input.setText(TestConstants.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
239
|
+
await driverHelper.wait(timeToRefresh);
|
|
240
|
+
await input.confirm();
|
|
241
|
+
await driverHelper.wait(timeToRefresh);
|
|
242
|
+
await input.setText(TestConstants.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
|
|
243
|
+
await input.confirm();
|
|
244
|
+
await driverHelper.wait(timeToRefresh);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test('Check if the changes were pushed', async function () {
|
|
248
|
+
try {
|
|
249
|
+
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
250
|
+
await scmProvider.takeAction(refreshButtonLabel);
|
|
251
|
+
} catch (e) {
|
|
252
|
+
Logger.info('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
|
+
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel), 'aria-disabled');
|
|
257
|
+
expect(isCommitButtonDisabled).eql('true');
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test(`Stop and remove the workspace`, async function () {
|
|
261
|
+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
loginTests.logoutFromChe();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
suiteTeardown('Close the browser', async function () {
|
|
268
|
+
if (!TestConstants.TS_DEBUG_MODE) {
|
|
269
|
+
await driverHelper.getDriver().close();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|