@eclipse-che/che-e2e 7.66.0-dev-5e8a484 → 7.66.0-dev-37c09e5
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 +10 -4
- package/configs/inversify.types.ts +3 -0
- package/dist/configs/inversify.config.js +7 -3
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +3 -0
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +60 -0
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -0
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +91 -0
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -0
- package/dist/pageobjects/openshift/OcpLoginPage.js +3 -3
- package/dist/pageobjects/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +91 -0
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -0
- package/dist/specs/api/ContainerOverridesAPI.spec.js +36 -0
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -0
- package/dist/specs/api/PodOverridesAPI.spec.js +42 -0
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -0
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js +1 -1
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +74 -0
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -0
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +19 -11
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +3 -0
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +5 -1
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/DriverHelper.js +29 -3
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +49 -4
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/ShellExecutor.js +3 -0
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/index.ts +3 -0
- package/package.json +3 -2
- package/pageobjects/openshift/OcpApplicationPage.ts +42 -0
- package/pageobjects/openshift/OcpImportFromGitPage.ts +87 -0
- package/pageobjects/openshift/OcpLoginPage.ts +3 -3
- package/pageobjects/openshift/OcpMainPage.ts +87 -0
- package/resources/container-overrides.yaml +28 -0
- package/resources/pod-overrides.yaml +37 -0
- package/specs/api/ContainerOverridesAPI.spec.ts +37 -0
- package/specs/api/PodOverridesAPI.spec.ts +43 -0
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +1 -1
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +97 -0
- package/specs/factory/Factory.spec.ts +1 -1
- package/specs/factory/NoSetupRepoFactory.spec.ts +1 -1
- package/specs/factory/RefusedOAuthFactory.spec.ts +1 -1
- package/tests-library/LoginTests.ts +17 -8
- package/tests-library/ProjectAndFileTests.ts +3 -0
- package/utils/BrowserTabsUtil.ts +5 -3
- package/utils/DriverHelper.ts +36 -4
- package/utils/KubernetesCommandLineToolsExecutor.ts +36 -5
- package/utils/ShellExecutor.ts +4 -0
package/utils/DriverHelper.ts
CHANGED
|
@@ -48,6 +48,12 @@ export class DriverHelper {
|
|
|
48
48
|
await this.driver.sleep(milliseconds);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
public async refreshPage(): Promise<void> {
|
|
52
|
+
Logger.trace(`DriverHelper.refreshPage`);
|
|
53
|
+
|
|
54
|
+
await this.driver.navigate().refresh();
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
public async waitVisibilityBoolean(locator: By,
|
|
52
58
|
attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
|
|
53
59
|
polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<boolean> {
|
|
@@ -273,12 +279,27 @@ export class DriverHelper {
|
|
|
273
279
|
await element.click();
|
|
274
280
|
return;
|
|
275
281
|
} catch (err) {
|
|
276
|
-
|
|
277
|
-
|
|
282
|
+
function isElementClickInterceptedOnLastAttempt(err: Error, i: number): boolean {
|
|
283
|
+
return err instanceof error.ElementClickInterceptedError && i === attempts - 1;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (err instanceof error.StaleElementReferenceError || err instanceof error.ElementClickInterceptedError) {
|
|
287
|
+
Logger.debug(`DriverHelper.waitAndClick - ${elementLocator} - ${err}`);
|
|
278
288
|
await this.wait(polling);
|
|
279
289
|
continue;
|
|
280
290
|
}
|
|
281
291
|
|
|
292
|
+
if (isElementClickInterceptedOnLastAttempt(err, i)) {
|
|
293
|
+
Logger.debug(`DriverHelper.waitAndClick - Element is not clickable, try to perform pointer click`);
|
|
294
|
+
await this.getAction()
|
|
295
|
+
.move({
|
|
296
|
+
origin: await this.waitPresence(elementLocator)
|
|
297
|
+
})
|
|
298
|
+
.click()
|
|
299
|
+
.perform();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
282
303
|
Logger.error(`DriverHelper.waitAndClick - failed with an unexpected exception - ${err}`);
|
|
283
304
|
throw err;
|
|
284
305
|
}
|
|
@@ -658,7 +679,8 @@ export class DriverHelper {
|
|
|
658
679
|
}
|
|
659
680
|
|
|
660
681
|
try {
|
|
661
|
-
await this.
|
|
682
|
+
await this.getDriver()
|
|
683
|
+
.executeScript('arguments[0].scrollIntoView(true);', element);
|
|
662
684
|
return;
|
|
663
685
|
} catch (err) {
|
|
664
686
|
if (err instanceof error.StaleElementReferenceError) {
|
|
@@ -674,7 +696,17 @@ export class DriverHelper {
|
|
|
674
696
|
throw new error.TimeoutError(`Exceeded maximum mouse move attempts, for the '${elementLocator}' element`);
|
|
675
697
|
}
|
|
676
698
|
|
|
677
|
-
|
|
699
|
+
public async scrollToAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
700
|
+
await this.scrollTo(elementLocator, timeout);
|
|
701
|
+
await this.waitAndClick(elementLocator, timeout);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
public async scrollToAndEnterValue(elementLocator: By, value: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
705
|
+
await this.scrollTo(elementLocator, timeout);
|
|
706
|
+
await this.enterValue(elementLocator, value, timeout);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
getDriver(): ThenableWebDriver {
|
|
678
710
|
Logger.trace('DriverHelper.getDriver');
|
|
679
711
|
|
|
680
712
|
return this.driver;
|
|
@@ -2,6 +2,7 @@ import { echo, exec, ShellString } from 'shelljs';
|
|
|
2
2
|
import { KubernetesCommandLineTool, TestConstants } from '../constants/TestConstants';
|
|
3
3
|
import { Logger } from './Logger';
|
|
4
4
|
import { ShellExecutor } from './ShellExecutor';
|
|
5
|
+
import * as path from 'path';
|
|
5
6
|
|
|
6
7
|
export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
7
8
|
private static container: string;
|
|
@@ -27,11 +28,14 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
27
28
|
// login to Openshift cluster with username and password
|
|
28
29
|
loginToOcp(): void {
|
|
29
30
|
if (this.KUBERNETES_COMMAND_LINE_TOOL === KubernetesCommandLineTool.OC) {
|
|
30
|
-
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: Login to the "OC" client
|
|
31
|
+
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: Login to the "OC" client.`);
|
|
31
32
|
const url: string = this.getServerUrl();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (this.isUserLoggedIn()) {
|
|
34
|
+
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: User already logged`);
|
|
35
|
+
} else {
|
|
36
|
+
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: Login ${url}, ${TestConstants.TS_SELENIUM_OCP_USERNAME}`);
|
|
37
|
+
exec(`oc login --server=${url} -u=${TestConstants.TS_SELENIUM_OCP_USERNAME} -p=${TestConstants.TS_SELENIUM_OCP_PASSWORD} --insecure-skip-tls-verify`);
|
|
38
|
+
}
|
|
35
39
|
} else {
|
|
36
40
|
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: doesn't support login command`);
|
|
37
41
|
}
|
|
@@ -54,6 +58,7 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
54
58
|
Logger.debug(`${this.getLoggingName(this.deleteDevWorkspace.name)}: Delete '${this.workspaceName}' workspace`);
|
|
55
59
|
this.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} patch dw ${this.workspaceName} -n ${this.namespace} -p '{ "metadata": { "finalizers": null }}' --type merge || true`);
|
|
56
60
|
this.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dw ${this.workspaceName} -n ${this.namespace} || true`);
|
|
61
|
+
this.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dwt ${TestConstants.TS_SELENIUM_EDITOR}-${this.workspaceName} -n ${this.namespace} || true`);
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString {
|
|
@@ -79,6 +84,16 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
79
84
|
'EOF');
|
|
80
85
|
}
|
|
81
86
|
|
|
87
|
+
applyYamlConfigurationAsFile(pathToFile: string): void {
|
|
88
|
+
Logger.debug(`${this.getLoggingName(this.applyYamlConfigurationAsFile.name)}:`);
|
|
89
|
+
this.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} apply -n ${this.namespace} -f "${path.resolve(pathToFile)}"`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getDevWorkspaceYamlConfiguration(): ShellString {
|
|
93
|
+
Logger.debug(`${this.getLoggingName(this.getDevWorkspaceYamlConfiguration.name)}:`);
|
|
94
|
+
return this.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} get dw ${this.workspaceName} -n ${this.namespace} -o yaml`);
|
|
95
|
+
}
|
|
96
|
+
|
|
82
97
|
waitDevWorkspace(timeout: number = 360): ShellString {
|
|
83
98
|
Logger.debug(`${this.getLoggingName(this.waitDevWorkspace.name)}: Wait till workspace ready.`);
|
|
84
99
|
return this.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} wait -n ${this.namespace} --for=condition=Ready dw ${this.workspaceName} --timeout=${timeout}s`);
|
|
@@ -89,6 +104,22 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
89
104
|
this.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} create namespace ${this.namespace}`);
|
|
90
105
|
}
|
|
91
106
|
|
|
107
|
+
createProject(projectName: string): void {
|
|
108
|
+
Logger.debug(`${this.getLoggingName(this.createProject.name)}: Create new project "${projectName}".`);
|
|
109
|
+
this.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} new-project ${projectName} -n ${this.namespace}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
deleteProject(projectName: string): void {
|
|
113
|
+
Logger.debug(`${this.getLoggingName(this.deleteProject.name)}: Delete "${projectName}".`);
|
|
114
|
+
this.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} delete project ${projectName} -n ${this.namespace}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private isUserLoggedIn(): boolean {
|
|
118
|
+
const whoamiCommandOutput: ShellString = this.execWithLog('oc whoami && oc whoami --show-server=true');
|
|
119
|
+
|
|
120
|
+
return whoamiCommandOutput.stdout.includes(TestConstants.TS_SELENIUM_OCP_USERNAME) && whoamiCommandOutput.stdout.includes(this.getServerUrl());
|
|
121
|
+
}
|
|
122
|
+
|
|
92
123
|
private getLoggingName(methodName: string): string {
|
|
93
124
|
return `${this.constructor.name}.${methodName} - ${(this.KUBERNETES_COMMAND_LINE_TOOL)}`;
|
|
94
125
|
}
|
|
@@ -110,7 +141,7 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
110
141
|
export namespace KubernetesCommandLineToolsExecutor {
|
|
111
142
|
export class ContainerTerminal extends KubernetesCommandLineToolsExecutor {
|
|
112
143
|
constructor(cluster: KubernetesCommandLineToolsExecutor) {
|
|
113
|
-
|
|
144
|
+
super(cluster.getWorkspaceName, cluster.getNamespace);
|
|
114
145
|
}
|
|
115
146
|
|
|
116
147
|
ls(path: string = ''): ShellString {
|
package/utils/ShellExecutor.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { echo, exec, ShellString } from 'shelljs';
|
|
|
2
2
|
|
|
3
3
|
export class ShellExecutor {
|
|
4
4
|
|
|
5
|
+
wait(seconds: number): void {
|
|
6
|
+
this.execWithLog(`sleep ${seconds}s`);
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
protected execWithLog(command: string): ShellString {
|
|
6
10
|
echo(command);
|
|
7
11
|
return exec(command);
|