@eclipse-che/che-e2e 7.64.0-dev-20514b2 → 7.64.0-dev-f0466d9
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 +5 -35
- package/configs/mocharc.ts +9 -3
- package/configs/sh-scripts/initDefaultValues.sh +0 -5
- package/constants/TestConstants.ts +35 -97
- package/constants/TimeoutConstants.ts +1 -1
- 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/constants/TimeoutConstants.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 +8 -16
- 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/SmokeTest.spec.js +49 -0
- package/dist/specs/SmokeTest.spec.js.map +1 -0
- 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 +15 -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/CheReporter.js +5 -2
- package/dist/utils/CheReporter.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/ScreenCatcher.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/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/vsc/GitUtil.js +36 -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 +3 -193
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +3 -3
- package/index.ts +37 -0
- package/package.json +9 -5
- package/pageobjects/dashboard/CreateWorkspace.ts +10 -21
- package/pageobjects/dashboard/Dashboard.ts +37 -16
- package/pageobjects/dashboard/Workspaces.ts +21 -23
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +16 -16
- 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/OcpUserLoginPage.ts +1 -1
- package/pageobjects/login/RedHatLoginPage.ts +62 -0
- package/pageobjects/login/RegularUserOcpCheLoginPage.ts +2 -21
- package/pageobjects/openshift/CheLoginPage.ts +8 -57
- package/pageobjects/openshift/OcpLoginPage.ts +8 -29
- package/specs/MochaHooks.ts +9 -9
- package/specs/SmokeTest.spec.ts +50 -0
- 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 +16 -7
- package/tslint.json +4 -4
- package/utils/BrowserTabsUtil.ts +9 -31
- package/utils/CheReporter.ts +12 -8
- package/utils/DriverHelper.ts +40 -115
- package/utils/Logger.ts +13 -8
- package/utils/Sanitizer.ts +0 -1
- package/utils/ScreenCatcher.ts +8 -7
- package/utils/request-handlers/CheApiRequestHandler.ts +1 -1
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +2 -1
- package/utils/vsc/GitUtil.ts +25 -0
- package/utils/workspace/ApiUrlResolver.ts +3 -6
- package/utils/workspace/ITestWorkspaceUtil.ts +1 -56
- package/utils/workspace/TestWorkspaceUtil.ts +24 -265
- 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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<classpath>
|
|
3
|
-
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
4
|
-
<attributes>
|
|
5
|
-
<attribute name="optional" value="true"/>
|
|
6
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
7
|
-
</attributes>
|
|
8
|
-
</classpathentry>
|
|
9
|
-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
10
|
-
<attributes>
|
|
11
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
12
|
-
</attributes>
|
|
13
|
-
</classpathentry>
|
|
14
|
-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
15
|
-
<attributes>
|
|
16
|
-
<attribute name="optional" value="true"/>
|
|
17
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
18
|
-
<attribute name="test" value="true"/>
|
|
19
|
-
</attributes>
|
|
20
|
-
</classpathentry>
|
|
21
|
-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
22
|
-
<attributes>
|
|
23
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
24
|
-
</attributes>
|
|
25
|
-
</classpathentry>
|
|
26
|
-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
27
|
-
<attributes>
|
|
28
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
29
|
-
</attributes>
|
|
30
|
-
</classpathentry>
|
|
31
|
-
<classpathentry kind="src" path="target/generated-sources/annotations">
|
|
32
|
-
<attributes>
|
|
33
|
-
<attribute name="optional" value="true"/>
|
|
34
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
35
|
-
<attribute name="ignore_optional_problems" value="true"/>
|
|
36
|
-
<attribute name="m2e-apt" value="true"/>
|
|
37
|
-
</attributes>
|
|
38
|
-
</classpathentry>
|
|
39
|
-
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
|
40
|
-
<attributes>
|
|
41
|
-
<attribute name="optional" value="true"/>
|
|
42
|
-
<attribute name="maven.pomderived" value="true"/>
|
|
43
|
-
<attribute name="ignore_optional_problems" value="true"/>
|
|
44
|
-
<attribute name="m2e-apt" value="true"/>
|
|
45
|
-
<attribute name="test" value="true"/>
|
|
46
|
-
</attributes>
|
|
47
|
-
</classpathentry>
|
|
48
|
-
<classpathentry kind="output" path="target/classes"/>
|
|
49
|
-
</classpath>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
import { DriverHelper } from '../../../utils/DriverHelper';
|
|
11
|
-
import { injectable, inject } from 'inversify';
|
|
12
|
-
import 'reflect-metadata';
|
|
13
|
-
import { CLASSES, TYPES } from '../../../configs/inversify.types';
|
|
14
|
-
import { By } from 'selenium-webdriver';
|
|
15
|
-
import { WorkspaceDetails } from './WorkspaceDetails';
|
|
16
|
-
import { WorkspaceStatus } from '../../../utils/workspace/WorkspaceStatus';
|
|
17
|
-
import { Logger } from '../../../utils/Logger';
|
|
18
|
-
import { TimeoutConstants } from '../../../constants/TimeoutConstants';
|
|
19
|
-
import { ITestWorkspaceUtil } from '../../../utils/workspace/ITestWorkspaceUtil';
|
|
20
|
-
|
|
21
|
-
@injectable()
|
|
22
|
-
export class WorkspaceDetailsPlugins {
|
|
23
|
-
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
24
|
-
@inject(CLASSES.WorkspaceDetails) private readonly workspaceDetails: WorkspaceDetails,
|
|
25
|
-
@inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil) { }
|
|
26
|
-
|
|
27
|
-
async waitPluginListItem(pluginName: string) {
|
|
28
|
-
Logger.debug(`WorkspaceDetailsPlugins.waitPluginListItem ${pluginName}`);
|
|
29
|
-
|
|
30
|
-
const pluginListItemLocator: By = By.css(this.getPluginListItemCssLocator(pluginName));
|
|
31
|
-
|
|
32
|
-
await this.driverHelper.waitVisibility(pluginListItemLocator, TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async enablePlugin(pluginName: string, pluginVersion?: string) {
|
|
36
|
-
Logger.debug(`WorkspaceDetailsPlugins.enablePlugin ${pluginName}:${pluginVersion}`);
|
|
37
|
-
|
|
38
|
-
await this.waitPluginDisabling(pluginName, pluginVersion);
|
|
39
|
-
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion);
|
|
40
|
-
await this.waitPluginEnabling(pluginName, pluginVersion);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async disablePlugin(pluginName: string, pluginVersion?: string) {
|
|
44
|
-
Logger.debug(`WorkspaceDetailsPlugins.disablePlugin ${pluginName}:${pluginVersion}`);
|
|
45
|
-
|
|
46
|
-
await this.waitPluginEnabling(pluginName, pluginVersion);
|
|
47
|
-
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion);
|
|
48
|
-
await this.waitPluginDisabling(pluginName, pluginVersion);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async addPluginAndOpenWorkspace(namespace: string, workspaceName: string, pluginName: string, pluginId: string, pluginVersion?: string) {
|
|
52
|
-
Logger.debug(`WorkspaceDetailsPlugins.addPluginAndOpenWorkspace ${namespace}/${workspaceName} plugin: ${pluginName}:${pluginVersion}`);
|
|
53
|
-
|
|
54
|
-
await this.workspaceDetails.selectTab('Plugins');
|
|
55
|
-
await this.enablePlugin(pluginName, pluginVersion);
|
|
56
|
-
await this.workspaceDetails.saveChanges();
|
|
57
|
-
await this.workspaceDetails.openWorkspace(namespace, workspaceName);
|
|
58
|
-
await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.RUNNING);
|
|
59
|
-
await this.testWorkspaceUtil.waitPluginAdding(namespace, workspaceName, pluginId);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private getPluginListItemCssLocator(pluginName: string, pluginVersion?: string): string {
|
|
63
|
-
if (pluginVersion) {
|
|
64
|
-
return `.plugin-item div[plugin-item-name*='${pluginName}'][plugin-item-version='${pluginVersion}']`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return `.plugin-item div[plugin-item-name*='${pluginName}']`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private getPluginListItemSwitcherCssLocator(pluginName: string, pluginVersion?: string): string {
|
|
71
|
-
return `${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private async clickOnPluginListItemSwitcher(pluginName: string,
|
|
75
|
-
pluginVersion?: string,
|
|
76
|
-
timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
|
|
77
|
-
|
|
78
|
-
const pluginListItemSwitcherLocator = By.css(this.getPluginListItemSwitcherCssLocator(pluginName, pluginVersion));
|
|
79
|
-
|
|
80
|
-
await this.driverHelper.waitAndClick(pluginListItemSwitcherLocator, timeout);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private async waitPluginEnabling(pluginName: string, pluginVersion?: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
|
|
84
|
-
const enabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='true']`);
|
|
85
|
-
|
|
86
|
-
await this.driverHelper.waitVisibility(enabledPluginSwitcherLocator, timeout);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private async waitPluginDisabling(pluginName: string, pluginVersion?: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
|
|
90
|
-
const disabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='false']`);
|
|
91
|
-
|
|
92
|
-
await this.driverHelper.waitVisibility(disabledPluginSwitcherLocator, timeout);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
import 'reflect-metadata';
|
|
11
|
-
import { ICheLoginPage } from './ICheLoginPage';
|
|
12
|
-
import { CheLoginPage } from '../openshift/CheLoginPage';
|
|
13
|
-
import { injectable, inject } from 'inversify';
|
|
14
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
15
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
16
|
-
import { Logger } from '../../utils/Logger';
|
|
17
|
-
|
|
18
|
-
@injectable()
|
|
19
|
-
export class MultiUserLoginPage implements ICheLoginPage {
|
|
20
|
-
|
|
21
|
-
constructor(
|
|
22
|
-
@inject(CLASSES.CheLoginPage) private readonly cheLogin: CheLoginPage) { }
|
|
23
|
-
|
|
24
|
-
async login() {
|
|
25
|
-
Logger.debug('MultiUserLoginPage.login');
|
|
26
|
-
|
|
27
|
-
await this.cheLogin.waitEclipseCheLoginFormPage();
|
|
28
|
-
await this.cheLogin.inputUserNameEclipseCheLoginPage(TestConstants.TS_SELENIUM_USERNAME);
|
|
29
|
-
await this.cheLogin.inputPaswordEclipseCheLoginPage(TestConstants.TS_SELENIUM_PASSWORD);
|
|
30
|
-
await this.cheLogin.clickEclipseCheLoginButton();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
import 'reflect-metadata';
|
|
11
|
-
import { injectable, inject } from 'inversify';
|
|
12
|
-
import { Logger } from '../../utils/Logger';
|
|
13
|
-
import { DriverHelper } from '../../utils/DriverHelper';
|
|
14
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
15
|
-
import { By } from 'selenium-webdriver';
|
|
16
|
-
|
|
17
|
-
@injectable()
|
|
18
|
-
export class UpdateAccountInformationPage {
|
|
19
|
-
|
|
20
|
-
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
21
|
-
|
|
22
|
-
async enterEmail(email: string, timeout: number) {
|
|
23
|
-
Logger.debug('UpdateAccountInformationPage.enterEmail');
|
|
24
|
-
|
|
25
|
-
await this.driverHelper.enterValue(By.id('email'), email, timeout);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async enterFirstName(firstName: string, timeout: number) {
|
|
29
|
-
Logger.debug('UpdateAccountInformationPage.enterFirstName');
|
|
30
|
-
|
|
31
|
-
await this.driverHelper.enterValue(By.id('firstName'), firstName, timeout);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async enterLastName(lastName: string, timeout: number) {
|
|
35
|
-
Logger.debug('UpdateAccountInformationPage.enterLastName');
|
|
36
|
-
|
|
37
|
-
await this.driverHelper.enterValue(By.id('lastName'), lastName, timeout);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async clickConfirmButton(timeout: number) {
|
|
41
|
-
Logger.debug('UpdateAccountInformationPage.clickConfirmButton');
|
|
42
|
-
|
|
43
|
-
await this.driverHelper.waitAndClick(By.xpath('//input[@type=\'submit\']'), timeout);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async clickAddToExistingAccountButton(timeout: number) {
|
|
47
|
-
Logger.debug('UpdateAccountInformationPage.clickAddToExistingAccountButton');
|
|
48
|
-
|
|
49
|
-
await this.driverHelper.waitAndClick(By.id('linkAccount'), timeout);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async enterPassword(password: string, timeout: number) {
|
|
53
|
-
Logger.debug('UpdateAccountInformationPage.enterPassword');
|
|
54
|
-
|
|
55
|
-
await this.driverHelper.enterValue(By.id('password'), password, timeout);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async clickLogInButton(timeout: number) {
|
|
59
|
-
Logger.debug('UpdateAccountInformationPage.clickLogInButton');
|
|
60
|
-
|
|
61
|
-
await this.driverHelper.waitAndClick(By.id('kc-login'), timeout);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async clickToAllowSelectedPermissionsButton(timeout: number) {
|
|
65
|
-
Logger.debug('UpdateAccountInformationPage.clickToAllowSelectedPermissionsButton');
|
|
66
|
-
|
|
67
|
-
await this.driverHelper.waitAndClick(By.xpath('//input[@name=\'approve\']'), timeout);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2021-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
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
import 'reflect-metadata';
|
|
12
|
-
import { injectable, inject } from 'inversify';
|
|
13
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
14
|
-
import { DriverHelper } from '../../utils/DriverHelper';
|
|
15
|
-
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
16
|
-
import { Logger } from '../../utils/Logger';
|
|
17
|
-
import { By } from 'selenium-webdriver';
|
|
18
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class GitLoginPage {
|
|
22
|
-
private static readonly USERNAME_FIELD_LOCATOR = By.xpath(`//input[@id='login_field']`);
|
|
23
|
-
private static readonly PASSWORD_FIELD_LOCATOR = By.xpath(`//input[@id='password']`);
|
|
24
|
-
private static readonly SIGN_IN_BUTTON_LOCATOR = By.xpath(`//input[@value='Sign in']`);
|
|
25
|
-
|
|
26
|
-
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
27
|
-
|
|
28
|
-
async login(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
29
|
-
Logger.debug('GitLoginPage.login');
|
|
30
|
-
|
|
31
|
-
await this.waitPage(timeout);
|
|
32
|
-
await this.typeUsername(TestConstants.TS_GITHUB_USERNAME, timeout);
|
|
33
|
-
await this.typePassword(TestConstants.TS_GITHUB_PASSWORD, timeout);
|
|
34
|
-
await this.clickSignInButton(timeout);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async waitPage(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
38
|
-
Logger.debug('GitLoginPage.waitPage');
|
|
39
|
-
|
|
40
|
-
await this.waitUsernameField(timeout);
|
|
41
|
-
await this.waitPasswordField(timeout);
|
|
42
|
-
await this.waitSignInButton(timeout);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async waitUsernameField(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
46
|
-
Logger.debug('GitLoginPage.waitUsernameField');
|
|
47
|
-
|
|
48
|
-
await this.driverHelper.waitVisibility(GitLoginPage.USERNAME_FIELD_LOCATOR, timeout);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async waitPasswordField(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
52
|
-
Logger.debug('GitLoginPage.waitPasswordField');
|
|
53
|
-
|
|
54
|
-
await this.driverHelper.waitVisibility(GitLoginPage.PASSWORD_FIELD_LOCATOR, timeout);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async waitSignInButton(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
58
|
-
Logger.debug('GitLoginPage.waitSignInbutton');
|
|
59
|
-
|
|
60
|
-
await this.driverHelper.waitVisibility(GitLoginPage.SIGN_IN_BUTTON_LOCATOR, timeout);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async typeUsername(username: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
64
|
-
Logger.debug('GitLoginPage.typeUsername');
|
|
65
|
-
|
|
66
|
-
await this.driverHelper.type(GitLoginPage.USERNAME_FIELD_LOCATOR, username, timeout);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async typePassword(password: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
70
|
-
Logger.debug('GitLoginPage.typePassword');
|
|
71
|
-
|
|
72
|
-
await this.driverHelper.type(GitLoginPage.PASSWORD_FIELD_LOCATOR, password, timeout);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async clickSignInButton(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
76
|
-
Logger.debug('GitLoginPage.clickSignInButton');
|
|
77
|
-
|
|
78
|
-
await this.driverHelper.waitAndClick(GitLoginPage.SIGN_IN_BUTTON_LOCATOR, timeout);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2021-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
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
import 'reflect-metadata';
|
|
12
|
-
import { injectable, inject } from 'inversify';
|
|
13
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
14
|
-
import { DriverHelper } from '../../utils/DriverHelper';
|
|
15
|
-
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
16
|
-
import { Logger } from '../../utils/Logger';
|
|
17
|
-
import { By, error, Key } from 'selenium-webdriver';
|
|
18
|
-
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class GitOauthAppsSettings {
|
|
22
|
-
private static readonly GITHUB_OAUTH_APPS_SETTINGS_URL = 'https://github.com/settings/developers';
|
|
23
|
-
private static readonly HOME_PAGE_FIELD_LOCATOR: By = By.xpath(`//input[@id='oauth_application_url']`);
|
|
24
|
-
private static readonly CALLBACK_URL_FIELD_LOCATOR: By = By.xpath(`//input[@id='oauth_application_callback_url']`);
|
|
25
|
-
private static readonly UPDATE_APPLICATION_BUTTON_LOCATOR: By = By.xpath(`//form[@class='edit_oauth_application']//button[@type='submit']`);
|
|
26
|
-
|
|
27
|
-
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
28
|
-
@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) { }
|
|
29
|
-
|
|
30
|
-
async openPage(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
31
|
-
Logger.debug('GitOauthAppsSettings.openPage');
|
|
32
|
-
|
|
33
|
-
await this.browserTabsUtil.navigateTo(GitOauthAppsSettings.GITHUB_OAUTH_APPS_SETTINGS_URL);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async waitTitle(title: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
37
|
-
Logger.debug('GitOauthAppsSettings.waitTitle');
|
|
38
|
-
|
|
39
|
-
await this.driverHelper.waitVisibility(this.getTitleLocator(title), timeout);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async waitOauthApp(applicationTitle: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
43
|
-
Logger.debug('GitOauthAppsSettings.waitOauthApp');
|
|
44
|
-
|
|
45
|
-
await this.driverHelper.waitVisibility(this.getOauthAppLocator(applicationTitle), timeout);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async clickOauthApp(applicationTitle: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
49
|
-
Logger.debug('GitOauthAppsSettings.clickOauthApp');
|
|
50
|
-
|
|
51
|
-
await this.driverHelper.waitAndClick(this.getOauthAppLocator(applicationTitle), timeout);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async openOauthApp(title: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
55
|
-
Logger.debug('GitOauthAppsSettings.openOauthApp');
|
|
56
|
-
|
|
57
|
-
await this.driverHelper.waitUntilTrue(async () => {
|
|
58
|
-
await this.clickOauthApp(title);
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
await this.waitTitle(title, timeout / 3);
|
|
62
|
-
return true;
|
|
63
|
-
} catch (err) {
|
|
64
|
-
if (!(err instanceof error.TimeoutError)) {
|
|
65
|
-
throw err;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Logger.debug(`The ${title} oAuth app is not opened, next try.`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}, timeout);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async scrollToUpdateApplicationButton(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
75
|
-
Logger.debug('GitOauthAppsSettings.scrollToUpdateApplicationButton');
|
|
76
|
-
|
|
77
|
-
await this.driverHelper.scrollTo(GitOauthAppsSettings.UPDATE_APPLICATION_BUTTON_LOCATOR, timeout);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async typeHomePageUrl(homePageUrl: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
81
|
-
Logger.debug('GitOauthAppsSettings.typeHomePageUrl');
|
|
82
|
-
|
|
83
|
-
await this.driverHelper.type(GitOauthAppsSettings.HOME_PAGE_FIELD_LOCATOR, Key.chord(Key.CONTROL, 'a'), timeout);
|
|
84
|
-
await this.driverHelper.type(GitOauthAppsSettings.HOME_PAGE_FIELD_LOCATOR, Key.DELETE, timeout);
|
|
85
|
-
await this.driverHelper.type(GitOauthAppsSettings.HOME_PAGE_FIELD_LOCATOR, homePageUrl, timeout);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async typeCallbackUrl(callbackUrl: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
89
|
-
Logger.debug('GitOauthAppsSettings.typeCallbackUrl');
|
|
90
|
-
|
|
91
|
-
await this.driverHelper.type(GitOauthAppsSettings.CALLBACK_URL_FIELD_LOCATOR, Key.chord(Key.CONTROL, 'a'), timeout);
|
|
92
|
-
await this.driverHelper.type(GitOauthAppsSettings.CALLBACK_URL_FIELD_LOCATOR, Key.DELETE, timeout);
|
|
93
|
-
await this.driverHelper.type(GitOauthAppsSettings.CALLBACK_URL_FIELD_LOCATOR, callbackUrl, timeout);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async clickUpdateApplicationButton(timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
97
|
-
Logger.debug('GitOauthAppsSettings.clickUpdateApplicationButton');
|
|
98
|
-
|
|
99
|
-
await this.driverHelper.waitAndClick(GitOauthAppsSettings.UPDATE_APPLICATION_BUTTON_LOCATOR, timeout);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private getOauthAppLocator(applicationTitle: string, timeout: number = TimeoutConstants.TS_COMMON_PLUGIN_TEST_TIMEOUT) {
|
|
103
|
-
return By.xpath(`//div[@class='TableObject']//a[text()='${applicationTitle}']`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private getTitleLocator(title: string): By {
|
|
107
|
-
return By.xpath(`//main[@id='js-pjax-container']//h2[text()='${title}']`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
import { CLASSES, TYPES } from '../../configs/inversify.types';
|
|
12
|
-
import { e2eContainer } from '../../configs/inversify.config';
|
|
13
|
-
import { IOcpLoginPage } from '../../pageobjects/login/IOcpLoginPage';
|
|
14
|
-
import { UpdateAccountInformationPage } from '../../pageobjects/login/UpdateAccountInformationPage';
|
|
15
|
-
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
16
|
-
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
17
|
-
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
18
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
19
|
-
|
|
20
|
-
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
21
|
-
const ocpLogin: IOcpLoginPage = e2eContainer.get<IOcpLoginPage>(TYPES.OcpLogin);
|
|
22
|
-
const updateAccountInformation: UpdateAccountInformationPage = e2eContainer.get(CLASSES.UpdateAccountInformationPage);
|
|
23
|
-
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
24
|
-
|
|
25
|
-
const commonTimeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT * 2;
|
|
26
|
-
|
|
27
|
-
suite('Link users', async () => {
|
|
28
|
-
test('Login to OCP', async () => {
|
|
29
|
-
await browserTabsUtil.navigateTo(TestConstants.TS_SELENIUM_BASE_URL);
|
|
30
|
-
|
|
31
|
-
await ocpLogin.login();
|
|
32
|
-
await updateAccountInformation.clickToAllowSelectedPermissionsButton(commonTimeout);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('Update account information', async () => {
|
|
36
|
-
await updateAccountInformation.enterEmail('admin@admin.com', commonTimeout);
|
|
37
|
-
await updateAccountInformation.enterFirstName(TestConstants.TS_SELENIUM_USERNAME, commonTimeout);
|
|
38
|
-
await updateAccountInformation.enterLastName(TestConstants.TS_SELENIUM_USERNAME, commonTimeout);
|
|
39
|
-
await updateAccountInformation.clickConfirmButton(commonTimeout);
|
|
40
|
-
await updateAccountInformation.clickAddToExistingAccountButton(commonTimeout);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('Login to Che', async () => {
|
|
44
|
-
await updateAccountInformation.enterPassword(TestConstants.TS_SELENIUM_PASSWORD, commonTimeout);
|
|
45
|
-
await updateAccountInformation.clickLogInButton(commonTimeout);
|
|
46
|
-
await dashboard.waitPage(commonTimeout);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
import { CLASSES } from '../configs/inversify.types';
|
|
12
|
-
import { inject, injectable } from 'inversify';
|
|
13
|
-
import { BrowserTabsUtil } from './BrowserTabsUtil';
|
|
14
|
-
import { Logger } from './Logger';
|
|
15
|
-
|
|
16
|
-
@injectable()
|
|
17
|
-
export class WorkspaceNameHandler {
|
|
18
|
-
|
|
19
|
-
constructor(@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) {}
|
|
20
|
-
|
|
21
|
-
public generateWorkspaceName(prefix: string, randomLength: number): string {
|
|
22
|
-
const possibleCharacters: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
23
|
-
const possibleCharactersLength: number = possibleCharacters.length;
|
|
24
|
-
let randomPart: string = '';
|
|
25
|
-
Logger.debug('WorkspaceNameHandler.generateWorkspaceName');
|
|
26
|
-
|
|
27
|
-
for (let i = 0; i < randomLength; i++) {
|
|
28
|
-
let currentRandomIndex: number = Math.floor(Math.random() * Math.floor(possibleCharactersLength));
|
|
29
|
-
|
|
30
|
-
randomPart += possibleCharacters[currentRandomIndex];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return prefix + randomPart;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public async getNameFromUrl(): Promise<string> {
|
|
37
|
-
let workspaceUrl: string = await this.browserTabsUtil.getCurrentUrl();
|
|
38
|
-
Logger.debug(`WorkspaceNameHandler.fromWorkspaceUrl workspaceUrl: ${workspaceUrl}`);
|
|
39
|
-
|
|
40
|
-
const workspaceUrlParts: string[] = workspaceUrl.split('/');
|
|
41
|
-
const workspaceNameQueryString: string = workspaceUrlParts[workspaceUrlParts.length - 1];
|
|
42
|
-
const workspaceName: string = workspaceNameQueryString.split('?')[0];
|
|
43
|
-
|
|
44
|
-
Logger.debug(`workspaceName: ${workspaceName}`);
|
|
45
|
-
|
|
46
|
-
return workspaceName;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
import axios from 'axios';
|
|
11
|
-
import querystring from 'querystring';
|
|
12
|
-
import { injectable } from 'inversify';
|
|
13
|
-
import { TestConstants } from '../../../constants/TestConstants';
|
|
14
|
-
import { ITokenHandler } from './ITokenHandler';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@injectable()
|
|
18
|
-
export class CheMultiuserTokenHandler implements ITokenHandler {
|
|
19
|
-
async get(): Promise<string> {
|
|
20
|
-
// to-do: Login to the che-dashboard and fetch the authorization related info
|
|
21
|
-
const keycloakUrl = '';
|
|
22
|
-
|
|
23
|
-
const params = {
|
|
24
|
-
client_id: 'che-public',
|
|
25
|
-
username: TestConstants.TS_SELENIUM_USERNAME,
|
|
26
|
-
password: TestConstants.TS_SELENIUM_PASSWORD,
|
|
27
|
-
grant_type: 'password',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
const responseToObtainBearerToken = await axios.post(
|
|
32
|
-
keycloakUrl,
|
|
33
|
-
querystring.stringify(params)
|
|
34
|
-
);
|
|
35
|
-
return responseToObtainBearerToken.data.access_token;
|
|
36
|
-
} catch (err) {
|
|
37
|
-
console.log(`Can not get bearer token. URL used: ${keycloakUrl}`);
|
|
38
|
-
throw err;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019-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
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export interface ITokenHandler {
|
|
13
|
-
get(): Promise<string>;
|
|
14
|
-
}
|
package/utils/vsc/CheGitApi.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { injectable, inject } from 'inversify';
|
|
2
|
-
import { CLASSES } from '../../configs/inversify.types';
|
|
3
|
-
import { CheApiRequestHandler } from '../request-handlers/CheApiRequestHandler';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@injectable()
|
|
7
|
-
export class CheGitApi {
|
|
8
|
-
static readonly GIT_API_ENTRIPOINT_URL = 'api/ssh/vcs';
|
|
9
|
-
|
|
10
|
-
constructor(@inject(CLASSES.CheApiRequestHandler) private readonly processRequestHandler: CheApiRequestHandler) { }
|
|
11
|
-
|
|
12
|
-
public async getPublicSSHKey(): Promise<string> {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const responce = await this.processRequestHandler.get(CheGitApi.GIT_API_ENTRIPOINT_URL);
|
|
16
|
-
return responce.data[0].publicKey;
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error('Cannot get public ssh key with API \n' + error);
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|