@eclipse-che/che-e2e 7.111.0-next-0363983 → 7.111.0-next-da36bbf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/inversify.config.ts +4 -0
- package/configs/inversify.types.ts +3 -1
- package/constants/FACTORY_TEST_CONSTANTS.ts +30 -0
- package/dist/configs/inversify.config.js +4 -0
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +3 -1
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/constants/FACTORY_TEST_CONSTANTS.js +20 -0
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/UserPreferences.js +47 -2
- package/dist/pageobjects/dashboard/UserPreferences.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/GitHubExtensionDialog.js +66 -0
- package/dist/pageobjects/ide/GitHubExtensionDialog.js.map +1 -0
- package/dist/pageobjects/ide/SourceControlView.js +52 -0
- package/dist/pageobjects/ide/SourceControlView.js.map +1 -0
- package/dist/specs/factory/Factory.spec.js +3 -6
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +30 -45
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +56 -39
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/factory/SshUrlNoOauthPatFactory.spec.js +11 -1
- package/dist/specs/factory/SshUrlNoOauthPatFactory.spec.js.map +1 -1
- package/index.ts +2 -0
- package/package.json +1 -1
- package/pageobjects/dashboard/UserPreferences.ts +65 -2
- package/pageobjects/git-providers/OauthPage.ts +1 -1
- package/pageobjects/ide/GitHubExtensionDialog.ts +52 -0
- package/pageobjects/ide/SourceControlView.ts +35 -0
- package/specs/factory/Factory.spec.ts +7 -6
- package/specs/factory/NoSetupRepoFactory.spec.ts +42 -52
- package/specs/factory/RefusedOAuthFactory.spec.ts +77 -44
- package/specs/factory/SshUrlNoOauthPatFactory.spec.ts +10 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2025 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
|
+
import { inject, injectable } from 'inversify';
|
|
11
|
+
import 'reflect-metadata';
|
|
12
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
13
|
+
import { DriverHelper } from '../../utils/DriverHelper';
|
|
14
|
+
import { Logger } from '../../utils/Logger';
|
|
15
|
+
import { Key } from 'selenium-webdriver';
|
|
16
|
+
|
|
17
|
+
@injectable()
|
|
18
|
+
export class SourceControlView {
|
|
19
|
+
constructor(
|
|
20
|
+
@inject(CLASSES.DriverHelper)
|
|
21
|
+
readonly driverHelper: DriverHelper
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* type the commit message and press Ctrl+Enter to commit the changes.
|
|
26
|
+
* @param textCommit Text to commit.
|
|
27
|
+
*/
|
|
28
|
+
async typeCommitMessage(textCommit: string): Promise<void> {
|
|
29
|
+
Logger.debug(`Type commit text: "Commit ${textCommit}"`);
|
|
30
|
+
|
|
31
|
+
await this.driverHelper.getDriver().actions().sendKeys(textCommit).perform();
|
|
32
|
+
Logger.debug('Press Enter to commit the changes');
|
|
33
|
+
await this.driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys(Key.ENTER).keyUp(Key.CONTROL).perform();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -31,6 +31,7 @@ import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
|
|
|
31
31
|
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
32
32
|
import { CreateWorkspace } from '../../pageobjects/dashboard/CreateWorkspace';
|
|
33
33
|
import { ViewsMoreActionsButton } from '../../pageobjects/ide/ViewsMoreActionsButton';
|
|
34
|
+
import { SourceControlView } from '../../pageobjects/ide/SourceControlView';
|
|
34
35
|
|
|
35
36
|
suite(
|
|
36
37
|
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
|
|
@@ -47,6 +48,7 @@ suite(
|
|
|
47
48
|
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
48
49
|
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
|
|
49
50
|
const viewsMoreActionsButton: ViewsMoreActionsButton = e2eContainer.get(CLASSES.ViewsMoreActionsButton);
|
|
51
|
+
const sourceControlView: SourceControlView = e2eContainer.get(CLASSES.SourceControlView);
|
|
50
52
|
|
|
51
53
|
let projectSection: ViewSection;
|
|
52
54
|
let scmProvider: SingleScmProvider;
|
|
@@ -103,8 +105,10 @@ suite(
|
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
test('Check if the project files were imported', async function (): Promise<void> {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
expect(
|
|
109
|
+
await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME),
|
|
110
|
+
'Project files were not imported'
|
|
111
|
+
).not.undefined;
|
|
108
112
|
});
|
|
109
113
|
|
|
110
114
|
test('Make changes to the file', async function (): Promise<void> {
|
|
@@ -166,10 +170,7 @@ suite(
|
|
|
166
170
|
.getDriver()
|
|
167
171
|
.findElement((webCheCodeLocators.ScmView as any).scmEditor)
|
|
168
172
|
.click();
|
|
169
|
-
|
|
170
|
-
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
|
|
171
|
-
Logger.debug('Press Enter to commit the changes');
|
|
172
|
-
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys(Key.ENTER).keyUp(Key.CONTROL).perform();
|
|
173
|
+
await sourceControlView.typeCommitMessage(changesToCommit);
|
|
173
174
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
174
175
|
await driverHelper.wait(timeToRefresh);
|
|
175
176
|
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
InputBox,
|
|
17
17
|
Key,
|
|
18
18
|
Locators,
|
|
19
|
-
ModalDialog,
|
|
20
19
|
NewScmView,
|
|
21
20
|
SingleScmProvider,
|
|
22
21
|
ViewControl,
|
|
@@ -34,12 +33,16 @@ import { DriverHelper } from '../../utils/DriverHelper';
|
|
|
34
33
|
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
35
34
|
import { Logger } from '../../utils/Logger';
|
|
36
35
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
37
|
-
import { FACTORY_TEST_CONSTANTS
|
|
38
|
-
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
36
|
+
import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
|
|
39
37
|
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
38
|
+
import { UserPreferences } from '../../pageobjects/dashboard/UserPreferences';
|
|
40
39
|
import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
|
|
41
40
|
import { CreateWorkspace } from '../../pageobjects/dashboard/CreateWorkspace';
|
|
42
41
|
import { ViewsMoreActionsButton } from '../../pageobjects/ide/ViewsMoreActionsButton';
|
|
42
|
+
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
43
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
44
|
+
import { SourceControlView } from '../../pageobjects/ide/SourceControlView';
|
|
45
|
+
import { GitHubExtensionDialog } from '../../pageobjects/ide/GitHubExtensionDialog';
|
|
43
46
|
|
|
44
47
|
suite(
|
|
45
48
|
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without PAT/OAuth setup ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
|
|
@@ -55,6 +58,9 @@ suite(
|
|
|
55
58
|
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
|
|
56
59
|
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
|
|
57
60
|
const viewsMoreActionsButton: ViewsMoreActionsButton = e2eContainer.get(CLASSES.ViewsMoreActionsButton);
|
|
61
|
+
const userPreferences: UserPreferences = e2eContainer.get(CLASSES.UserPreferences);
|
|
62
|
+
const sourceControlView: SourceControlView = e2eContainer.get(CLASSES.SourceControlView);
|
|
63
|
+
const gitHubExtensionDialog: GitHubExtensionDialog = e2eContainer.get(CLASSES.GitHubExtensionDialog);
|
|
58
64
|
|
|
59
65
|
let projectSection: ViewSection;
|
|
60
66
|
let scmProvider: SingleScmProvider;
|
|
@@ -65,15 +71,17 @@ suite(
|
|
|
65
71
|
const timeToRefresh: number = 1500;
|
|
66
72
|
const changesToCommit: string = new Date().getTime().toString();
|
|
67
73
|
const fileToChange: string = 'Date.txt';
|
|
68
|
-
const pushItemLabel: string = 'Push';
|
|
69
|
-
const commitChangesButtonLabel: string = `Commit Changes on "${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
70
74
|
const refreshButtonLabel: string = 'Refresh';
|
|
71
|
-
const
|
|
75
|
+
const pushItemLabel: string = 'Push';
|
|
72
76
|
let testRepoProjectName: string;
|
|
73
77
|
const isPrivateRepo: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
74
78
|
|
|
75
79
|
suiteSetup('Login', async function (): Promise<void> {
|
|
76
80
|
await loginTests.loginIntoChe();
|
|
81
|
+
await userPreferences.setupGitConfig(
|
|
82
|
+
FACTORY_TEST_CONSTANTS.TS_GIT_COMMIT_AUTHOR_NAME,
|
|
83
|
+
FACTORY_TEST_CONSTANTS.TS_GIT_COMMIT_AUTHOR_EMAIL
|
|
84
|
+
);
|
|
77
85
|
});
|
|
78
86
|
|
|
79
87
|
test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
|
|
@@ -123,8 +131,10 @@ suite(
|
|
|
123
131
|
});
|
|
124
132
|
|
|
125
133
|
test('Check if the project files were imported', async function (): Promise<void> {
|
|
126
|
-
expect(
|
|
127
|
-
.
|
|
134
|
+
expect(
|
|
135
|
+
await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME),
|
|
136
|
+
'Project files were not imported'
|
|
137
|
+
).not.undefined;
|
|
128
138
|
});
|
|
129
139
|
|
|
130
140
|
test('Make changes to the file', async function (): Promise<void> {
|
|
@@ -186,10 +196,7 @@ suite(
|
|
|
186
196
|
.getDriver()
|
|
187
197
|
.findElement((webCheCodeLocators.ScmView as any).scmEditor)
|
|
188
198
|
.click();
|
|
189
|
-
|
|
190
|
-
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
|
|
191
|
-
Logger.debug('Press Enter to commit the changes');
|
|
192
|
-
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys(Key.ENTER).keyUp(Key.CONTROL).perform();
|
|
199
|
+
await sourceControlView.typeCommitMessage(changesToCommit);
|
|
193
200
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
194
201
|
await driverHelper.wait(timeToRefresh);
|
|
195
202
|
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
|
|
@@ -202,60 +209,43 @@ suite(
|
|
|
202
209
|
});
|
|
203
210
|
|
|
204
211
|
test('Push the changes', async function (): Promise<void> {
|
|
205
|
-
await driverHelper.waitVisibility(
|
|
206
|
-
webCheCodeLocators.ScmView.actionConstructor(
|
|
207
|
-
`Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
|
|
208
|
-
)
|
|
209
|
-
);
|
|
212
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Notification.action);
|
|
210
213
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
211
214
|
Logger.debug('scmProvider.openMoreActions');
|
|
212
215
|
scmContextMenu = await scmProvider.openMoreActions();
|
|
213
216
|
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
214
217
|
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
215
218
|
await scmContextMenu.select(pushItemLabel);
|
|
216
|
-
});
|
|
217
219
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details);
|
|
221
|
-
const gitHaExtensionDialog: ModalDialog = new ModalDialog();
|
|
222
|
-
await gitHaExtensionDialog.pushButton('Cancel');
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
test('Insert git credentials which were asked after push', async function (): Promise<void> {
|
|
227
|
-
try {
|
|
228
|
-
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
229
|
-
} catch (e) {
|
|
230
|
-
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
231
|
-
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
|
|
232
|
-
expect(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
|
|
220
|
+
if (await gitHubExtensionDialog.isDialogVisible()) {
|
|
221
|
+
await gitHubExtensionDialog.closeDialog();
|
|
233
222
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
await
|
|
238
|
-
|
|
239
|
-
await
|
|
240
|
-
await
|
|
223
|
+
|
|
224
|
+
// wait for the user name input to appear and create an InputBox to enter the user name
|
|
225
|
+
Logger.debug('Waiting for username input to appear');
|
|
226
|
+
const inputUsername: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
|
|
227
|
+
Logger.debug(`Setting username: "${OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME}"`);
|
|
228
|
+
await inputUsername.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
229
|
+
await inputUsername.confirm();
|
|
230
|
+
|
|
231
|
+
// wait for password input to appear after username confirmation
|
|
232
|
+
Logger.debug('Waiting for password input to appear');
|
|
233
|
+
const inputPassword: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
|
|
234
|
+
Logger.debug('Setting password');
|
|
235
|
+
await inputPassword.setText(FACTORY_TEST_CONSTANTS.TS_GIT_PERSONAL_ACCESS_TOKEN);
|
|
236
|
+
await inputPassword.confirm();
|
|
241
237
|
});
|
|
242
238
|
|
|
243
239
|
test('Check if the changes were pushed', async function (): Promise<void> {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
Logger.info(
|
|
249
|
-
'Check you use correct credentials.' +
|
|
250
|
-
'For bitbucket.org ensure you use an app password: https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/;' +
|
|
251
|
-
'For github.com - personal access token instead of password.'
|
|
252
|
-
);
|
|
253
|
-
}
|
|
240
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
241
|
+
await driverHelper.wait(timeToRefresh);
|
|
242
|
+
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
|
|
243
|
+
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
|
|
254
244
|
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
|
|
255
|
-
webCheCodeLocators.
|
|
245
|
+
webCheCodeLocators.Notification.action,
|
|
256
246
|
'aria-disabled'
|
|
257
247
|
);
|
|
258
|
-
expect(isCommitButtonDisabled).to.
|
|
248
|
+
expect(isCommitButtonDisabled).to.equal('true');
|
|
259
249
|
});
|
|
260
250
|
}
|
|
261
251
|
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
InputBox,
|
|
17
17
|
Key,
|
|
18
18
|
Locators,
|
|
19
|
+
ModalDialog,
|
|
19
20
|
NewScmView,
|
|
20
21
|
SingleScmProvider,
|
|
21
22
|
ViewControl,
|
|
@@ -33,13 +34,18 @@ import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
|
|
|
33
34
|
import { StringUtil } from '../../utils/StringUtil';
|
|
34
35
|
import { Logger } from '../../utils/Logger';
|
|
35
36
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
36
|
-
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
37
37
|
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
38
|
-
import { FACTORY_TEST_CONSTANTS
|
|
38
|
+
import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
|
|
39
|
+
import { UserPreferences } from '../../pageobjects/dashboard/UserPreferences';
|
|
39
40
|
import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
|
|
40
41
|
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
41
42
|
import { CreateWorkspace } from '../../pageobjects/dashboard/CreateWorkspace';
|
|
42
43
|
import { ViewsMoreActionsButton } from '../../pageobjects/ide/ViewsMoreActionsButton';
|
|
44
|
+
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
|
|
45
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
46
|
+
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
47
|
+
import { SourceControlView } from '../../pageobjects/ide/SourceControlView';
|
|
48
|
+
import { GitHubExtensionDialog } from '../../pageobjects/ide/GitHubExtensionDialog';
|
|
43
49
|
|
|
44
50
|
suite(
|
|
45
51
|
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`,
|
|
@@ -56,6 +62,10 @@ suite(
|
|
|
56
62
|
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
57
63
|
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
|
|
58
64
|
const viewsMoreActionsButton: ViewsMoreActionsButton = e2eContainer.get(CLASSES.ViewsMoreActionsButton);
|
|
65
|
+
const userPreferences: UserPreferences = e2eContainer.get(CLASSES.UserPreferences);
|
|
66
|
+
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
|
|
67
|
+
const sourceControlView: SourceControlView = e2eContainer.get(CLASSES.SourceControlView);
|
|
68
|
+
const gitHubExtensionDialog: GitHubExtensionDialog = e2eContainer.get(CLASSES.GitHubExtensionDialog);
|
|
59
69
|
|
|
60
70
|
let projectSection: ViewSection;
|
|
61
71
|
let scmProvider: SingleScmProvider;
|
|
@@ -67,10 +77,9 @@ suite(
|
|
|
67
77
|
const timeToRefresh: number = 1500;
|
|
68
78
|
const changesToCommit: string = new Date().getTime().toString();
|
|
69
79
|
const fileToChange: string = 'Date.txt';
|
|
70
|
-
const
|
|
80
|
+
const gitCommitAuthorUnknownText: string = 'Make sure you configure your "user.name" and "user.email" in git.';
|
|
71
81
|
const refreshButtonLabel: string = 'Refresh';
|
|
72
82
|
const pushItemLabel: string = 'Push';
|
|
73
|
-
const label: string = BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
74
83
|
let testRepoProjectName: string;
|
|
75
84
|
const isPrivateRepo: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
76
85
|
|
|
@@ -129,8 +138,10 @@ suite(
|
|
|
129
138
|
});
|
|
130
139
|
|
|
131
140
|
test('Check if the project files were imported', async function (): Promise<void> {
|
|
132
|
-
expect(
|
|
133
|
-
.
|
|
141
|
+
expect(
|
|
142
|
+
await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME),
|
|
143
|
+
'Project files were not imported'
|
|
144
|
+
).not.undefined;
|
|
134
145
|
});
|
|
135
146
|
|
|
136
147
|
test('Make changes to the file', async function (): Promise<void> {
|
|
@@ -185,20 +196,51 @@ suite(
|
|
|
185
196
|
await scmContextMenu.select('Changes', 'Stage All Changes');
|
|
186
197
|
});
|
|
187
198
|
|
|
188
|
-
test('
|
|
199
|
+
test('Wait dialog message about unknown author when try to commit changes', async function (): Promise<void> {
|
|
189
200
|
Logger.info(`ScmView inputField locator: "${(webCheCodeLocators.ScmView as any).scmEditor}"`);
|
|
190
201
|
Logger.debug('Click on the Scm Editor');
|
|
191
202
|
await driverHelper
|
|
192
203
|
.getDriver()
|
|
193
204
|
.findElement((webCheCodeLocators.ScmView as any).scmEditor)
|
|
194
205
|
.click();
|
|
195
|
-
|
|
196
|
-
await driverHelper.
|
|
197
|
-
|
|
198
|
-
|
|
206
|
+
await sourceControlView.typeCommitMessage(changesToCommit);
|
|
207
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
208
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details);
|
|
209
|
+
const modalDialog: ModalDialog = new ModalDialog();
|
|
210
|
+
const messageDetails: string = await modalDialog.getDetails();
|
|
211
|
+
Logger.debug(`modalDialog.getDetails: "${messageDetails}"`);
|
|
212
|
+
expect(messageDetails).to.contain(gitCommitAuthorUnknownText);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test('Set gitconfig data in UserPreferences page', async function (): Promise<void> {
|
|
216
|
+
const currentWorkspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
|
|
217
|
+
expect(currentWorkspaceName, 'Workspace name not available').not.empty;
|
|
218
|
+
await dashboard.openDashboard();
|
|
219
|
+
await dashboard.waitPage();
|
|
220
|
+
await dashboard.stopWorkspaceByUI(currentWorkspaceName);
|
|
221
|
+
await workspaces.waitWorkspaceWithStoppedStatus(currentWorkspaceName);
|
|
222
|
+
|
|
223
|
+
await userPreferences.setupGitConfig(
|
|
224
|
+
FACTORY_TEST_CONSTANTS.TS_GIT_COMMIT_AUTHOR_NAME,
|
|
225
|
+
FACTORY_TEST_CONSTANTS.TS_GIT_COMMIT_AUTHOR_EMAIL
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('Commit changes after restart workspace by run the factory again', async function (): Promise<void> {
|
|
230
|
+
await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
|
|
231
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
232
|
+
|
|
233
|
+
await driverHelper.waitAndClick(
|
|
234
|
+
(webCheCodeLocators.ScmView as any).scmEditor,
|
|
235
|
+
TIMEOUT_CONSTANTS.TS_WAIT_LOADER_PRESENCE_TIMEOUT
|
|
236
|
+
);
|
|
237
|
+
const scmView: NewScmView = new NewScmView();
|
|
238
|
+
[scmProvider, ...rest] = await scmView.getProviders();
|
|
239
|
+
Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
|
|
240
|
+
await sourceControlView.typeCommitMessage(changesToCommit);
|
|
199
241
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
200
242
|
await driverHelper.wait(timeToRefresh);
|
|
201
|
-
Logger.debug(`
|
|
243
|
+
Logger.debug(`Wait and click on: "${refreshButtonLabel}"`);
|
|
202
244
|
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
|
|
203
245
|
// wait while changes counter will be refreshed
|
|
204
246
|
await driverHelper.wait(timeToRefresh);
|
|
@@ -208,52 +250,43 @@ suite(
|
|
|
208
250
|
});
|
|
209
251
|
|
|
210
252
|
test('Push the changes', async function (): Promise<void> {
|
|
211
|
-
await driverHelper.waitVisibility(
|
|
212
|
-
webCheCodeLocators.ScmView.actionConstructor(
|
|
213
|
-
`Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
|
|
214
|
-
)
|
|
215
|
-
);
|
|
253
|
+
await driverHelper.waitVisibility(webCheCodeLocators.Notification.action);
|
|
216
254
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
217
255
|
Logger.debug('scmProvider.openMoreActions');
|
|
218
256
|
scmContextMenu = await scmProvider.openMoreActions();
|
|
219
257
|
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
|
|
220
258
|
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
|
|
221
259
|
await scmContextMenu.select(pushItemLabel);
|
|
222
|
-
});
|
|
223
260
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
227
|
-
} catch (e) {
|
|
228
|
-
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
229
|
-
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
|
|
230
|
-
expect(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
|
|
261
|
+
if (await gitHubExtensionDialog.isDialogVisible()) {
|
|
262
|
+
await gitHubExtensionDialog.closeDialog();
|
|
231
263
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
await
|
|
236
|
-
|
|
237
|
-
await
|
|
238
|
-
await
|
|
264
|
+
|
|
265
|
+
// wait for the user name input to appear and create an InputBox to enter the user name
|
|
266
|
+
Logger.debug('Waiting for username input to appear');
|
|
267
|
+
const inputUsername: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
|
|
268
|
+
Logger.debug(`Setting username: "${OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME}"`);
|
|
269
|
+
await inputUsername.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
270
|
+
await inputUsername.confirm();
|
|
271
|
+
|
|
272
|
+
// wait for password input to appear after username confirmation
|
|
273
|
+
Logger.debug('Waiting for password input to appear');
|
|
274
|
+
const inputPassword: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
|
|
275
|
+
Logger.debug('Setting password');
|
|
276
|
+
await inputPassword.setText(FACTORY_TEST_CONSTANTS.TS_GIT_PERSONAL_ACCESS_TOKEN);
|
|
277
|
+
await inputPassword.confirm();
|
|
239
278
|
});
|
|
240
279
|
|
|
241
280
|
test('Check if the changes were pushed', async function (): Promise<void> {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
Logger.info(
|
|
247
|
-
'Check you use correct credentials.' +
|
|
248
|
-
'For bitbucket.org ensure you use an app password: https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/;' +
|
|
249
|
-
'For github.com - personal access token instead of password.'
|
|
250
|
-
);
|
|
251
|
-
}
|
|
281
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
282
|
+
await driverHelper.wait(timeToRefresh);
|
|
283
|
+
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
|
|
284
|
+
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
|
|
252
285
|
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
|
|
253
|
-
webCheCodeLocators.
|
|
286
|
+
webCheCodeLocators.Notification.action,
|
|
254
287
|
'aria-disabled'
|
|
255
288
|
);
|
|
256
|
-
expect(isCommitButtonDisabled).to.
|
|
289
|
+
expect(isCommitButtonDisabled).to.equal('true');
|
|
257
290
|
});
|
|
258
291
|
}
|
|
259
292
|
|
|
@@ -36,6 +36,8 @@ suite(`The SshUrlNoOauthPatFactory userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONM
|
|
|
36
36
|
const factoryUrl: string =
|
|
37
37
|
FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL ||
|
|
38
38
|
'ssh://git@bitbucket-ssh.apps.ds-airgap2-v15.crw-qe.com/~admin/private-bb-repo.git';
|
|
39
|
+
const privateSshKey: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_SSH_PRIVATE_KEY;
|
|
40
|
+
const publicSshKey: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_SSH_PUBLIC_KEY;
|
|
39
41
|
const privateSshKeyPath: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_SSH_PRIVATE_KEY_PATH;
|
|
40
42
|
const publicSshKeyPath: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_SSH_PUBLIC_KEY_PATH;
|
|
41
43
|
let projectSection: ViewSection;
|
|
@@ -57,7 +59,14 @@ suite(`The SshUrlNoOauthPatFactory userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONM
|
|
|
57
59
|
test('Add SSH keys', async function (): Promise<void> {
|
|
58
60
|
await userPreferences.openUserPreferencesPage();
|
|
59
61
|
await userPreferences.openSshKeyTab();
|
|
60
|
-
|
|
62
|
+
// use environment variables if available, otherwise fall back to file paths
|
|
63
|
+
if (privateSshKey && publicSshKey) {
|
|
64
|
+
Logger.info('Using SSH keys from environment variables');
|
|
65
|
+
await userPreferences.addSshKeysFromStrings(privateSshKey, publicSshKey);
|
|
66
|
+
} else {
|
|
67
|
+
Logger.info('Using SSH keys from file paths');
|
|
68
|
+
await userPreferences.addSshKeysFromFiles(privateSshKeyPath, publicSshKeyPath);
|
|
69
|
+
}
|
|
61
70
|
});
|
|
62
71
|
test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
|
|
63
72
|
await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
|