@eclipse-che/che-e2e 7.76.0 → 7.78.0-next-677d4d6
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/mocharc.ts +4 -2
- package/configs/reporters.config.js +54 -0
- package/configs/sh-scripts/runDevfileAcceptanceTests.sh +81 -0
- package/configs/sh-scripts/runFunctionalTests.sh +9 -6
- package/constants/BASE_TEST_CONSTANTS.ts +21 -3
- package/constants/FACTORY_TEST_CONSTANTS.ts +3 -1
- package/constants/MOCHA_CONSTANTS.ts +5 -2
- package/constants/REPORTER_CONSTANTS.ts +99 -3
- package/constants/TIMEOUT_CONSTANTS.ts +10 -22
- package/dist/configs/mocharc.js +4 -2
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/BASE_TEST_CONSTANTS.js +16 -2
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -1
- package/dist/constants/FACTORY_TEST_CONSTANTS.js +3 -1
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -1
- package/dist/constants/MOCHA_CONSTANTS.js +3 -2
- package/dist/constants/MOCHA_CONSTANTS.js.map +1 -1
- package/dist/constants/REPORTER_CONSTANTS.js +71 -2
- package/dist/constants/REPORTER_CONSTANTS.js.map +1 -1
- package/dist/constants/TIMEOUT_CONSTANTS.js +0 -8
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +22 -3
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +4 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +49 -11
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +9 -5
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +3 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +0 -3
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Documentation.spec.js +7 -2
- package/dist/specs/dashboard-samples/Documentation.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -6
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +12 -6
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +12 -6
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +18 -5
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +12 -6
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +12 -8
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +33 -31
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js +12 -7
- package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js.map +1 -1
- package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js +12 -6
- package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +45 -12
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/specs/miscellaneous/WorkspaceIdleTimeout.spec.js +15 -5
- package/dist/specs/miscellaneous/WorkspaceIdleTimeout.spec.js.map +1 -1
- package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js +9 -4
- package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js.map +1 -1
- package/dist/specs/web-terminal/WebTerminalTest.spec.js +22 -0
- package/dist/specs/web-terminal/WebTerminalTest.spec.js.map +1 -1
- package/dist/suites/devfile-acceptance-test-suite/DynamicallyGeneratingAPITest.suite.js +13 -0
- package/dist/suites/devfile-acceptance-test-suite/DynamicallyGeneratingAPITest.suite.js.map +1 -0
- package/dist/suites/disconnected-ocp/UITest.suite.js +1 -1
- package/dist/suites/online-ocp/UITest.suite.js +1 -1
- package/dist/tests-library/LoginTests.js +15 -11
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +0 -2
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +2 -5
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +8 -1
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +2 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +40 -37
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +4 -0
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +9 -8
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +45 -11
- package/dist/utils/Logger.js.map +1 -1
- package/package.json +11 -11
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +1 -1
- package/pageobjects/git-providers/OauthPage.ts +24 -3
- package/pageobjects/ide/CheCodeLocatorLoader.ts +4 -1
- package/pageobjects/openshift/OcpMainPage.ts +1 -1
- package/specs/MochaHooks.ts +51 -10
- package/specs/SmokeTest.spec.ts +9 -5
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +5 -1
- package/specs/api/EmptyWorkspaceAPI.spec.ts +0 -4
- package/specs/dashboard-samples/Documentation.spec.ts +8 -3
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +15 -8
- package/specs/dashboard-samples/Quarkus.spec.ts +15 -7
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +15 -7
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +20 -8
- package/specs/factory/Factory.spec.ts +15 -7
- package/specs/factory/NoSetupRepoFactory.spec.ts +15 -11
- package/specs/factory/RefusedOAuthFactory.spec.ts +42 -35
- package/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts +15 -8
- package/specs/miscellaneous/KubedockPodmanTest.spec.ts +16 -7
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +51 -14
- package/specs/miscellaneous/WorkspaceIdleTimeout.spec.ts +19 -6
- package/specs/miscellaneous/WorkspaceWithParent.spec.ts +9 -4
- package/specs/web-terminal/WebTerminalTest.spec.ts +33 -0
- package/suites/devfile-acceptance-test-suite/DynamicallyGeneratingAPITest.suite.ts +10 -0
- package/suites/disconnected-ocp/UITest.suite.ts +1 -1
- package/suites/online-ocp/UITest.suite.ts +1 -1
- package/tests-library/LoginTests.ts +21 -11
- package/tests-library/ProjectAndFileTests.ts +0 -6
- package/tests-library/WorkspaceHandlingTests.ts +2 -6
- package/tsconfig.json +1 -1
- package/utils/BrowserTabsUtil.ts +8 -1
- package/utils/DevWorkspaceConfigurationHelper.ts +4 -1
- package/utils/DevfilesRegistryHelper.ts +41 -39
- package/utils/DriverHelper.ts +6 -0
- package/utils/KubernetesCommandLineToolsExecutor.ts +8 -8
- package/utils/Logger.ts +50 -12
- package/utils/workspace/ITestWorkspaceUtil.ts +7 -7
- package/configs/reporters-config.json +0 -6
package/utils/BrowserTabsUtil.ts
CHANGED
|
@@ -76,7 +76,14 @@ export class BrowserTabsUtil {
|
|
|
76
76
|
async getCurrentUrl(): Promise<string> {
|
|
77
77
|
Logger.trace();
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
let currentUrl: string = '';
|
|
80
|
+
try {
|
|
81
|
+
currentUrl = await this.driverHelper.getDriver().getCurrentUrl();
|
|
82
|
+
} catch (e) {
|
|
83
|
+
Logger.trace('cannot get current url');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return currentUrl;
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
async waitURL(expectedUrl: string, timeout: number): Promise<void> {
|
|
@@ -56,6 +56,7 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
56
56
|
|
|
57
57
|
async generateDevfileContext(): Promise<DevfileContext> {
|
|
58
58
|
Logger.debug();
|
|
59
|
+
|
|
59
60
|
if (!this.params.projects) {
|
|
60
61
|
this.params.projects = [];
|
|
61
62
|
}
|
|
@@ -71,6 +72,7 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
71
72
|
// write templates and then DevWorkspace in a single file
|
|
72
73
|
getDevWorkspaceConfigurationYamlAsString(context: DevfileContext): string {
|
|
73
74
|
Logger.debug();
|
|
75
|
+
|
|
74
76
|
const allContentArray: any[] = context.devWorkspaceTemplates.map((template: V1alpha2DevWorkspaceTemplate): string =>
|
|
75
77
|
YAML.stringify(template)
|
|
76
78
|
);
|
|
@@ -80,7 +82,7 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
getDevWorkspaceConfigurationsAsYaml(allContentString: string): string {
|
|
83
|
-
Logger.debug(
|
|
85
|
+
Logger.debug();
|
|
84
86
|
const content: any = {};
|
|
85
87
|
const contentArray: string[] = allContentString.split('---\n');
|
|
86
88
|
contentArray.forEach((e: any): void => {
|
|
@@ -97,6 +99,7 @@ export class DevWorkspaceConfigurationHelper {
|
|
|
97
99
|
return content;
|
|
98
100
|
}
|
|
99
101
|
patchDevWorkspaceConfigWithBuildContainerAttribute(devfileContextDevWorkspace: any): void {
|
|
102
|
+
Logger.debug();
|
|
100
103
|
devfileContextDevWorkspace.spec.template.attributes = YAML.parse(`
|
|
101
104
|
controller.devfile.io/devworkspace-config:
|
|
102
105
|
name: devworkspace-config
|
|
@@ -28,54 +28,56 @@ export class DevfilesRegistryHelper {
|
|
|
28
28
|
async getGitHubCheDevfileRegistryContent(): Promise<AxiosResponse> {
|
|
29
29
|
Logger.trace();
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const url: string =
|
|
32
|
+
API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL() === ''
|
|
33
|
+
? SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL
|
|
34
|
+
: API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL();
|
|
35
|
+
return await this.getContent(url);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
async collectPathsToDevfilesFromRegistry(isInbuilt: boolean
|
|
38
|
+
async collectPathsToDevfilesFromRegistry(isInbuilt: boolean, sampleNamePatterns?: string[]): Promise<object[]> {
|
|
35
39
|
Logger.debug();
|
|
36
40
|
|
|
37
41
|
const devfileSamples: object[] = [];
|
|
38
42
|
const sampleNames: string[] = [];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
sampleNames.push(e.name);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
for (const sample of sampleNames) {
|
|
50
|
-
const sampleEndpoint: string = `${SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL}${sample}/meta.yaml`;
|
|
51
|
-
const sampleEndpointContent: AxiosResponse = await this.getContent(sampleEndpoint);
|
|
52
|
-
const decodedFileContent: string = Buffer.from((sampleEndpointContent as any).content, 'base64').toString();
|
|
53
|
-
const metaYamlContent: any = YAML.parse(decodedFileContent);
|
|
54
|
-
devfileSamples.push({
|
|
55
|
-
name: sample,
|
|
56
|
-
link: metaYamlContent.links.v2
|
|
57
|
-
});
|
|
43
|
+
if (!isInbuilt) {
|
|
44
|
+
{
|
|
45
|
+
const content: any[any] = await this.getGitHubCheDevfileRegistryContent();
|
|
46
|
+
content.forEach((e: any): void => {
|
|
47
|
+
if (e.name[0] !== '.') {
|
|
48
|
+
sampleNames.push(e.name);
|
|
58
49
|
}
|
|
59
|
-
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
for (const sample of sampleNames) {
|
|
53
|
+
const sampleEndpoint: string = `${SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL}${sample}/meta.yaml`;
|
|
54
|
+
const sampleEndpointContent: AxiosResponse = await this.getContent(sampleEndpoint);
|
|
55
|
+
const decodedFileContent: string = Buffer.from((sampleEndpointContent as any).content, 'base64').toString();
|
|
56
|
+
const metaYamlContent: any = YAML.parse(decodedFileContent);
|
|
57
|
+
devfileSamples.push({
|
|
58
|
+
name: sample,
|
|
59
|
+
link: metaYamlContent.links.v2
|
|
60
|
+
});
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
|
|
62
|
+
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
|
|
63
|
+
}
|
|
64
|
+
} else if (isInbuilt) {
|
|
65
|
+
{
|
|
66
|
+
const content: any[any] = await this.getInbuiltDevfilesRegistryContent(sampleNamePatterns);
|
|
67
|
+
for (const sample of content) {
|
|
68
|
+
const linkToDevWorkspaceYaml: any =
|
|
69
|
+
BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL +
|
|
70
|
+
'/devfile-registry' +
|
|
71
|
+
sample.links.devWorkspaces['che-incubator/che-code/latest'];
|
|
72
|
+
devfileSamples.push({
|
|
73
|
+
name: sample.displayName,
|
|
74
|
+
devWorkspaceConfigurationString: await this.getContent(linkToDevWorkspaceYaml)
|
|
75
|
+
});
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
{
|
|
79
81
|
Logger.error(`unsupported registry url - ${API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()}\n
|
|
80
82
|
supported registries: ${JSON.stringify(SUPPORTED_DEVFILE_REGISTRIES)}`);
|
|
81
83
|
}
|
package/utils/DriverHelper.ts
CHANGED
|
@@ -46,14 +46,14 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
get namespace(): string | undefined {
|
|
49
|
-
this._namespace
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
if (!this._namespace) {
|
|
50
|
+
const applicationName: string = BASE_TEST_CONSTANTS.TESTING_APPLICATION_NAME();
|
|
51
|
+
if (applicationName === 'default') {
|
|
52
|
+
this._namespace = applicationName;
|
|
53
|
+
} else {
|
|
54
|
+
this._namespace = OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME + '-' + applicationName;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
57
|
return this._namespace;
|
|
58
58
|
}
|
|
59
59
|
|
package/utils/Logger.ts
CHANGED
|
@@ -8,17 +8,23 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
import { REPORTER_CONSTANTS } from '../constants/REPORTER_CONSTANTS';
|
|
11
|
+
import { rpApi } from '../specs/MochaHooks';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
+
export class Logger {
|
|
13
14
|
/**
|
|
14
15
|
* uses for logging of fatal errors.
|
|
15
16
|
* @param text log text
|
|
16
17
|
* @param indentLevel log level
|
|
17
18
|
*/
|
|
19
|
+
|
|
18
20
|
static error(text: string = '', indentLevel: number = 1): void {
|
|
19
21
|
const callerInfo: string = this.getCallerInfo();
|
|
20
22
|
const logLevelSymbol: string = '[ERROR] ';
|
|
21
|
-
|
|
23
|
+
const message: string = this.getFullMessage(callerInfo, text);
|
|
24
|
+
this.logText(indentLevel, logLevelSymbol, message);
|
|
25
|
+
if (this.sendLogMessageIntoReportPortal()) {
|
|
26
|
+
rpApi.error(message);
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
/**
|
|
@@ -32,7 +38,11 @@ export abstract class Logger {
|
|
|
32
38
|
}
|
|
33
39
|
const callerInfo: string = this.getCallerInfo();
|
|
34
40
|
const logLevelSymbol: string = '[WARN] ';
|
|
35
|
-
|
|
41
|
+
const message: string = this.getFullMessage(callerInfo, text);
|
|
42
|
+
this.logText(indentLevel, logLevelSymbol, message);
|
|
43
|
+
if (this.sendLogMessageIntoReportPortal()) {
|
|
44
|
+
rpApi.warn(message);
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
/**
|
|
@@ -46,7 +56,11 @@ export abstract class Logger {
|
|
|
46
56
|
}
|
|
47
57
|
const callerInfo: string = this.getCallerInfo();
|
|
48
58
|
const logLevelSymbol: string = '• ';
|
|
49
|
-
|
|
59
|
+
const message: string = this.getFullMessage(callerInfo, text);
|
|
60
|
+
this.logText(indentLevel, logLevelSymbol, message);
|
|
61
|
+
if (this.sendLogMessageIntoReportPortal()) {
|
|
62
|
+
rpApi.info(message);
|
|
63
|
+
}
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
/**
|
|
@@ -64,7 +78,11 @@ export abstract class Logger {
|
|
|
64
78
|
}
|
|
65
79
|
const callerInfo: string = this.getCallerInfo();
|
|
66
80
|
const logLevelSymbol: string = '▼ ';
|
|
67
|
-
|
|
81
|
+
const message: string = this.getFullMessage(callerInfo, text);
|
|
82
|
+
this.logText(indentLevel, logLevelSymbol, message);
|
|
83
|
+
if (this.sendLogMessageIntoReportPortal()) {
|
|
84
|
+
rpApi.debug(message);
|
|
85
|
+
}
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
/**
|
|
@@ -84,13 +102,21 @@ export abstract class Logger {
|
|
|
84
102
|
}
|
|
85
103
|
const callerInfo: string = this.getCallerInfo();
|
|
86
104
|
const logLevelSymbol: string = '‣ ';
|
|
87
|
-
|
|
105
|
+
const message: string = this.getFullMessage(callerInfo, text);
|
|
106
|
+
this.logText(indentLevel, logLevelSymbol, message);
|
|
107
|
+
if (this.sendLogMessageIntoReportPortal()) {
|
|
108
|
+
rpApi.trace(message);
|
|
109
|
+
}
|
|
88
110
|
}
|
|
89
111
|
|
|
90
112
|
private static getFullMessage(callerInfo: string, text: string): string {
|
|
91
113
|
return `${callerInfo}${this.separator(text, callerInfo)}${text}`;
|
|
92
114
|
}
|
|
93
115
|
|
|
116
|
+
private static separator(text: string, caller: string): string {
|
|
117
|
+
return text ? (caller ? ' - ' : '') : '';
|
|
118
|
+
}
|
|
119
|
+
|
|
94
120
|
private static logText(messageIndentationLevel: number, logLevelSymbol: string, text: string): void {
|
|
95
121
|
if (text) {
|
|
96
122
|
// start group for every level
|
|
@@ -107,14 +133,26 @@ export abstract class Logger {
|
|
|
107
133
|
}
|
|
108
134
|
}
|
|
109
135
|
|
|
110
|
-
private static getCallerInfo(): string {
|
|
111
|
-
const
|
|
112
|
-
const stack: string[] = e.stack ? e.stack.split('\n') : [];
|
|
136
|
+
private static getCallerInfo(i: number = 4): string {
|
|
137
|
+
const stack: string[] = this.getCallStackArray();
|
|
113
138
|
// " at functionName ( ..." => "functionName"
|
|
114
|
-
return stack[
|
|
139
|
+
return stack[i].includes('.<anonymous') ? '' : stack[i].replace(/^\s+at\s+(.+?)\s.+/g, '$1');
|
|
115
140
|
}
|
|
116
141
|
|
|
117
|
-
private static
|
|
118
|
-
|
|
142
|
+
private static getCallStackArray(): string[] {
|
|
143
|
+
const e: Error = new Error();
|
|
144
|
+
return e.stack ? e.stack.split('\n') : [];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private static sendLogMessageIntoReportPortal(): boolean {
|
|
148
|
+
return REPORTER_CONSTANTS.SAVE_RP_REPORT_DATA && !this.isRootCaller();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private static isRootCaller(traceLevel: number = 6): boolean {
|
|
152
|
+
return this.getCallStackArray()
|
|
153
|
+
.slice(traceLevel, traceLevel + 4)
|
|
154
|
+
.reduce((acc, e): boolean => {
|
|
155
|
+
return acc || /MochaHooks|CheReporter/.test(e);
|
|
156
|
+
}, false);
|
|
119
157
|
}
|
|
120
158
|
}
|
|
@@ -11,33 +11,33 @@
|
|
|
11
11
|
import { WorkspaceStatus } from './WorkspaceStatus';
|
|
12
12
|
|
|
13
13
|
export interface ITestWorkspaceUtil {
|
|
14
|
-
waitWorkspaceStatus(
|
|
14
|
+
waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus): Promise<void>;
|
|
15
15
|
|
|
16
|
-
stopWorkspaceByName(workspaceName: string): void
|
|
16
|
+
stopWorkspaceByName(workspaceName: string): Promise<void>;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* delete a workspace without stopping phase (similar with force deleting)
|
|
20
20
|
*/
|
|
21
|
-
deleteWorkspaceByName(workspaceName: string): void
|
|
21
|
+
deleteWorkspaceByName(workspaceName: string): Promise<void>;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* stop workspace before deleting with checking stopping phase
|
|
25
25
|
*/
|
|
26
|
-
stopAndDeleteWorkspaceByName(workspaceName: string): void
|
|
26
|
+
stopAndDeleteWorkspaceByName(workspaceName: string): Promise<void>;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* stop all run workspaces in the namespace
|
|
30
30
|
*/
|
|
31
|
-
stopAllRunningWorkspaces(
|
|
31
|
+
stopAllRunningWorkspaces(): Promise<void>;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* stop all run workspaces, check statused and remove the workspaces
|
|
35
35
|
*/
|
|
36
|
-
stopAndDeleteAllRunningWorkspaces(
|
|
36
|
+
stopAndDeleteAllRunningWorkspaces(): Promise<void>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* stop all run workspaces without stopping and waiting for of 'Stopped' phase
|
|
40
40
|
* Similar with 'force' deleting
|
|
41
41
|
*/
|
|
42
|
-
deleteAllWorkspaces(
|
|
42
|
+
deleteAllWorkspaces(): Promise<void>;
|
|
43
43
|
}
|