qase-javascript-commons 2.4.8 → 2.4.9
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 +5 -1
- package/changelog.md +7 -0
- package/dist/client/clientV1.d.ts +2 -0
- package/dist/client/clientV1.js +19 -0
- package/dist/client/interface.d.ts +1 -0
- package/dist/env/env-enum.d.ts +2 -1
- package/dist/env/env-enum.js +1 -0
- package/dist/env/env-to-config.js +1 -0
- package/dist/env/env-type.d.ts +1 -0
- package/dist/env/env-validation-schema.js +4 -0
- package/dist/models/config/TestOpsOptionsType.d.ts +1 -0
- package/dist/qase.js +1 -1
- package/dist/reporters/testops-reporter.d.ts +2 -1
- package/dist/reporters/testops-reporter.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,6 @@ Qase JS Reporters can be configured in multiple ways:
|
|
|
29
29
|
* using a config file `qase.config.json`
|
|
30
30
|
* using environment variables
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
All configuration options are listed in the table below:
|
|
34
33
|
|
|
35
34
|
| Description | Config file | Environment variable | Default value | Required | Possible values |
|
|
@@ -67,6 +66,7 @@ All configuration options are listed in the table below:
|
|
|
67
66
|
| Filter test results by status (comma-separated list of statuses to exclude from reporting) | `testops.statusFilter` | `QASE_TESTOPS_STATUS_FILTER` | undefined | No | Array of strings (`passed`, `failed`, `skipped`, `invalid`) |
|
|
68
67
|
| Configuration values to create/find in groups (format: `group1=value1,group2=value2`) | `testops.configurations.values` | `QASE_TESTOPS_CONFIGURATIONS_VALUES` | undefined | No | Comma-separated key=value pairs |
|
|
69
68
|
| Create configuration groups if they don't exist | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `false` | No | `True`, `False` |
|
|
69
|
+
| Enable public report link generation and display after test run completion | `testops.showPublicReportLink` | `QASE_TESTOPS_SHOW_PUBLIC_REPORT_LINK` | `False` | No | `True`, `False` |
|
|
70
70
|
|
|
71
71
|
### Example `qase.config.json` config
|
|
72
72
|
|
|
@@ -112,6 +112,7 @@ All configuration options are listed in the table below:
|
|
|
112
112
|
"defect": false,
|
|
113
113
|
"project": "<project_code>",
|
|
114
114
|
"uploadAttachments": true,
|
|
115
|
+
"showPublicReportLink": true,
|
|
115
116
|
"statusFilter": ["passed", "skipped"],
|
|
116
117
|
"batch": {
|
|
117
118
|
"size": 100
|
|
@@ -151,4 +152,7 @@ export QASE_STATUS_MAPPING="invalid=failed,skipped=passed"
|
|
|
151
152
|
# Logging configuration
|
|
152
153
|
export QASE_LOGGING_CONSOLE=false # Disable console output
|
|
153
154
|
export QASE_LOGGING_FILE=true # Enable file output
|
|
155
|
+
|
|
156
|
+
# Enable public report link generation
|
|
157
|
+
export QASE_TESTOPS_SHOW_PUBLIC_REPORT_LINK=true
|
|
154
158
|
```
|
package/changelog.md
CHANGED
|
@@ -17,6 +17,8 @@ export declare class ClientV1 implements IClient {
|
|
|
17
17
|
uploadResults(_runId: number, _results: TestResultType[]): Promise<void>;
|
|
18
18
|
createRun(): Promise<number>;
|
|
19
19
|
completeRun(runId: number): Promise<void>;
|
|
20
|
+
enablePublicReport(runId: number): Promise<void>;
|
|
21
|
+
private getErrorMessage;
|
|
20
22
|
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
21
23
|
protected uploadAttachments(attachments: Attachment[]): Promise<string[]>;
|
|
22
24
|
private prepareAttachmentData;
|
package/dist/client/clientV1.js
CHANGED
|
@@ -111,6 +111,25 @@ class ClientV1 {
|
|
|
111
111
|
this.logger.log((0, chalk_1.default) `{blue Test run link: ${runUrl}}`);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
async enablePublicReport(runId) {
|
|
115
|
+
try {
|
|
116
|
+
const { data } = await this.runClient.updateRunPublicity(this.config.project, runId, { status: true });
|
|
117
|
+
if (data.result?.url) {
|
|
118
|
+
this.logger.log((0, chalk_1.default) `{blue Public report link: ${data.result.url}}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
this.logger.log((0, chalk_1.default) `{yellow Failed to generate public report link: ${this.getErrorMessage(error)}}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
getErrorMessage(error) {
|
|
126
|
+
if ((0, is_axios_error_1.isAxiosError)(error)) {
|
|
127
|
+
const err = error;
|
|
128
|
+
const errorData = err.response?.data;
|
|
129
|
+
return errorData?.errorMessage ?? errorData?.error ?? errorData?.message ?? 'Unknown API error';
|
|
130
|
+
}
|
|
131
|
+
return error instanceof Error ? error.message : 'Unknown error';
|
|
132
|
+
}
|
|
114
133
|
async uploadAttachment(attachment) {
|
|
115
134
|
try {
|
|
116
135
|
const data = this.prepareAttachmentData(attachment);
|
package/dist/env/env-enum.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare enum EnvTestOpsEnum {
|
|
|
17
17
|
project = "QASE_TESTOPS_PROJECT",
|
|
18
18
|
uploadAttachments = "QASE_TESTOPS_UPLOAD_ATTACHMENTS",
|
|
19
19
|
defect = "QASE_TESTOPS_DEFECT",
|
|
20
|
-
statusFilter = "QASE_TESTOPS_STATUS_FILTER"
|
|
20
|
+
statusFilter = "QASE_TESTOPS_STATUS_FILTER",
|
|
21
|
+
showPublicReportLink = "QASE_TESTOPS_SHOW_PUBLIC_REPORT_LINK"
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* @enum {string}
|
package/dist/env/env-enum.js
CHANGED
|
@@ -23,6 +23,7 @@ var EnvTestOpsEnum;
|
|
|
23
23
|
EnvTestOpsEnum["uploadAttachments"] = "QASE_TESTOPS_UPLOAD_ATTACHMENTS";
|
|
24
24
|
EnvTestOpsEnum["defect"] = "QASE_TESTOPS_DEFECT";
|
|
25
25
|
EnvTestOpsEnum["statusFilter"] = "QASE_TESTOPS_STATUS_FILTER";
|
|
26
|
+
EnvTestOpsEnum["showPublicReportLink"] = "QASE_TESTOPS_SHOW_PUBLIC_REPORT_LINK";
|
|
26
27
|
})(EnvTestOpsEnum || (exports.EnvTestOpsEnum = EnvTestOpsEnum = {}));
|
|
27
28
|
/**
|
|
28
29
|
* @enum {string}
|
|
@@ -22,6 +22,7 @@ const envToConfig = (env) => ({
|
|
|
22
22
|
project: env[env_enum_1.EnvTestOpsEnum.project],
|
|
23
23
|
uploadAttachments: env[env_enum_1.EnvTestOpsEnum.uploadAttachments],
|
|
24
24
|
statusFilter: env[env_enum_1.EnvTestOpsEnum.statusFilter]?.split(',').map(status => status.trim()) ?? undefined,
|
|
25
|
+
showPublicReportLink: env[env_enum_1.EnvTestOpsEnum.showPublicReportLink],
|
|
25
26
|
api: {
|
|
26
27
|
token: env[env_enum_1.EnvApiEnum.token],
|
|
27
28
|
host: env[env_enum_1.EnvApiEnum.host],
|
package/dist/env/env-type.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface EnvType {
|
|
|
13
13
|
[EnvTestOpsEnum.uploadAttachments]?: boolean;
|
|
14
14
|
[EnvTestOpsEnum.defect]?: boolean;
|
|
15
15
|
[EnvTestOpsEnum.statusFilter]?: string;
|
|
16
|
+
[EnvTestOpsEnum.showPublicReportLink]?: boolean;
|
|
16
17
|
[EnvApiEnum.token]?: string;
|
|
17
18
|
[EnvApiEnum.host]?: string;
|
|
18
19
|
[EnvRunEnum.id]?: number;
|
|
@@ -8,6 +8,7 @@ export interface TestOpsOptionsType {
|
|
|
8
8
|
defect?: boolean | undefined;
|
|
9
9
|
configurations?: TestOpsConfigurationType | undefined;
|
|
10
10
|
statusFilter?: string[] | undefined;
|
|
11
|
+
showPublicReportLink?: boolean | undefined;
|
|
11
12
|
}
|
|
12
13
|
export interface TestOpsConfigurationType {
|
|
13
14
|
values: TestOpsConfigurationValueType[];
|
package/dist/qase.js
CHANGED
|
@@ -449,7 +449,7 @@ class QaseReporter {
|
|
|
449
449
|
throw new Error(`Either "testops.project" parameter or "${env_1.EnvTestOpsEnum.project}" environment variable is required in "testops" mode`);
|
|
450
450
|
}
|
|
451
451
|
const apiClient = new clientV2_1.ClientV2(this.logger, options.testops, options.environment, options.rootSuite);
|
|
452
|
-
return new reporters_1.TestOpsReporter(this.logger, apiClient, this.withState, options.testops.project, options.testops.api.host, options.testops.batch?.size, options.testops.run?.id);
|
|
452
|
+
return new reporters_1.TestOpsReporter(this.logger, apiClient, this.withState, options.testops.project, options.testops.api.host, options.testops.batch?.size, options.testops.run?.id, options.testops.showPublicReportLink);
|
|
453
453
|
}
|
|
454
454
|
case options_1.ModeEnum.report: {
|
|
455
455
|
const localOptions = options.report?.connections?.[writer_1.DriverEnum.local];
|
|
@@ -10,6 +10,7 @@ export declare class TestOpsReporter extends AbstractReporter {
|
|
|
10
10
|
private api;
|
|
11
11
|
private withState;
|
|
12
12
|
private projectCode;
|
|
13
|
+
private showPublicReportLink?;
|
|
13
14
|
private readonly baseUrl;
|
|
14
15
|
private readonly batchSize;
|
|
15
16
|
private runId;
|
|
@@ -24,7 +25,7 @@ export declare class TestOpsReporter extends AbstractReporter {
|
|
|
24
25
|
* @param {string | undefined} baseUrl
|
|
25
26
|
* @param {number | undefined} batchSize
|
|
26
27
|
*/
|
|
27
|
-
constructor(logger: LoggerInterface, api: IClient, withState: boolean, projectCode: string, baseUrl?: string, batchSize?: number, runId?: number);
|
|
28
|
+
constructor(logger: LoggerInterface, api: IClient, withState: boolean, projectCode: string, baseUrl?: string, batchSize?: number, runId?: number, showPublicReportLink?: boolean | undefined);
|
|
28
29
|
/**
|
|
29
30
|
* @returns {Promise<void>}
|
|
30
31
|
*/
|
|
@@ -18,6 +18,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
18
18
|
api;
|
|
19
19
|
withState;
|
|
20
20
|
projectCode;
|
|
21
|
+
showPublicReportLink;
|
|
21
22
|
baseUrl;
|
|
22
23
|
batchSize;
|
|
23
24
|
runId;
|
|
@@ -32,11 +33,12 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
32
33
|
* @param {string | undefined} baseUrl
|
|
33
34
|
* @param {number | undefined} batchSize
|
|
34
35
|
*/
|
|
35
|
-
constructor(logger, api, withState, projectCode, baseUrl, batchSize, runId) {
|
|
36
|
+
constructor(logger, api, withState, projectCode, baseUrl, batchSize, runId, showPublicReportLink) {
|
|
36
37
|
super(logger);
|
|
37
38
|
this.api = api;
|
|
38
39
|
this.withState = withState;
|
|
39
40
|
this.projectCode = projectCode;
|
|
41
|
+
this.showPublicReportLink = showPublicReportLink;
|
|
40
42
|
this.baseUrl = this.getBaseUrl(baseUrl);
|
|
41
43
|
this.batchSize = batchSize ?? defaultChunkSize;
|
|
42
44
|
this.runId = runId;
|
|
@@ -148,6 +150,14 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
148
150
|
throw new Error('Run ID is not set');
|
|
149
151
|
}
|
|
150
152
|
await this.api.completeRun(this.runId);
|
|
153
|
+
if (this.showPublicReportLink) {
|
|
154
|
+
try {
|
|
155
|
+
await this.api.enablePublicReport(this.runId);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
// Error is already logged in enablePublicReport
|
|
159
|
+
}
|
|
160
|
+
}
|
|
151
161
|
this.logger.log((0, chalk_1.default) `{green Run ${this.runId} completed}`);
|
|
152
162
|
}
|
|
153
163
|
/**
|