@eclipse-che/che-e2e 7.70.0-dev-eacd975 → 7.70.0
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 +4 -4
- package/configs/inversify.config.ts +5 -6
- package/configs/inversify.types.ts +0 -1
- package/configs/mocharc.ts +12 -2
- package/configs/sh-scripts/generateIndex.sh +2 -3
- package/constants/APITestConstants.ts +56 -0
- package/constants/BaseTestConstants.ts +65 -0
- package/constants/ChromeDriverConstants.ts +46 -0
- package/constants/FactoryTestConstants.ts +45 -0
- package/constants/MonacoConstants.ts +22 -0
- package/constants/OAuthConstants.ts +56 -0
- package/constants/PluginsTestConstants.ts +15 -0
- package/constants/ReporterConstants.ts +45 -0
- package/constants/TimeoutConstants.ts +28 -146
- package/dist/configs/inversify.config.js +5 -6
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +0 -1
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +11 -2
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/APITestConstants.js +54 -0
- package/dist/constants/APITestConstants.js.map +1 -0
- package/dist/constants/BaseTestConstants.js +61 -0
- package/dist/constants/BaseTestConstants.js.map +1 -0
- package/dist/constants/ChromeDriverConstants.js +44 -0
- package/dist/constants/ChromeDriverConstants.js.map +1 -0
- package/dist/constants/FactoryTestConstants.js +44 -0
- package/dist/constants/FactoryTestConstants.js.map +1 -0
- package/dist/constants/MonacoConstants.js +25 -0
- package/dist/constants/MonacoConstants.js.map +1 -0
- package/dist/constants/OAuthConstants.js +52 -0
- package/dist/constants/OAuthConstants.js.map +1 -0
- package/dist/constants/PluginsTestConstants.js +19 -0
- package/dist/constants/PluginsTestConstants.js.map +1 -0
- package/dist/constants/ReporterConstants.js +43 -0
- package/dist/constants/ReporterConstants.js.map +1 -0
- package/dist/constants/TimeoutConstants.js +22 -113
- package/dist/constants/TimeoutConstants.js.map +1 -1
- package/dist/driver/ChromeDriver.js +7 -7
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +2 -2
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +5 -4
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +1 -2
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +2 -3
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +12 -19
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +2 -2
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +3 -3
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/{openshift → login/openshift}/OcpLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -0
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +5 -5
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +3 -3
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +4 -4
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +9 -7
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +2 -2
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +4 -3
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js +4 -3
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +2 -2
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +12 -10
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +16 -14
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +17 -15
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +4 -4
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +1 -2
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +2 -2
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +31 -27
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +7 -7
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +9 -9
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +16 -17
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +13 -11
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +11 -11
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +5 -5
- package/dist/utils/ScreenCatcher.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/TestWorkspaceUtil.js +3 -3
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +7 -7
- package/index.ts +11 -4
- package/package.json +1 -1
- package/pageobjects/dashboard/CreateWorkspace.ts +2 -2
- package/pageobjects/dashboard/Dashboard.ts +5 -4
- package/pageobjects/dashboard/Workspaces.ts +1 -2
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +2 -3
- package/pageobjects/git-providers/OauthPage.ts +8 -16
- package/pageobjects/ide/CheCodeLocatorLoader.ts +2 -2
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +3 -3
- package/pageobjects/{openshift → login/openshift}/OcpLoginPage.ts +7 -7
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +1 -1
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +5 -5
- package/pageobjects/login/openshift/RedHatLoginPage.ts +3 -3
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +4 -4
- package/specs/MochaHooks.ts +9 -7
- package/specs/SmokeTest.spec.ts +2 -2
- package/specs/api/EmptyWorkspaceAPI.spec.ts +4 -3
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +4 -3
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +2 -2
- package/specs/factory/Factory.spec.ts +12 -10
- package/specs/factory/NoSetupRepoFactory.spec.ts +16 -14
- package/specs/factory/RefusedOAuthFactory.spec.ts +17 -15
- package/tests-library/LoginTests.ts +4 -4
- package/tests-library/WorkspaceHandlingTests.ts +1 -2
- package/utils/BrowserTabsUtil.ts +2 -2
- package/utils/CheReporter.ts +32 -28
- package/utils/DevWorkspaceConfigurationHelper.ts +7 -7
- package/utils/DevfilesRegistryHelper.ts +3 -3
- package/utils/DriverHelper.ts +20 -21
- package/utils/KubernetesCommandLineToolsExecutor.ts +11 -9
- package/utils/Logger.ts +11 -12
- package/utils/ScreenCatcher.ts +5 -5
- package/utils/request-handlers/CheApiRequestHandler.ts +2 -2
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +2 -2
- package/utils/workspace/TestWorkspaceUtil.ts +3 -3
- package/constants/TestConstants.ts +0 -274
- package/dist/constants/TestConstants.js +0 -223
- package/dist/constants/TestConstants.js.map +0 -1
- package/dist/pageobjects/openshift/CheLoginPage.js +0 -55
- package/dist/pageobjects/openshift/CheLoginPage.js.map +0 -1
- package/dist/pageobjects/openshift/OcpLoginPage.js.map +0 -1
- package/pageobjects/openshift/CheLoginPage.ts +0 -42
package/utils/CheReporter.ts
CHANGED
|
@@ -11,7 +11,6 @@ import * as mocha from 'mocha';
|
|
|
11
11
|
import { TYPES, CLASSES } from '../configs/inversify.types';
|
|
12
12
|
import * as fs from 'fs';
|
|
13
13
|
import * as rm from 'rimraf';
|
|
14
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
15
14
|
import { logging } from 'selenium-webdriver';
|
|
16
15
|
import { DriverHelper } from './DriverHelper';
|
|
17
16
|
import { ScreenCatcher } from './ScreenCatcher';
|
|
@@ -21,6 +20,11 @@ import { Logger } from './Logger';
|
|
|
21
20
|
import { e2eContainer } from '../configs/inversify.config';
|
|
22
21
|
import { WriteStream } from 'fs';
|
|
23
22
|
import { StringUtil } from './StringUtil';
|
|
23
|
+
import { BaseTestConstants } from '../constants/BaseTestConstants';
|
|
24
|
+
import { ChromeDriverConstants } from '../constants/ChromeDriverConstants';
|
|
25
|
+
import { OAuthConstants } from '../constants/OAuthConstants';
|
|
26
|
+
import { ReporterConstants } from '../constants/ReporterConstants';
|
|
27
|
+
import { PluginsTestConstants } from '../constants/PluginsTestConstants';
|
|
24
28
|
|
|
25
29
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
26
30
|
const screenCatcher: ScreenCatcher = e2eContainer.get(CLASSES.ScreenCatcher);
|
|
@@ -39,32 +43,32 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
39
43
|
let launchInformation: string =
|
|
40
44
|
`################## Launch Information ##################
|
|
41
45
|
|
|
42
|
-
TS_SELENIUM_BASE_URL: ${
|
|
43
|
-
TS_SELENIUM_HEADLESS: ${
|
|
44
|
-
TS_SELENIUM_OCP_USERNAME: ${
|
|
45
|
-
TS_SELENIUM_EDITOR: ${
|
|
46
|
-
|
|
47
|
-
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${
|
|
48
|
-
TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: ${
|
|
49
|
-
TS_SELENIUM_REPORT_FOLDER: ${
|
|
50
|
-
TS_SELENIUM_EXECUTION_SCREENCAST: ${
|
|
51
|
-
DELETE_SCREENCAST_IF_TEST_PASS: ${
|
|
52
|
-
TS_SELENIUM_REMOTE_DRIVER_URL: ${
|
|
53
|
-
DELETE_WORKSPACE_ON_FAILED_TEST: ${
|
|
54
|
-
TS_SELENIUM_LOG_LEVEL: ${
|
|
55
|
-
TS_SELENIUM_LAUNCH_FULLSCREEN: ${
|
|
46
|
+
TS_SELENIUM_BASE_URL: ${BaseTestConstants.TS_SELENIUM_BASE_URL}
|
|
47
|
+
TS_SELENIUM_HEADLESS: ${ChromeDriverConstants.TS_SELENIUM_HEADLESS}
|
|
48
|
+
TS_SELENIUM_OCP_USERNAME: ${OAuthConstants.TS_SELENIUM_OCP_USERNAME}
|
|
49
|
+
TS_SELENIUM_EDITOR: ${BaseTestConstants.TS_SELENIUM_EDITOR}
|
|
50
|
+
|
|
51
|
+
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${BaseTestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME}
|
|
52
|
+
TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: ${ReporterConstants.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS}
|
|
53
|
+
TS_SELENIUM_REPORT_FOLDER: ${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}
|
|
54
|
+
TS_SELENIUM_EXECUTION_SCREENCAST: ${ReporterConstants.TS_SELENIUM_EXECUTION_SCREENCAST}
|
|
55
|
+
DELETE_SCREENCAST_IF_TEST_PASS: ${ReporterConstants.DELETE_SCREENCAST_IF_TEST_PASS}
|
|
56
|
+
TS_SELENIUM_REMOTE_DRIVER_URL: ${ChromeDriverConstants.TS_SELENIUM_REMOTE_DRIVER_URL}
|
|
57
|
+
DELETE_WORKSPACE_ON_FAILED_TEST: ${BaseTestConstants.DELETE_WORKSPACE_ON_FAILED_TEST}
|
|
58
|
+
TS_SELENIUM_LOG_LEVEL: ${ReporterConstants.TS_SELENIUM_LOG_LEVEL}
|
|
59
|
+
TS_SELENIUM_LAUNCH_FULLSCREEN: ${ChromeDriverConstants.TS_SELENIUM_LAUNCH_FULLSCREEN}
|
|
56
60
|
|
|
57
61
|
TS_COMMON_DASHBOARD_WAIT_TIMEOUT: ${TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT}
|
|
58
62
|
TS_SELENIUM_START_WORKSPACE_TIMEOUT: ${TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT}
|
|
59
63
|
TS_WAIT_LOADER_PRESENCE_TIMEOUT: ${TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT}
|
|
60
64
|
|
|
61
|
-
TS_SAMPLE_LIST: ${
|
|
65
|
+
TS_SAMPLE_LIST: ${PluginsTestConstants.TS_SAMPLE_LIST}
|
|
62
66
|
|
|
63
67
|
${process.env.MOCHA_DIRECTORY ? 'MOCHA_DIRECTORY: ' + process.env.MOCHA_DIRECTORY : 'MOCHA_DRIRECTORY is not set'}
|
|
64
68
|
${process.env.USERSTORY ? 'USERSTORY: ' + process.env.USERSTORY : 'USERSTORY is not set'}
|
|
65
69
|
`;
|
|
66
70
|
|
|
67
|
-
if (
|
|
71
|
+
if (ReporterConstants.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES) {
|
|
68
72
|
launchInformation += `\n TS_SELENIUM_PRINT_TIMEOUT_VARIABLES is set to true: \n`;
|
|
69
73
|
Object.entries(TimeoutConstants).forEach(
|
|
70
74
|
([key, value]) => launchInformation += `\n ${key}: ${value}`);
|
|
@@ -76,11 +80,11 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
76
80
|
|
|
77
81
|
console.log(launchInformation);
|
|
78
82
|
|
|
79
|
-
rm.sync(
|
|
83
|
+
rm.sync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
80
84
|
});
|
|
81
85
|
|
|
82
86
|
runner.on('test', async function (test: mocha.Test): Promise<void> {
|
|
83
|
-
if (!
|
|
87
|
+
if (!ReporterConstants.TS_SELENIUM_EXECUTION_SCREENCAST) {
|
|
84
88
|
return;
|
|
85
89
|
}
|
|
86
90
|
|
|
@@ -92,13 +96,13 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
92
96
|
await screenCatcher.catchMethodScreen(test.title, currentMethodIndex, iterationIndex);
|
|
93
97
|
iterationIndex = iterationIndex + 1;
|
|
94
98
|
|
|
95
|
-
await driverHelper.wait(
|
|
99
|
+
await driverHelper.wait(ReporterConstants.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS);
|
|
96
100
|
}
|
|
97
101
|
});
|
|
98
102
|
|
|
99
103
|
runner.on('pass', async (test: mocha.Test) => {
|
|
100
|
-
if (
|
|
101
|
-
const loadTestReportFolder: string =
|
|
104
|
+
if (BaseTestConstants.TS_LOAD_TESTS) {
|
|
105
|
+
const loadTestReportFolder: string = ReporterConstants.TS_SELENIUM_LOAD_TEST_REPORT_FOLDER;
|
|
102
106
|
const loadTestFilePath: string = loadTestReportFolder + '/load-test-results.txt';
|
|
103
107
|
const report: string = test.title + ': ' + test.duration + '\r';
|
|
104
108
|
if (!fs.existsSync(loadTestReportFolder)) {
|
|
@@ -117,8 +121,8 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
117
121
|
await driverHelper.getDriver().quit();
|
|
118
122
|
|
|
119
123
|
// delete screencast folder if conditions matched
|
|
120
|
-
if (deleteScreencast &&
|
|
121
|
-
rm.sync(
|
|
124
|
+
if (deleteScreencast && ReporterConstants.DELETE_SCREENCAST_IF_TEST_PASS) {
|
|
125
|
+
rm.sync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
122
126
|
}
|
|
123
127
|
});
|
|
124
128
|
|
|
@@ -134,17 +138,17 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
134
138
|
const testTitle: string = StringUtil.sanitizeTitle(test.title);
|
|
135
139
|
Logger.trace(`TestTitleSanitized:${testTitle}`);
|
|
136
140
|
|
|
137
|
-
const testReportDirPath: string = `${
|
|
141
|
+
const testReportDirPath: string = `${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}/${testFullTitle}`;
|
|
138
142
|
const screenshotFileName: string = `${testReportDirPath}/screenshot-${testTitle}.png`;
|
|
139
143
|
const pageSourceFileName: string = `${testReportDirPath}/pagesource-${testTitle}.html`;
|
|
140
144
|
const browserLogsFileName: string = `${testReportDirPath}/browserlogs-${testTitle}.txt`;
|
|
141
145
|
|
|
142
146
|
|
|
143
147
|
// create reporter dir if not exist
|
|
144
|
-
const reportDirExists: boolean = fs.existsSync(
|
|
148
|
+
const reportDirExists: boolean = fs.existsSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
145
149
|
|
|
146
150
|
if (!reportDirExists) {
|
|
147
|
-
fs.mkdirSync(
|
|
151
|
+
fs.mkdirSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
// create dir for failed test report if not exist
|
|
@@ -179,7 +183,7 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
179
183
|
browserLogsStream.end();
|
|
180
184
|
|
|
181
185
|
// stop and remove running workspace
|
|
182
|
-
if (
|
|
186
|
+
if (BaseTestConstants.DELETE_WORKSPACE_ON_FAILED_TEST) {
|
|
183
187
|
Logger.warn('Property DELETE_WORKSPACE_ON_FAILED_TEST se to true - trying to stop and delete running workspace.');
|
|
184
188
|
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(CheReporter.latestWorkspace);
|
|
185
189
|
}
|
|
@@ -4,8 +4,8 @@ import { V1alpha2DevWorkspaceTemplate } from '@devfile/api';
|
|
|
4
4
|
import YAML from 'yaml';
|
|
5
5
|
import * as axios from 'axios';
|
|
6
6
|
import { Logger } from './Logger';
|
|
7
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
8
7
|
import { ShellExecutor } from './ShellExecutor';
|
|
8
|
+
import { APITestConstants } from '../constants/APITestConstants';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* to see more about IContextParams and generateDevfileContext(params) check README.md in "@eclipse-che/che-devworkspace-generator;
|
|
@@ -39,19 +39,19 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
39
39
|
params.editorEntry = 'che-incubator/che-code/latest';
|
|
40
40
|
}
|
|
41
41
|
// check if one or both has value
|
|
42
|
-
if (
|
|
42
|
+
if (APITestConstants.TS_API_TEST_UDI_IMAGE || params.defaultComponentImage) {
|
|
43
43
|
params.injectDefaultComponent = 'true';
|
|
44
44
|
// check if not explicitly passed than assign value from the constants
|
|
45
45
|
if (!params.defaultComponentImage) {
|
|
46
|
-
params.defaultComponentImage =
|
|
46
|
+
params.defaultComponentImage = APITestConstants.TS_API_TEST_UDI_IMAGE;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
// assign value from the constants if not explicitly passed
|
|
50
|
-
if (
|
|
51
|
-
params.pluginRegistryUrl =
|
|
50
|
+
if (APITestConstants.TS_API_TEST_PLUGIN_REGISTRY_URL && !params.pluginRegistryUrl) {
|
|
51
|
+
params.pluginRegistryUrl = APITestConstants.TS_API_TEST_PLUGIN_REGISTRY_URL;
|
|
52
52
|
}
|
|
53
|
-
if (
|
|
54
|
-
params.editorContent = ShellExecutor.curl(
|
|
53
|
+
if (APITestConstants.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI && !params.editorContent) {
|
|
54
|
+
params.editorContent = ShellExecutor.curl(APITestConstants.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI).stdout;
|
|
55
55
|
}
|
|
56
56
|
this.params = params;
|
|
57
57
|
}
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
|
-
import { SupportedDevfilesRegistries, TestConstants } from '../constants/TestConstants';
|
|
11
10
|
import axios, { AxiosResponse } from 'axios';
|
|
12
11
|
import { Logger } from './Logger';
|
|
13
12
|
import YAML from 'yaml';
|
|
13
|
+
import { APITestConstants, SupportedDevfilesRegistries } from '../constants/APITestConstants';
|
|
14
14
|
|
|
15
15
|
export class DevfilesRegistryHelper {
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ export class DevfilesRegistryHelper {
|
|
|
28
28
|
Logger.debug(`${this.constructor.name}.${this.collectPathsToDevfilesFromRegistry.name}`);
|
|
29
29
|
const devfileSamples: object[] = [];
|
|
30
30
|
const sampleNames: string[] = [];
|
|
31
|
-
switch (
|
|
31
|
+
switch (APITestConstants.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) {
|
|
32
32
|
case (SupportedDevfilesRegistries.GIT_HUB_CHE_DEVFILE_REGISTRY_URL): {
|
|
33
33
|
const content: any[any] = await this.getGitHubCheDevfileRegistryContent();
|
|
34
34
|
content.forEach((e: any) => {
|
|
@@ -55,7 +55,7 @@ export class DevfilesRegistryHelper {
|
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
default: {
|
|
58
|
-
Logger.error(`${this.constructor.name}.${this.collectPathsToDevfilesFromRegistry.name}: unsupported registry url - ${
|
|
58
|
+
Logger.error(`${this.constructor.name}.${this.collectPathsToDevfilesFromRegistry.name}: unsupported registry url - ${APITestConstants.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()}\n
|
|
59
59
|
supported registries: ${JSON.stringify(SupportedDevfilesRegistries)}`);
|
|
60
60
|
}
|
|
61
61
|
}
|
package/utils/DriverHelper.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { inject, injectable } from 'inversify';
|
|
|
12
12
|
import { TYPES } from '../configs/inversify.types';
|
|
13
13
|
import { Actions, By, error, ThenableWebDriver, until, WebElement } from 'selenium-webdriver';
|
|
14
14
|
import 'reflect-metadata';
|
|
15
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
16
15
|
import { Logger } from './Logger';
|
|
17
16
|
import { TimeoutConstants } from '../constants/TimeoutConstants';
|
|
18
17
|
|
|
@@ -55,8 +54,8 @@ export class DriverHelper {
|
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
async waitVisibilityBoolean(locator: By,
|
|
58
|
-
attempts: number =
|
|
59
|
-
polling: number =
|
|
57
|
+
attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
|
|
58
|
+
polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<boolean> {
|
|
60
59
|
|
|
61
60
|
Logger.trace(`DriverHelper.waitVisibilityBoolean ${locator}`);
|
|
62
61
|
|
|
@@ -74,8 +73,8 @@ export class DriverHelper {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
async waitDisappearanceBoolean(locator: By,
|
|
77
|
-
attempts: number =
|
|
78
|
-
polling: number =
|
|
76
|
+
attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
|
|
77
|
+
polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<boolean> {
|
|
79
78
|
|
|
80
79
|
Logger.trace(`DriverHelper.waitDisappearanceBoolean ${locator}`);
|
|
81
80
|
|
|
@@ -93,7 +92,7 @@ export class DriverHelper {
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
async waitVisibility(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
|
|
96
|
-
const polling: number =
|
|
95
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
97
96
|
const attempts: number = Math.ceil(timeout / polling);
|
|
98
97
|
|
|
99
98
|
Logger.trace(`DriverHelper.waitVisibility ${elementLocator}`);
|
|
@@ -151,7 +150,7 @@ export class DriverHelper {
|
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
async waitPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
|
|
154
|
-
const polling: number =
|
|
153
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
155
154
|
const attempts: number = Math.ceil(timeout / polling);
|
|
156
155
|
|
|
157
156
|
Logger.trace(`DriverHelper.waitPresence ${elementLocator}`);
|
|
@@ -179,7 +178,7 @@ export class DriverHelper {
|
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
async waitAllPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<Array<WebElement>> {
|
|
182
|
-
const polling: number =
|
|
181
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
183
182
|
const attempts: number = Math.ceil(timeout / polling);
|
|
184
183
|
|
|
185
184
|
Logger.trace(`DriverHelper.waitAllPresence ${elementLocator}`);
|
|
@@ -215,8 +214,8 @@ export class DriverHelper {
|
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
async waitDisappearance(elementLocator: By,
|
|
218
|
-
attempts: number =
|
|
219
|
-
polling: number =
|
|
217
|
+
attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
|
|
218
|
+
polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
|
|
220
219
|
|
|
221
220
|
Logger.trace(`DriverHelper.waitDisappearance ${elementLocator}`);
|
|
222
221
|
|
|
@@ -240,8 +239,8 @@ export class DriverHelper {
|
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
async waitAllDisappearance(locators: Array<By>,
|
|
243
|
-
attemptsPerLocator: number =
|
|
244
|
-
pollingPerLocator: number =
|
|
242
|
+
attemptsPerLocator: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
|
|
243
|
+
pollingPerLocator: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
|
|
245
244
|
|
|
246
245
|
Logger.trace(`DriverHelper.waitAllDisappearance ${locators}`);
|
|
247
246
|
|
|
@@ -251,7 +250,7 @@ export class DriverHelper {
|
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
async waitAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
254
|
-
const polling: number =
|
|
253
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
255
254
|
const attempts: number = Math.ceil(timeout / polling);
|
|
256
255
|
|
|
257
256
|
Logger.trace(`DriverHelper.waitAndClick ${elementLocator}`);
|
|
@@ -310,7 +309,7 @@ export class DriverHelper {
|
|
|
310
309
|
|
|
311
310
|
async waitAndGetElementAttribute(elementLocator: By, attribute: string,
|
|
312
311
|
timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
|
|
313
|
-
const polling: number =
|
|
312
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
314
313
|
const attempts: number = Math.ceil(timeout / polling);
|
|
315
314
|
|
|
316
315
|
Logger.trace(`DriverHelper.waitAndGetElementAttribute ${elementLocator} attribute: '${attribute}'`);
|
|
@@ -352,7 +351,7 @@ export class DriverHelper {
|
|
|
352
351
|
|
|
353
352
|
async waitAndGetCssValue(elementLocator: By, cssAttribute: string,
|
|
354
353
|
timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
|
|
355
|
-
const polling: number =
|
|
354
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
356
355
|
const attempts: number = Math.ceil(timeout / polling);
|
|
357
356
|
|
|
358
357
|
Logger.trace(`DriverHelper.waitAndGetCssValue ${elementLocator} cssAttribute: ${cssAttribute}`);
|
|
@@ -409,7 +408,7 @@ export class DriverHelper {
|
|
|
409
408
|
}
|
|
410
409
|
|
|
411
410
|
async type(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
412
|
-
const polling: number =
|
|
411
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
413
412
|
const attempts: number = Math.ceil(timeout / polling);
|
|
414
413
|
|
|
415
414
|
if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
|
|
@@ -455,7 +454,7 @@ export class DriverHelper {
|
|
|
455
454
|
}
|
|
456
455
|
|
|
457
456
|
async typeToInvisible(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
458
|
-
const polling: number =
|
|
457
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
459
458
|
const attempts: number = Math.ceil(timeout / polling);
|
|
460
459
|
|
|
461
460
|
Logger.trace(`DriverHelper.typeToInvisible ${elementLocator} text: ${text}`);
|
|
@@ -497,7 +496,7 @@ export class DriverHelper {
|
|
|
497
496
|
}
|
|
498
497
|
|
|
499
498
|
async clear(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
500
|
-
const polling: number =
|
|
499
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
501
500
|
const attempts: number = Math.ceil(timeout / polling);
|
|
502
501
|
|
|
503
502
|
Logger.trace(`DriverHelper.clear ${elementLocator}`);
|
|
@@ -539,7 +538,7 @@ export class DriverHelper {
|
|
|
539
538
|
}
|
|
540
539
|
|
|
541
540
|
async clearInvisible(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
542
|
-
const polling: number =
|
|
541
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
543
542
|
const attempts: number = Math.ceil(timeout / polling);
|
|
544
543
|
|
|
545
544
|
Logger.trace(`DriverHelper.clearInvisible ${elementLocator}`);
|
|
@@ -601,7 +600,7 @@ export class DriverHelper {
|
|
|
601
600
|
}
|
|
602
601
|
|
|
603
602
|
async waitAndGetText(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
|
|
604
|
-
const polling: number =
|
|
603
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
605
604
|
const attempts: number = Math.ceil(timeout / polling);
|
|
606
605
|
|
|
607
606
|
Logger.trace(`DriverHelper.waitAndGetText ${elementLocator}`);
|
|
@@ -654,7 +653,7 @@ export class DriverHelper {
|
|
|
654
653
|
}
|
|
655
654
|
|
|
656
655
|
async scrollTo(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
657
|
-
const polling: number =
|
|
656
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
658
657
|
const attempts: number = Math.ceil(timeout / polling);
|
|
659
658
|
|
|
660
659
|
Logger.trace(`DriverHelper.scrollTo ${elementLocator}`);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { echo, exec, ShellString } from 'shelljs';
|
|
2
|
-
import { KubernetesCommandLineTool, TestConstants } from '../constants/TestConstants';
|
|
3
2
|
import { Logger } from './Logger';
|
|
4
3
|
import { ShellExecutor } from './ShellExecutor';
|
|
5
4
|
import * as path from 'path';
|
|
5
|
+
import { APITestConstants, KubernetesCommandLineTool } from '../constants/APITestConstants';
|
|
6
|
+
import { BaseTestConstants } from '../constants/BaseTestConstants';
|
|
7
|
+
import { OAuthConstants } from '../constants/OAuthConstants';
|
|
6
8
|
|
|
7
9
|
export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
8
10
|
private static container: string;
|
|
9
11
|
private static pod: string;
|
|
10
12
|
private readonly namespace: string;
|
|
11
13
|
private readonly workspaceName: string | undefined;
|
|
12
|
-
private readonly KUBERNETES_COMMAND_LINE_TOOL: string =
|
|
14
|
+
private readonly KUBERNETES_COMMAND_LINE_TOOL: string = APITestConstants.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL;
|
|
13
15
|
|
|
14
16
|
constructor(_workspaceName?: string, _namespace?: string) {
|
|
15
17
|
super();
|
|
@@ -33,8 +35,8 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
33
35
|
if (this.isUserLoggedIn()) {
|
|
34
36
|
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: User already logged`);
|
|
35
37
|
} else {
|
|
36
|
-
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: Login ${url}, ${
|
|
37
|
-
exec(`oc login --server=${url} -u=${
|
|
38
|
+
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: Login ${url}, ${APITestConstants.TS_SELENIUM_OCP_USERNAME}`);
|
|
39
|
+
exec(`oc login --server=${url} -u=${APITestConstants.TS_SELENIUM_OCP_USERNAME} -p=${APITestConstants.TS_SELENIUM_OCP_PASSWORD} --insecure-skip-tls-verify`);
|
|
38
40
|
}
|
|
39
41
|
} else {
|
|
40
42
|
Logger.debug(`${this.getLoggingName(this.loginToOcp.name)}: doesn't support login command`);
|
|
@@ -58,7 +60,7 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
58
60
|
Logger.debug(`${this.getLoggingName(this.deleteDevWorkspace.name)}: Delete '${this.workspaceName}' workspace`);
|
|
59
61
|
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} patch dw ${this.workspaceName} -n ${this.namespace} -p '{ "metadata": { "finalizers": null }}' --type merge || true`);
|
|
60
62
|
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dw ${this.workspaceName} -n ${this.namespace} || true`);
|
|
61
|
-
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dwt ${
|
|
63
|
+
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dwt ${APITestConstants.TS_SELENIUM_EDITOR}-${this.workspaceName} -n ${this.namespace} || true`);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString {
|
|
@@ -121,7 +123,7 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
121
123
|
private isUserLoggedIn(): boolean {
|
|
122
124
|
const whoamiCommandOutput: ShellString = ShellExecutor.execWithLog('oc whoami && oc whoami --show-server=true');
|
|
123
125
|
|
|
124
|
-
return whoamiCommandOutput.stdout.includes(
|
|
126
|
+
return whoamiCommandOutput.stdout.includes(OAuthConstants.TS_SELENIUM_OCP_USERNAME) && whoamiCommandOutput.stdout.includes(this.getServerUrl());
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
private getLoggingName(methodName: string): string {
|
|
@@ -130,15 +132,15 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
130
132
|
|
|
131
133
|
private setNamespace(_namespace: string | undefined): string {
|
|
132
134
|
_namespace = _namespace !== undefined ? _namespace
|
|
133
|
-
:
|
|
134
|
-
:
|
|
135
|
+
: BaseTestConstants.TS_SELENIUM_BASE_URL.includes('devspaces') ? OAuthConstants.TS_SELENIUM_OCP_USERNAME + '-devspaces'
|
|
136
|
+
: BaseTestConstants.TS_SELENIUM_BASE_URL.includes('che') ? OAuthConstants.TS_SELENIUM_OCP_USERNAME + '-che'
|
|
135
137
|
: 'default';
|
|
136
138
|
return _namespace;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
private getServerUrl(): string {
|
|
140
142
|
Logger.debug(`${this.getLoggingName(this.getServerUrl.name)}: Get server api url.`);
|
|
141
|
-
return
|
|
143
|
+
return BaseTestConstants.TS_SELENIUM_BASE_URL.replace('devspaces.apps', 'api') + ':6443';
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
|
package/utils/Logger.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
2
|
-
|
|
3
1
|
/*********************************************************************
|
|
4
2
|
* Copyright (c) 2019-2023 Red Hat, Inc.
|
|
5
3
|
*
|
|
@@ -9,6 +7,7 @@ import { TestConstants } from '../constants/TestConstants';
|
|
|
9
7
|
*
|
|
10
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
11
9
|
**********************************************************************/
|
|
10
|
+
import { ReporterConstants } from '../constants/ReporterConstants';
|
|
12
11
|
|
|
13
12
|
export abstract class Logger {
|
|
14
13
|
|
|
@@ -27,7 +26,7 @@ export abstract class Logger {
|
|
|
27
26
|
* @param indentLevel log level
|
|
28
27
|
*/
|
|
29
28
|
static warn(text: string, indentLevel: number = 1): void {
|
|
30
|
-
if (
|
|
29
|
+
if (ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR') {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
this.logText(indentLevel, `[WARN] ${text}`);
|
|
@@ -39,8 +38,8 @@ export abstract class Logger {
|
|
|
39
38
|
* @param indentLevel log level
|
|
40
39
|
*/
|
|
41
40
|
static info(text: string, indentLevel: number = 3): void {
|
|
42
|
-
if (
|
|
43
|
-
|
|
41
|
+
if (ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
42
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'WARN') {
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
45
|
this.logText(indentLevel, `• ${text}`);
|
|
@@ -52,9 +51,9 @@ export abstract class Logger {
|
|
|
52
51
|
* @param indentLevel log level
|
|
53
52
|
*/
|
|
54
53
|
static debug(text: string, indentLevel: number = 5): void {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if (ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
55
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'WARN' ||
|
|
56
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'INFO') {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
this.logText(indentLevel, `▼ ${text}`);
|
|
@@ -67,10 +66,10 @@ export abstract class Logger {
|
|
|
67
66
|
* @param indentLevel log level
|
|
68
67
|
*/
|
|
69
68
|
static trace(text: string, indentLevel: number = 6): void {
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
if (ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
70
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'WARN' ||
|
|
71
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'INFO' ||
|
|
72
|
+
ReporterConstants.TS_SELENIUM_LOG_LEVEL === 'DEBUG') {
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
76
75
|
this.logText(indentLevel, `‣ ${text}`);
|
package/utils/ScreenCatcher.ts
CHANGED
|
@@ -12,22 +12,22 @@ import { injectable, inject } from 'inversify';
|
|
|
12
12
|
import { CLASSES } from '../configs/inversify.types';
|
|
13
13
|
import { DriverHelper } from './DriverHelper';
|
|
14
14
|
import { error } from 'selenium-webdriver';
|
|
15
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
16
15
|
import { WriteStream } from 'fs';
|
|
17
16
|
import { StringUtil } from './StringUtil';
|
|
17
|
+
import { ReporterConstants } from '../constants/ReporterConstants';
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class ScreenCatcher {
|
|
21
21
|
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
22
22
|
|
|
23
23
|
async catchMethodScreen(methodName: string, methodIndex: number, screenshotIndex: number): Promise<void> {
|
|
24
|
-
const executionScreenCastDir: string = `${
|
|
25
|
-
const executionScreenCastErrorsDir: string = `${
|
|
24
|
+
const executionScreenCastDir: string = `${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}/executionScreencast`;
|
|
25
|
+
const executionScreenCastErrorsDir: string = `${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}/executionScreencastErrors`;
|
|
26
26
|
const formattedMethodIndex: string = new Intl.NumberFormat('en-us', { minimumIntegerDigits: 3 }).format(methodIndex);
|
|
27
27
|
const formattedScreenshotIndex: string = new Intl.NumberFormat('en-us', { minimumIntegerDigits: 5 }).format(screenshotIndex).replace(/,/g, '');
|
|
28
28
|
|
|
29
|
-
if (!fs.existsSync(
|
|
30
|
-
fs.mkdirSync(
|
|
29
|
+
if (!fs.existsSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER)) {
|
|
30
|
+
fs.mkdirSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (!fs.existsSync(executionScreenCastDir)) {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
12
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
13
12
|
import { TYPES } from '../../configs/inversify.types';
|
|
14
13
|
import { inject, injectable } from 'inversify';
|
|
15
14
|
import { IAuthorizationHeaderHandler } from './headers/IAuthorizationHeaderHandler';
|
|
16
15
|
import { Logger } from '../Logger';
|
|
16
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
17
17
|
|
|
18
18
|
@injectable()
|
|
19
19
|
export class CheApiRequestHandler {
|
|
@@ -104,7 +104,7 @@ export class CheApiRequestHandler {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
private assembleUrl(relativeUrl: string): string {
|
|
107
|
-
return `${
|
|
107
|
+
return `${BaseTestConstants.TS_SELENIUM_BASE_URL}/${relativeUrl}`;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
}
|
|
@@ -14,12 +14,12 @@ import { DriverHelper } from '../../DriverHelper';
|
|
|
14
14
|
import { CLASSES } from '../../../configs/inversify.types';
|
|
15
15
|
import { Logger } from '../../Logger';
|
|
16
16
|
import { IWebDriverCookie } from 'selenium-webdriver';
|
|
17
|
-
import {
|
|
17
|
+
import { BaseTestConstants, Platform } from '../../../constants/BaseTestConstants';
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class CheMultiuserAuthorizationHeaderHandler implements IAuthorizationHeaderHandler {
|
|
21
21
|
private authorizationToken: string = '';
|
|
22
|
-
private readonly cookiesType: string =
|
|
22
|
+
private readonly cookiesType: string = BaseTestConstants.TS_PLATFORM === Platform.OPENSHIFT ? '_oauth_proxy' : '_oauth2_proxy';
|
|
23
23
|
|
|
24
24
|
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
25
25
|
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
import 'reflect-metadata';
|
|
12
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
13
12
|
import { injectable, inject } from 'inversify';
|
|
14
13
|
import { DriverHelper } from '../DriverHelper';
|
|
15
14
|
import { WorkspaceStatus } from './WorkspaceStatus';
|
|
@@ -20,11 +19,12 @@ import { Logger } from '../Logger';
|
|
|
20
19
|
import axios, { AxiosResponse } from 'axios';
|
|
21
20
|
import { ITestWorkspaceUtil } from './ITestWorkspaceUtil';
|
|
22
21
|
import { ApiUrlResolver } from './ApiUrlResolver';
|
|
22
|
+
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
23
23
|
|
|
24
24
|
@injectable()
|
|
25
25
|
export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
26
|
-
readonly attempts: number =
|
|
27
|
-
readonly polling: number =
|
|
26
|
+
readonly attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS;
|
|
27
|
+
readonly polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
28
28
|
|
|
29
29
|
constructor(
|
|
30
30
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|