qase-javascript-commons 2.3.5 → 2.4.0-beta.1
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/dist/client/clientV1.d.ts +1 -0
- package/dist/client/clientV1.js +10 -0
- package/dist/client/clientV2.js +3 -0
- package/dist/client/interface.d.ts +2 -1
- package/dist/models/test-result.d.ts +1 -0
- package/dist/models/test-result.js +2 -0
- package/dist/qase.d.ts +3 -1
- package/dist/qase.js +9 -0
- package/dist/reporters/abstract-reporter.d.ts +7 -1
- package/dist/reporters/report-reporter.d.ts +2 -0
- package/dist/reporters/report-reporter.js +4 -0
- package/dist/reporters/testops-reporter.d.ts +6 -1
- package/dist/reporters/testops-reporter.js +7 -0
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ export declare class ClientV1 implements IClient {
|
|
|
16
16
|
uploadResults(_runId: number, _results: TestResultType[]): Promise<void>;
|
|
17
17
|
createRun(): Promise<number>;
|
|
18
18
|
completeRun(runId: number): Promise<void>;
|
|
19
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
19
20
|
protected uploadAttachments(attachments: Attachment[]): Promise<string[]>;
|
|
20
21
|
private prepareAttachmentData;
|
|
21
22
|
private getEnvironmentId;
|
package/dist/client/clientV1.js
CHANGED
|
@@ -88,6 +88,16 @@ class ClientV1 {
|
|
|
88
88
|
this.logger.log((0, chalk_1.default) `{blue Test run link: ${runUrl}}`);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
async uploadAttachment(attachment) {
|
|
92
|
+
try {
|
|
93
|
+
const data = this.prepareAttachmentData(attachment);
|
|
94
|
+
const response = await this.attachmentClient.uploadAttachment(this.config.project, [data]);
|
|
95
|
+
return response.data.result?.[0]?.hash ?? '';
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
throw this.processError(error, 'Error on uploading attachment');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
91
101
|
async uploadAttachments(attachments) {
|
|
92
102
|
if (!this.config.uploadAttachments) {
|
|
93
103
|
return [];
|
package/dist/client/clientV2.js
CHANGED
|
@@ -57,6 +57,9 @@ class ClientV2 extends clientV1_1.ClientV1 {
|
|
|
57
57
|
}
|
|
58
58
|
async transformTestResult(result) {
|
|
59
59
|
const attachments = await this.uploadAttachments(result.attachments);
|
|
60
|
+
if (result.preparedAttachments) {
|
|
61
|
+
attachments.push(...result.preparedAttachments);
|
|
62
|
+
}
|
|
60
63
|
const steps = await this.transformSteps(result.steps, result.title);
|
|
61
64
|
const params = this.transformParams(result.params);
|
|
62
65
|
const groupParams = this.transformGroupParams(result.group_params, params);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { TestResultType } from "../models";
|
|
1
|
+
import { Attachment, TestResultType } from "../models";
|
|
2
2
|
export interface IClient {
|
|
3
3
|
createRun(): Promise<number>;
|
|
4
4
|
completeRun(runId: number): Promise<void>;
|
|
5
5
|
uploadResults(runId: number, results: TestResultType[]): Promise<void>;
|
|
6
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
6
7
|
}
|
|
@@ -18,6 +18,7 @@ class TestResultType {
|
|
|
18
18
|
relations;
|
|
19
19
|
muted;
|
|
20
20
|
message;
|
|
21
|
+
preparedAttachments;
|
|
21
22
|
constructor(title) {
|
|
22
23
|
this.id = '';
|
|
23
24
|
this.title = title;
|
|
@@ -34,6 +35,7 @@ class TestResultType {
|
|
|
34
35
|
this.relations = null;
|
|
35
36
|
this.muted = false;
|
|
36
37
|
this.message = null;
|
|
38
|
+
this.preparedAttachments = [];
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
exports.TestResultType = TestResultType;
|
package/dist/qase.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OptionsType } from './options';
|
|
2
|
-
import { TestResultType } from './models';
|
|
2
|
+
import { TestResultType, Attachment } from './models';
|
|
3
3
|
export interface ReporterInterface {
|
|
4
4
|
addTestResult(result: TestResultType): Promise<void>;
|
|
5
5
|
publish(): Promise<void>;
|
|
@@ -9,6 +9,7 @@ export interface ReporterInterface {
|
|
|
9
9
|
getResults(): TestResultType[];
|
|
10
10
|
sendResults(): Promise<void>;
|
|
11
11
|
complete(): Promise<void>;
|
|
12
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* @class QaseReporter
|
|
@@ -49,6 +50,7 @@ export declare class QaseReporter implements ReporterInterface {
|
|
|
49
50
|
* @param {OptionsType} options
|
|
50
51
|
*/
|
|
51
52
|
private constructor();
|
|
53
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
52
54
|
getResults(): TestResultType[];
|
|
53
55
|
setTestResults(results: TestResultType[]): void;
|
|
54
56
|
sendResults(): Promise<void>;
|
package/dist/qase.js
CHANGED
|
@@ -136,6 +136,15 @@ class QaseReporter {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
async uploadAttachment(attachment) {
|
|
140
|
+
if (this.disabled) {
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
if (this.useFallback) {
|
|
144
|
+
return await this.fallbackReporter?.uploadAttachment(attachment) ?? '';
|
|
145
|
+
}
|
|
146
|
+
return await this.upstreamReporter?.uploadAttachment(attachment) ?? '';
|
|
147
|
+
}
|
|
139
148
|
getResults() {
|
|
140
149
|
if (this.disabled) {
|
|
141
150
|
return [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestResultType } from '../models';
|
|
1
|
+
import { Attachment, TestResultType } from '../models';
|
|
2
2
|
import { LoggerInterface } from '../utils/logger';
|
|
3
3
|
export interface InternalReporterInterface {
|
|
4
4
|
addTestResult(result: TestResultType): Promise<void>;
|
|
@@ -8,6 +8,7 @@ export interface InternalReporterInterface {
|
|
|
8
8
|
setTestResults(results: TestResultType[]): void;
|
|
9
9
|
sendResults(): Promise<void>;
|
|
10
10
|
complete(): Promise<void>;
|
|
11
|
+
uploadAttachment(attachments: Attachment): Promise<string>;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* @abstract
|
|
@@ -41,6 +42,11 @@ export declare abstract class AbstractReporter implements InternalReporterInterf
|
|
|
41
42
|
* @returns {Promise<void>}
|
|
42
43
|
*/
|
|
43
44
|
abstract sendResults(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {Attachment} attachment
|
|
47
|
+
* @returns {Promise<string>}
|
|
48
|
+
*/
|
|
49
|
+
abstract uploadAttachment(attachment: Attachment): Promise<string>;
|
|
44
50
|
/**
|
|
45
51
|
* @protected
|
|
46
52
|
* @param {LoggerInterface} logger
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbstractReporter } from './abstract-reporter';
|
|
2
|
+
import { Attachment } from '../models';
|
|
2
3
|
import { WriterInterface } from '../writer';
|
|
3
4
|
import { LoggerInterface } from '../utils/logger';
|
|
4
5
|
/**
|
|
@@ -34,6 +35,7 @@ export declare class ReportReporter extends AbstractReporter {
|
|
|
34
35
|
publish(): Promise<void>;
|
|
35
36
|
sendResults(): Promise<void>;
|
|
36
37
|
complete(): Promise<void>;
|
|
38
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
37
39
|
/**
|
|
38
40
|
* @param {TestStepType[]} steps
|
|
39
41
|
* @returns {TestStepType[]}
|
|
@@ -134,6 +134,10 @@ class ReportReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
134
134
|
const path = await this.writer.writeReport(report);
|
|
135
135
|
this.logger.log(`Report saved to ${path}`);
|
|
136
136
|
}
|
|
137
|
+
uploadAttachment(attachment) {
|
|
138
|
+
this.writer.writeAttachment([attachment]);
|
|
139
|
+
return Promise.resolve('');
|
|
140
|
+
}
|
|
137
141
|
/**
|
|
138
142
|
* @param {TestStepType[]} steps
|
|
139
143
|
* @returns {TestStepType[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractReporter } from './abstract-reporter';
|
|
2
|
-
import { TestResultType } from '../models';
|
|
2
|
+
import { Attachment, TestResultType } from '../models';
|
|
3
3
|
import { LoggerInterface } from '../utils/logger';
|
|
4
4
|
import { IClient } from '../client/interface';
|
|
5
5
|
/**
|
|
@@ -52,6 +52,11 @@ export declare class TestOpsReporter extends AbstractReporter {
|
|
|
52
52
|
* @returns {Promise<void>}
|
|
53
53
|
*/
|
|
54
54
|
sendResults(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* @param {Attachment} attachment
|
|
57
|
+
* @returns {Promise<string>}
|
|
58
|
+
*/
|
|
59
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
55
60
|
/**
|
|
56
61
|
* @returns {Promise<void>}
|
|
57
62
|
*/
|
|
@@ -133,6 +133,13 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
133
133
|
// Clear results because we don't need to send them again then we use Cypress reporter
|
|
134
134
|
this.results.length = 0;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* @param {Attachment} attachment
|
|
138
|
+
* @returns {Promise<string>}
|
|
139
|
+
*/
|
|
140
|
+
async uploadAttachment(attachment) {
|
|
141
|
+
return await this.api.uploadAttachment(attachment);
|
|
142
|
+
}
|
|
136
143
|
/**
|
|
137
144
|
* @returns {Promise<void>}
|
|
138
145
|
*/
|