@eclipse-che/che-e2e 7.74.0-dev-41d1364 → 7.74.0-dev-715064a
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/.eslintrc.js +15 -1
- package/CODE_STYLE.md +144 -0
- package/configs/inversify.config.ts +26 -5
- package/configs/inversify.types.ts +17 -3
- package/constants/CHROME_DRIVER_CONSTANTS.ts +1 -13
- package/dist/configs/inversify.config.js +22 -1
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +17 -3
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js +1 -9
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -1
- package/dist/driver/ChromeDriver.js +1 -7
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +5 -5
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +5 -6
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +34 -39
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +27 -28
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +2 -2
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +18 -4
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +11 -11
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +2 -2
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +20 -24
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +10 -13
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +3 -3
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +16 -20
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +16 -15
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +20 -20
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +38 -25
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +9 -6
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +6 -6
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +7 -14
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +11 -19
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +10 -16
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +7 -14
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +5 -5
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +6 -6
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +11 -11
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +11 -12
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +13 -16
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +17 -18
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +17 -19
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +35 -41
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/specs/web-terminal/WebTerminalTest.spec.js +23 -0
- package/dist/specs/web-terminal/WebTerminalTest.spec.js.map +1 -0
- package/dist/tests-library/LoginTests.js +8 -8
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +2 -2
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +8 -8
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +4 -9
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +49 -23
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +27 -17
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +15 -5
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +9 -2
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/IContextParams.js +12 -0
- package/dist/utils/IContextParams.js.map +1 -0
- package/dist/utils/IKubernetesCommandLineToolsExecutor.js +3 -0
- package/dist/utils/IKubernetesCommandLineToolsExecutor.js.map +1 -0
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +133 -98
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +8 -4
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +20 -9
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +4 -2
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +2 -2
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +2 -2
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js +2 -2
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +4 -4
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +0 -7
- package/index.ts +2 -0
- package/package.json +3 -3
- package/pageobjects/dashboard/CreateWorkspace.ts +5 -4
- package/pageobjects/dashboard/Dashboard.ts +3 -4
- package/pageobjects/dashboard/Workspaces.ts +40 -48
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +23 -26
- package/pageobjects/ide/CheCodeLocatorLoader.ts +3 -1
- package/pageobjects/login/interfaces/ICheLoginPage.ts +1 -1
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +1 -1
- package/pageobjects/login/kubernetes/DexLoginPage.ts +9 -9
- package/pageobjects/login/openshift/OcpLoginPage.ts +18 -30
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +6 -11
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +1 -1
- package/pageobjects/login/openshift/RedHatLoginPage.ts +17 -16
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +16 -11
- package/pageobjects/openshift/OcpApplicationPage.ts +5 -4
- package/pageobjects/openshift/OcpImportFromGitPage.ts +18 -20
- package/pageobjects/openshift/OcpMainPage.ts +42 -25
- package/specs/MochaHooks.ts +3 -5
- package/specs/SmokeTest.spec.ts +4 -5
- package/specs/api/ContainerOverridesAPI.spec.ts +8 -2
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +9 -7
- package/specs/api/EmptyWorkspaceAPI.spec.ts +8 -4
- package/specs/api/PodOverridesAPI.spec.ts +8 -3
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +5 -5
- package/specs/dashboard-samples/Quarkus.spec.ts +7 -6
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +8 -7
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +12 -11
- package/specs/factory/Factory.spec.ts +8 -12
- package/specs/factory/NoSetupRepoFactory.spec.ts +10 -11
- package/specs/factory/RefusedOAuthFactory.spec.ts +8 -10
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +40 -44
- package/specs/web-terminal/WebTerminalTest.spec.ts +25 -0
- package/tests-library/LoginTests.ts +3 -3
- package/tests-library/WorkspaceHandlingTests.ts +2 -2
- package/utils/BrowserTabsUtil.ts +7 -9
- package/utils/CheReporter.ts +26 -20
- package/utils/DevWorkspaceConfigurationHelper.ts +9 -24
- package/utils/DevfilesRegistryHelper.ts +8 -3
- package/utils/DriverHelper.ts +14 -12
- package/utils/IContextParams.ts +26 -0
- package/utils/IKubernetesCommandLineToolsExecutor.ts +42 -0
- package/utils/KubernetesCommandLineToolsExecutor.ts +133 -101
- package/utils/ShellExecutor.ts +10 -7
- package/utils/StringUtil.ts +6 -1
package/utils/CheReporter.ts
CHANGED
|
@@ -17,21 +17,27 @@ import { DriverHelper } from './DriverHelper';
|
|
|
17
17
|
import { ScreenCatcher } from './ScreenCatcher';
|
|
18
18
|
import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
|
|
19
19
|
import { Logger } from './Logger';
|
|
20
|
-
import { e2eContainer } from '../configs/inversify.config';
|
|
21
20
|
import { StringUtil } from './StringUtil';
|
|
22
21
|
import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
|
|
23
22
|
import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
|
|
24
23
|
import { OAUTH_CONSTANTS } from '../constants/OAUTH_CONSTANTS';
|
|
25
24
|
import { REPORTER_CONSTANTS } from '../constants/REPORTER_CONSTANTS';
|
|
26
25
|
import { PLUGIN_TEST_CONSTANTS } from '../constants/PLUGIN_TEST_CONSTANTS';
|
|
26
|
+
import { inject, injectable } from 'inversify';
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
const screenCatcher: ScreenCatcher = e2eContainer.get(CLASSES.ScreenCatcher);
|
|
30
|
-
let methodIndex: number = 0;
|
|
31
|
-
let deleteScreencast: boolean = true;
|
|
32
|
-
|
|
28
|
+
@injectable()
|
|
33
29
|
class CheReporter extends mocha.reporters.Spec {
|
|
34
|
-
|
|
30
|
+
private static methodIndex: number = 0;
|
|
31
|
+
private static deleteScreencast: boolean = true;
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
runner: mocha.Runner,
|
|
35
|
+
options: mocha.MochaOptions,
|
|
36
|
+
@inject(CLASSES.DriverHelper)
|
|
37
|
+
private readonly driverHelper: DriverHelper,
|
|
38
|
+
@inject(CLASSES.ScreenCatcher)
|
|
39
|
+
private readonly screenCatcher: ScreenCatcher
|
|
40
|
+
) {
|
|
35
41
|
super(runner, options);
|
|
36
42
|
|
|
37
43
|
runner.on('start', (): void => {
|
|
@@ -76,20 +82,20 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
76
82
|
rm.sync(REPORTER_CONSTANTS.TS_SELENIUM_REPORT_FOLDER);
|
|
77
83
|
});
|
|
78
84
|
|
|
79
|
-
runner.on('test', async
|
|
85
|
+
runner.on('test', async (test: mocha.Test): Promise<void> => {
|
|
80
86
|
if (!REPORTER_CONSTANTS.TS_SELENIUM_EXECUTION_SCREENCAST) {
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
methodIndex = methodIndex + 1;
|
|
85
|
-
const currentMethodIndex: number = methodIndex;
|
|
90
|
+
CheReporter.methodIndex = CheReporter.methodIndex + 1;
|
|
91
|
+
const currentMethodIndex: number = CheReporter.methodIndex;
|
|
86
92
|
let iterationIndex: number = 1;
|
|
87
93
|
|
|
88
94
|
while (!(test.state === 'passed' || test.state === 'failed')) {
|
|
89
|
-
await screenCatcher.catchMethodScreen(test.title, currentMethodIndex, iterationIndex);
|
|
95
|
+
await this.screenCatcher.catchMethodScreen(test.title, currentMethodIndex, iterationIndex);
|
|
90
96
|
iterationIndex = iterationIndex + 1;
|
|
91
97
|
|
|
92
|
-
await driverHelper.wait(REPORTER_CONSTANTS.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS);
|
|
98
|
+
await this.driverHelper.wait(REPORTER_CONSTANTS.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS);
|
|
93
99
|
}
|
|
94
100
|
});
|
|
95
101
|
|
|
@@ -107,21 +113,21 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
107
113
|
|
|
108
114
|
runner.on('end', async (): Promise<void> => {
|
|
109
115
|
// ensure that fired events done
|
|
110
|
-
await driverHelper.wait(5000);
|
|
116
|
+
await this.driverHelper.wait(5000);
|
|
111
117
|
|
|
112
118
|
// close driver
|
|
113
|
-
await driverHelper.getDriver().quit();
|
|
119
|
+
await this.driverHelper.getDriver().quit();
|
|
114
120
|
|
|
115
121
|
// delete screencast folder if conditions matched
|
|
116
|
-
if (deleteScreencast && REPORTER_CONSTANTS.DELETE_SCREENCAST_IF_TEST_PASS) {
|
|
122
|
+
if (CheReporter.deleteScreencast && REPORTER_CONSTANTS.DELETE_SCREENCAST_IF_TEST_PASS) {
|
|
117
123
|
rm.sync(REPORTER_CONSTANTS.TS_SELENIUM_REPORT_FOLDER);
|
|
118
124
|
}
|
|
119
125
|
});
|
|
120
126
|
|
|
121
|
-
runner.on('fail', async
|
|
127
|
+
runner.on('fail', async (test: mocha.Test): Promise<void> => {
|
|
122
128
|
Logger.error(`CheReporter runner.on.fail: ${test.fullTitle()} failed after ${test.duration}ms`);
|
|
123
129
|
// raise flag for keeping the screencast
|
|
124
|
-
deleteScreencast = false;
|
|
130
|
+
CheReporter.deleteScreencast = false;
|
|
125
131
|
|
|
126
132
|
Logger.trace(`FullTitle:${test.fullTitle()}`);
|
|
127
133
|
const testFullTitle: string = StringUtil.sanitizeTitle(test.fullTitle());
|
|
@@ -150,19 +156,19 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
// take screenshot and write to file
|
|
153
|
-
const screenshot: string = await driverHelper.getDriver().takeScreenshot();
|
|
159
|
+
const screenshot: string = await this.driverHelper.getDriver().takeScreenshot();
|
|
154
160
|
const screenshotStream: WriteStream = fs.createWriteStream(screenshotFileName);
|
|
155
161
|
screenshotStream.write(Buffer.from(screenshot, 'base64'));
|
|
156
162
|
screenshotStream.end();
|
|
157
163
|
|
|
158
164
|
// take page source and write to file
|
|
159
|
-
const pageSource: string = await driverHelper.getDriver().getPageSource();
|
|
165
|
+
const pageSource: string = await this.driverHelper.getDriver().getPageSource();
|
|
160
166
|
const pageSourceStream: WriteStream = fs.createWriteStream(pageSourceFileName);
|
|
161
167
|
pageSourceStream.write(Buffer.from(pageSource));
|
|
162
168
|
pageSourceStream.end();
|
|
163
169
|
|
|
164
170
|
// take browser console logs and write to file
|
|
165
|
-
const browserLogsEntries: logging.Entry[] = await driverHelper.getDriver().manage().logs().get('browser');
|
|
171
|
+
const browserLogsEntries: logging.Entry[] = await this.driverHelper.getDriver().manage().logs().get('browser');
|
|
166
172
|
let browserLogs: string = '';
|
|
167
173
|
|
|
168
174
|
browserLogsEntries.forEach((log): void => {
|
|
@@ -15,31 +15,16 @@ import * as axios from 'axios';
|
|
|
15
15
|
import { Logger } from './Logger';
|
|
16
16
|
import { ShellExecutor } from './ShellExecutor';
|
|
17
17
|
import { API_TEST_CONSTANTS } from '../constants/API_TEST_CONSTANTS';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
19
|
+
import { IContextParams } from './IContextParams';
|
|
20
|
+
import { e2eContainer } from '../configs/inversify.config';
|
|
21
|
+
import { CLASSES, EXTERNAL_CLASSES } from '../configs/inversify.types';
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
* to see more about IContextParams and generateDevfileContext(params) check README.md in "@eclipse-che/che-devworkspace-generator;
|
|
21
|
-
* tests/e2e/node_modules/@eclipse-che/che-devworkspace-generator/README.md
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
interface IContextParams {
|
|
25
|
-
devfilePath?: string | undefined;
|
|
26
|
-
devfileUrl?: string | undefined;
|
|
27
|
-
devfileContent?: string | undefined;
|
|
28
|
-
outputFile?: string | undefined;
|
|
29
|
-
editorPath?: string | undefined;
|
|
30
|
-
editorContent?: string | undefined;
|
|
31
|
-
editorEntry?: string | undefined;
|
|
32
|
-
pluginRegistryUrl?: string | undefined;
|
|
33
|
-
projects?: {
|
|
34
|
-
name: string;
|
|
35
|
-
location: string;
|
|
36
|
-
}[];
|
|
37
|
-
injectDefaultComponent?: string | undefined;
|
|
38
|
-
defaultComponentImage?: string | undefined;
|
|
39
|
-
}
|
|
40
|
-
|
|
23
|
+
@injectable()
|
|
41
24
|
export class DevWorkspaceConfigurationHelper {
|
|
42
|
-
private generator: Generator =
|
|
25
|
+
private generator: Generator = e2eContainer.get(EXTERNAL_CLASSES.Generator);
|
|
26
|
+
private shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
|
|
27
|
+
|
|
43
28
|
private readonly params: IContextParams;
|
|
44
29
|
|
|
45
30
|
constructor(params: IContextParams) {
|
|
@@ -60,7 +45,7 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
60
45
|
params.pluginRegistryUrl = API_TEST_CONSTANTS.TS_API_TEST_PLUGIN_REGISTRY_URL;
|
|
61
46
|
}
|
|
62
47
|
if (API_TEST_CONSTANTS.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI && !params.editorContent) {
|
|
63
|
-
params.editorContent =
|
|
48
|
+
params.editorContent = this.shellExecutor.curl(API_TEST_CONSTANTS.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI).stdout;
|
|
64
49
|
}
|
|
65
50
|
this.params = params;
|
|
66
51
|
}
|
|
@@ -11,20 +11,25 @@ import axios, { AxiosResponse } from 'axios';
|
|
|
11
11
|
import { Logger } from './Logger';
|
|
12
12
|
import YAML from 'yaml';
|
|
13
13
|
import { API_TEST_CONSTANTS, SUPPORTED_DEVFILE_REGISTRIES } from '../constants/API_TEST_CONSTANTS';
|
|
14
|
+
import { injectable } from 'inversify';
|
|
14
15
|
|
|
16
|
+
@injectable()
|
|
15
17
|
export class DevfilesRegistryHelper {
|
|
16
18
|
async getInbuiltDevfilesRegistryContent(): Promise<AxiosResponse> {
|
|
17
|
-
Logger.
|
|
19
|
+
Logger.trace();
|
|
20
|
+
|
|
18
21
|
return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL());
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
async getGitHubCheDevfileRegistryContent(): Promise<AxiosResponse> {
|
|
22
|
-
Logger.
|
|
25
|
+
Logger.trace();
|
|
26
|
+
|
|
23
27
|
return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL);
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
async collectPathsToDevfilesFromRegistry(): Promise<object[]> {
|
|
27
31
|
Logger.debug();
|
|
32
|
+
|
|
28
33
|
const devfileSamples: object[] = [];
|
|
29
34
|
const sampleNames: string[] = [];
|
|
30
35
|
switch (API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) {
|
|
@@ -72,7 +77,7 @@ export class DevfilesRegistryHelper {
|
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
private async getContent(url: string, headers?: object): Promise<AxiosResponse> {
|
|
75
|
-
Logger.
|
|
80
|
+
Logger.trace(`${url}`);
|
|
76
81
|
|
|
77
82
|
let response: AxiosResponse | undefined;
|
|
78
83
|
try {
|
package/utils/DriverHelper.ts
CHANGED
|
@@ -95,7 +95,6 @@ export class DriverHelper {
|
|
|
95
95
|
async waitVisibility(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
|
|
96
96
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
97
97
|
const attempts: number = Math.ceil(timeout / polling);
|
|
98
|
-
|
|
99
98
|
Logger.trace(`${elementLocator}`);
|
|
100
99
|
|
|
101
100
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -158,7 +157,6 @@ export class DriverHelper {
|
|
|
158
157
|
async waitPresence(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
|
|
159
158
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
160
159
|
const attempts: number = Math.ceil(timeout / polling);
|
|
161
|
-
|
|
162
160
|
Logger.trace(`${elementLocator}`);
|
|
163
161
|
|
|
164
162
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -191,7 +189,6 @@ export class DriverHelper {
|
|
|
191
189
|
): Promise<Array<WebElement>> {
|
|
192
190
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
193
191
|
const attempts: number = Math.ceil(timeout / polling);
|
|
194
|
-
|
|
195
192
|
Logger.trace(`${elementLocator}`);
|
|
196
193
|
|
|
197
194
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -246,6 +243,7 @@ export class DriverHelper {
|
|
|
246
243
|
pollingPerLocator: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING
|
|
247
244
|
): Promise<void> {
|
|
248
245
|
Logger.trace(`${locators}`);
|
|
246
|
+
|
|
249
247
|
try {
|
|
250
248
|
for (const elementLocator of locators) {
|
|
251
249
|
await this.waitDisappearance(elementLocator, attemptsPerLocator, pollingPerLocator);
|
|
@@ -258,7 +256,6 @@ export class DriverHelper {
|
|
|
258
256
|
async waitAndClick(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
259
257
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
260
258
|
const attempts: number = Math.ceil(timeout / polling);
|
|
261
|
-
|
|
262
259
|
Logger.trace(`${elementLocator}`);
|
|
263
260
|
|
|
264
261
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -284,7 +281,7 @@ export class DriverHelper {
|
|
|
284
281
|
await element.click();
|
|
285
282
|
return;
|
|
286
283
|
} catch (err) {
|
|
287
|
-
function isElementClickInterceptedOnLastAttempt(err:
|
|
284
|
+
function isElementClickInterceptedOnLastAttempt(err: any, i: number): boolean {
|
|
288
285
|
return err instanceof error.ElementClickInterceptedError && i === attempts - 1;
|
|
289
286
|
}
|
|
290
287
|
|
|
@@ -320,7 +317,6 @@ export class DriverHelper {
|
|
|
320
317
|
): Promise<string> {
|
|
321
318
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
322
319
|
const attempts: number = Math.ceil(timeout / polling);
|
|
323
|
-
|
|
324
320
|
Logger.trace(`${elementLocator} attribute: '${attribute}'`);
|
|
325
321
|
|
|
326
322
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -367,7 +363,6 @@ export class DriverHelper {
|
|
|
367
363
|
): Promise<string> {
|
|
368
364
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
369
365
|
const attempts: number = Math.ceil(timeout / polling);
|
|
370
|
-
|
|
371
366
|
Logger.trace(`${elementLocator} cssAttribute: ${cssAttribute}`);
|
|
372
367
|
|
|
373
368
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -474,7 +469,6 @@ export class DriverHelper {
|
|
|
474
469
|
): Promise<void> {
|
|
475
470
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
476
471
|
const attempts: number = Math.ceil(timeout / polling);
|
|
477
|
-
|
|
478
472
|
Logger.trace(`${elementLocator} text: ${text}`);
|
|
479
473
|
|
|
480
474
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -516,7 +510,6 @@ export class DriverHelper {
|
|
|
516
510
|
async clear(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
517
511
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
518
512
|
const attempts: number = Math.ceil(timeout / polling);
|
|
519
|
-
|
|
520
513
|
Logger.trace(`${elementLocator}`);
|
|
521
514
|
|
|
522
515
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -558,7 +551,6 @@ export class DriverHelper {
|
|
|
558
551
|
async clearInvisible(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
559
552
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
560
553
|
const attempts: number = Math.ceil(timeout / polling);
|
|
561
|
-
|
|
562
554
|
Logger.trace(`${elementLocator}`);
|
|
563
555
|
|
|
564
556
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -624,7 +616,6 @@ export class DriverHelper {
|
|
|
624
616
|
async waitAndGetText(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
|
|
625
617
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
626
618
|
const attempts: number = Math.ceil(timeout / polling);
|
|
627
|
-
|
|
628
619
|
Logger.trace(`${elementLocator}`);
|
|
629
620
|
|
|
630
621
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -677,7 +668,6 @@ export class DriverHelper {
|
|
|
677
668
|
async scrollTo(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
678
669
|
const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
|
|
679
670
|
const attempts: number = Math.ceil(timeout / polling);
|
|
680
|
-
|
|
681
671
|
Logger.trace(`${elementLocator}`);
|
|
682
672
|
|
|
683
673
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -717,6 +707,8 @@ export class DriverHelper {
|
|
|
717
707
|
}
|
|
718
708
|
|
|
719
709
|
async scrollToAndClick(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
710
|
+
Logger.trace();
|
|
711
|
+
|
|
720
712
|
await this.scrollTo(elementLocator, timeout);
|
|
721
713
|
await this.waitAndClick(elementLocator, timeout);
|
|
722
714
|
}
|
|
@@ -726,12 +718,16 @@ export class DriverHelper {
|
|
|
726
718
|
value: string,
|
|
727
719
|
timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
|
|
728
720
|
): Promise<void> {
|
|
721
|
+
Logger.trace();
|
|
722
|
+
|
|
729
723
|
await this.scrollTo(elementLocator, timeout);
|
|
730
724
|
await this.enterValue(elementLocator, value, timeout);
|
|
731
725
|
}
|
|
732
726
|
|
|
733
727
|
// method is useful to debug page object elements
|
|
734
728
|
async highLightElement(element: WebElement): Promise<void> {
|
|
729
|
+
Logger.trace();
|
|
730
|
+
|
|
735
731
|
await this.getDriver().executeScript('arguments[0].style.border="2px solid red"', element);
|
|
736
732
|
}
|
|
737
733
|
|
|
@@ -740,4 +736,10 @@ export class DriverHelper {
|
|
|
740
736
|
|
|
741
737
|
return this.driver;
|
|
742
738
|
}
|
|
739
|
+
|
|
740
|
+
async navigateToUrl(url: string): Promise<void> {
|
|
741
|
+
Logger.trace();
|
|
742
|
+
|
|
743
|
+
await this.getDriver().navigate().to(url);
|
|
744
|
+
}
|
|
743
745
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
10
|
+
|
|
11
|
+
export interface IContextParams {
|
|
12
|
+
devfilePath?: string | undefined;
|
|
13
|
+
devfileUrl?: string | undefined;
|
|
14
|
+
devfileContent?: string | undefined;
|
|
15
|
+
outputFile?: string | undefined;
|
|
16
|
+
editorPath?: string | undefined;
|
|
17
|
+
editorContent?: string | undefined;
|
|
18
|
+
editorEntry?: string | undefined;
|
|
19
|
+
pluginRegistryUrl?: string | undefined;
|
|
20
|
+
projects?: {
|
|
21
|
+
name: string;
|
|
22
|
+
location: string;
|
|
23
|
+
}[];
|
|
24
|
+
injectDefaultComponent?: string | undefined;
|
|
25
|
+
defaultComponentImage?: string | undefined;
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made
|
|
5
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
6
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
**********************************************************************/
|
|
10
|
+
import { ShellString } from 'shelljs';
|
|
11
|
+
|
|
12
|
+
export interface IKubernetesCommandLineToolsExecutor {
|
|
13
|
+
loginToOcp(): void;
|
|
14
|
+
|
|
15
|
+
getContainerName(): string;
|
|
16
|
+
|
|
17
|
+
getWorkspacePodName(): string;
|
|
18
|
+
|
|
19
|
+
deleteDevWorkspace(): void;
|
|
20
|
+
|
|
21
|
+
applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString;
|
|
22
|
+
|
|
23
|
+
executeCommand(commandToExecute: string, container: string): ShellString;
|
|
24
|
+
|
|
25
|
+
applyYamlConfigurationAsStringOutput(yamlConfiguration: string): ShellString;
|
|
26
|
+
|
|
27
|
+
applyYamlConfigurationAsFile(pathToFile: string): void;
|
|
28
|
+
|
|
29
|
+
getDevWorkspaceYamlConfiguration(): ShellString;
|
|
30
|
+
|
|
31
|
+
waitDevWorkspace(timeout: number): ShellString;
|
|
32
|
+
|
|
33
|
+
createProject(projectName: string): void;
|
|
34
|
+
|
|
35
|
+
deleteProject(projectName: string): void;
|
|
36
|
+
|
|
37
|
+
getPodAndContainerNames(): void;
|
|
38
|
+
|
|
39
|
+
isUserLoggedIn(user: string): boolean;
|
|
40
|
+
|
|
41
|
+
getServerUrl(): string;
|
|
42
|
+
}
|