qase-javascript-commons 2.3.6 → 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/README.md +0 -15
- package/changelog.md +0 -6
- package/dist/client/clientV1.d.ts +1 -28
- package/dist/client/clientV1.js +12 -138
- package/dist/client/clientV2.js +3 -0
- package/dist/client/interface.d.ts +2 -1
- package/dist/config/config-validation-schema.d.ts +3 -174
- package/dist/config/config-validation-schema.js +0 -28
- package/dist/env/env-enum.d.ts +0 -7
- package/dist/env/env-enum.js +1 -9
- package/dist/env/env-to-config.js +0 -7
- package/dist/env/env-type.d.ts +1 -3
- package/dist/env/env-validation-schema.js +0 -8
- package/dist/models/config/TestOpsOptionsType.d.ts +0 -9
- package/dist/models/index.d.ts +0 -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
- package/dist/models/configuration.d.ts +0 -12
- package/dist/models/configuration.js +0 -2
package/README.md
CHANGED
|
@@ -58,8 +58,6 @@ All configuration options are listed in the table below:
|
|
|
58
58
|
| Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
|
|
59
59
|
| Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
|
|
60
60
|
| Enable/disable attachment uploads | `testops.uploadAttachments` | `QASE_TESTOPS_UPLOAD_ATTACHMENTS` | `true` | No | `True`, `False` |
|
|
61
|
-
| 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 |
|
|
62
|
-
| Create configuration groups if they don't exist | `testops.configurations.createIfNotExists` | `QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS` | `false` | No | `True`, `False` |
|
|
63
61
|
|
|
64
62
|
### Example `qase.config.json` config:
|
|
65
63
|
|
|
@@ -94,19 +92,6 @@ All configuration options are listed in the table below:
|
|
|
94
92
|
"project": "<project_code>",
|
|
95
93
|
"batch": {
|
|
96
94
|
"size": 100
|
|
97
|
-
},
|
|
98
|
-
"configurations": {
|
|
99
|
-
"values": [
|
|
100
|
-
{
|
|
101
|
-
"name": "group1",
|
|
102
|
-
"value": "value1"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"name": "group2",
|
|
106
|
-
"value": "value2"
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
"createIfNotExists": true
|
|
110
95
|
}
|
|
111
96
|
}
|
|
112
97
|
}
|
package/changelog.md
CHANGED
|
@@ -11,43 +11,16 @@ export declare class ClientV1 implements IClient {
|
|
|
11
11
|
private readonly runClient;
|
|
12
12
|
private readonly environmentClient;
|
|
13
13
|
private readonly attachmentClient;
|
|
14
|
-
private readonly configurationClient;
|
|
15
14
|
constructor(logger: LoggerInterface, config: TestOpsOptionsType, environment: string | undefined);
|
|
16
15
|
private createApiConfig;
|
|
17
16
|
uploadResults(_runId: number, _results: TestResultType[]): Promise<void>;
|
|
18
17
|
createRun(): Promise<number>;
|
|
19
18
|
completeRun(runId: number): Promise<void>;
|
|
19
|
+
uploadAttachment(attachment: Attachment): Promise<string>;
|
|
20
20
|
protected uploadAttachments(attachments: Attachment[]): Promise<string[]>;
|
|
21
21
|
private prepareAttachmentData;
|
|
22
22
|
private getEnvironmentId;
|
|
23
23
|
private prepareRunObject;
|
|
24
|
-
/**
|
|
25
|
-
* Get all configuration groups with their configurations
|
|
26
|
-
* @returns Promise<ConfigurationGroup[]> Array of configuration groups
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
private getConfigurations;
|
|
30
|
-
/**
|
|
31
|
-
* Create a configuration group
|
|
32
|
-
* @param title Group title
|
|
33
|
-
* @returns Promise<number | undefined> Created group ID
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
private createConfigurationGroup;
|
|
37
|
-
/**
|
|
38
|
-
* Create a configuration in a group
|
|
39
|
-
* @param title Configuration title
|
|
40
|
-
* @param groupId Group ID
|
|
41
|
-
* @returns Promise<number | undefined> Created configuration ID
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
private createConfiguration;
|
|
45
|
-
/**
|
|
46
|
-
* Handle configuration creation based on config settings
|
|
47
|
-
* @returns Promise<number[]> Array of configuration IDs
|
|
48
|
-
* @private
|
|
49
|
-
*/
|
|
50
|
-
private handleConfigurations;
|
|
51
24
|
/**
|
|
52
25
|
* Process error and throw QaseError
|
|
53
26
|
* @param {Error | AxiosError} error
|
package/dist/client/clientV1.js
CHANGED
|
@@ -31,7 +31,6 @@ class ClientV1 {
|
|
|
31
31
|
runClient;
|
|
32
32
|
environmentClient;
|
|
33
33
|
attachmentClient;
|
|
34
|
-
configurationClient;
|
|
35
34
|
constructor(logger, config, environment) {
|
|
36
35
|
this.logger = logger;
|
|
37
36
|
this.config = config;
|
|
@@ -41,7 +40,6 @@ class ClientV1 {
|
|
|
41
40
|
this.runClient = new qase_api_client_1.RunsApi(apiConfig);
|
|
42
41
|
this.environmentClient = new qase_api_client_1.EnvironmentsApi(apiConfig);
|
|
43
42
|
this.attachmentClient = new qase_api_client_1.AttachmentsApi(apiConfig);
|
|
44
|
-
this.configurationClient = new qase_api_client_1.ConfigurationsApi(apiConfig);
|
|
45
43
|
}
|
|
46
44
|
createApiConfig() {
|
|
47
45
|
const apiConfig = new qase_api_client_1.Configuration({ apiKey: this.config.api.token, formDataCtor: form_data_1.default });
|
|
@@ -61,13 +59,8 @@ class ClientV1 {
|
|
|
61
59
|
return this.config.run.id;
|
|
62
60
|
}
|
|
63
61
|
try {
|
|
64
|
-
// Handle configurations if provided
|
|
65
|
-
let configurationIds = [];
|
|
66
|
-
if (this.config.configurations) {
|
|
67
|
-
configurationIds = await this.handleConfigurations();
|
|
68
|
-
}
|
|
69
62
|
const environmentId = await this.getEnvironmentId();
|
|
70
|
-
const runObject = this.prepareRunObject(environmentId
|
|
63
|
+
const runObject = this.prepareRunObject(environmentId);
|
|
71
64
|
this.logger.logDebug(`Creating test run: ${JSON.stringify(runObject)}`);
|
|
72
65
|
const { data } = await this.runClient.createRun(this.config.project, runObject);
|
|
73
66
|
if (!data.result?.id) {
|
|
@@ -95,6 +88,16 @@ class ClientV1 {
|
|
|
95
88
|
this.logger.log((0, chalk_1.default) `{blue Test run link: ${runUrl}}`);
|
|
96
89
|
}
|
|
97
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
|
+
}
|
|
98
101
|
async uploadAttachments(attachments) {
|
|
99
102
|
if (!this.config.uploadAttachments) {
|
|
100
103
|
return [];
|
|
@@ -136,7 +139,7 @@ class ClientV1 {
|
|
|
136
139
|
const { data } = await this.environmentClient.getEnvironments(this.config.project, undefined, this.environment, 100);
|
|
137
140
|
return data.result?.entities?.find((env) => env.slug === this.environment)?.id;
|
|
138
141
|
}
|
|
139
|
-
prepareRunObject(environmentId
|
|
142
|
+
prepareRunObject(environmentId) {
|
|
140
143
|
const runObject = {
|
|
141
144
|
title: this.config.run.title ?? `Automated run ${new Date().toISOString()}`,
|
|
142
145
|
description: this.config.run.description ?? '',
|
|
@@ -151,137 +154,8 @@ class ClientV1 {
|
|
|
151
154
|
if (this.config.plan.id) {
|
|
152
155
|
runObject.plan_id = this.config.plan.id;
|
|
153
156
|
}
|
|
154
|
-
if (configurationIds && configurationIds.length > 0) {
|
|
155
|
-
runObject.configurations = configurationIds;
|
|
156
|
-
}
|
|
157
157
|
return runObject;
|
|
158
158
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Get all configuration groups with their configurations
|
|
161
|
-
* @returns Promise<ConfigurationGroup[]> Array of configuration groups
|
|
162
|
-
* @private
|
|
163
|
-
*/
|
|
164
|
-
async getConfigurations() {
|
|
165
|
-
try {
|
|
166
|
-
const { data } = await this.configurationClient.getConfigurations(this.config.project);
|
|
167
|
-
const entities = data.result?.entities ?? [];
|
|
168
|
-
// Convert API response to domain model
|
|
169
|
-
return entities.map(group => ({
|
|
170
|
-
id: group.id ?? 0,
|
|
171
|
-
title: group.title ?? '',
|
|
172
|
-
configurations: group.configurations?.map(config => ({
|
|
173
|
-
id: config.id ?? 0,
|
|
174
|
-
title: config.title ?? ''
|
|
175
|
-
})) ?? []
|
|
176
|
-
}));
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
throw this.processError(error, 'Error getting configurations');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Create a configuration group
|
|
184
|
-
* @param title Group title
|
|
185
|
-
* @returns Promise<number | undefined> Created group ID
|
|
186
|
-
* @private
|
|
187
|
-
*/
|
|
188
|
-
async createConfigurationGroup(title) {
|
|
189
|
-
try {
|
|
190
|
-
const group = { title };
|
|
191
|
-
const { data } = await this.configurationClient.createConfigurationGroup(this.config.project, group);
|
|
192
|
-
return data.result?.id;
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
throw this.processError(error, 'Error creating configuration group');
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Create a configuration in a group
|
|
200
|
-
* @param title Configuration title
|
|
201
|
-
* @param groupId Group ID
|
|
202
|
-
* @returns Promise<number | undefined> Created configuration ID
|
|
203
|
-
* @private
|
|
204
|
-
*/
|
|
205
|
-
async createConfiguration(title, groupId) {
|
|
206
|
-
try {
|
|
207
|
-
const config = { title, group_id: groupId };
|
|
208
|
-
const { data } = await this.configurationClient.createConfiguration(this.config.project, config);
|
|
209
|
-
return data.result?.id;
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
throw this.processError(error, 'Error creating configuration');
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Handle configuration creation based on config settings
|
|
217
|
-
* @returns Promise<number[]> Array of configuration IDs
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
async handleConfigurations() {
|
|
221
|
-
if (!this.config.configurations?.values.length) {
|
|
222
|
-
return [];
|
|
223
|
-
}
|
|
224
|
-
const configurationIds = [];
|
|
225
|
-
try {
|
|
226
|
-
// Get existing configuration groups
|
|
227
|
-
const existingGroups = await this.getConfigurations();
|
|
228
|
-
for (const configValue of this.config.configurations.values) {
|
|
229
|
-
const { name: groupName, value: configName } = configValue;
|
|
230
|
-
// Find existing group or create new one
|
|
231
|
-
const group = existingGroups.find(g => g.title === groupName);
|
|
232
|
-
let groupId;
|
|
233
|
-
if (group) {
|
|
234
|
-
groupId = group.id;
|
|
235
|
-
this.logger.logDebug(`Found existing configuration group: ${groupName}`);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
if (this.config.configurations.createIfNotExists) {
|
|
239
|
-
const newGroupId = await this.createConfigurationGroup(groupName);
|
|
240
|
-
if (newGroupId) {
|
|
241
|
-
groupId = newGroupId;
|
|
242
|
-
this.logger.logDebug(`Created new configuration group: ${groupName} with ID: ${groupId}`);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
this.logger.logDebug(`Failed to create configuration group: ${groupName}, skipping`);
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
this.logger.logDebug(`Configuration group not found: ${groupName}, skipping`);
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (groupId) {
|
|
255
|
-
// Check if configuration already exists in the group
|
|
256
|
-
const existingConfig = group?.configurations.find(c => c.title === configName);
|
|
257
|
-
if (!existingConfig) {
|
|
258
|
-
// Check if we should create configuration if it doesn't exist
|
|
259
|
-
if (this.config.configurations.createIfNotExists) {
|
|
260
|
-
const configId = await this.createConfiguration(configName, groupId);
|
|
261
|
-
if (configId) {
|
|
262
|
-
configurationIds.push(configId);
|
|
263
|
-
}
|
|
264
|
-
this.logger.logDebug(`Created configuration: ${configName} in group: ${groupName}`);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
this.logger.logDebug(`Configuration not found: ${configName} in group: ${groupName}, skipping`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
if (existingConfig.id) {
|
|
272
|
-
configurationIds.push(existingConfig.id);
|
|
273
|
-
}
|
|
274
|
-
this.logger.logDebug(`Configuration already exists: ${configName} in group: ${groupName}`);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
catch (error) {
|
|
280
|
-
this.logger.logError('Error handling configurations:', error);
|
|
281
|
-
// Don't throw error to avoid blocking test run creation
|
|
282
|
-
}
|
|
283
|
-
return configurationIds;
|
|
284
|
-
}
|
|
285
159
|
/**
|
|
286
160
|
* Process error and throw QaseError
|
|
287
161
|
* @param {Error | AxiosError} error
|
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
|
}
|
|
@@ -1,177 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { ConfigType } from './config-type';
|
|
3
3
|
/**
|
|
4
4
|
* @type {JSONSchemaType<ConfigType>}
|
|
5
5
|
*/
|
|
6
|
-
export declare const configValidationSchema:
|
|
7
|
-
type: string;
|
|
8
|
-
properties: {
|
|
9
|
-
mode: {
|
|
10
|
-
type: string;
|
|
11
|
-
enum: ModeEnum[];
|
|
12
|
-
nullable: boolean;
|
|
13
|
-
};
|
|
14
|
-
fallback: {
|
|
15
|
-
type: string;
|
|
16
|
-
enum: ModeEnum[];
|
|
17
|
-
nullable: boolean;
|
|
18
|
-
};
|
|
19
|
-
debug: {
|
|
20
|
-
type: string;
|
|
21
|
-
nullable: boolean;
|
|
22
|
-
};
|
|
23
|
-
environment: {
|
|
24
|
-
type: string;
|
|
25
|
-
nullable: boolean;
|
|
26
|
-
};
|
|
27
|
-
captureLogs: {
|
|
28
|
-
type: string;
|
|
29
|
-
nullable: boolean;
|
|
30
|
-
};
|
|
31
|
-
rootSuite: {
|
|
32
|
-
type: string;
|
|
33
|
-
nullable: boolean;
|
|
34
|
-
};
|
|
35
|
-
testops: {
|
|
36
|
-
type: string;
|
|
37
|
-
nullable: boolean;
|
|
38
|
-
properties: {
|
|
39
|
-
api: {
|
|
40
|
-
type: string;
|
|
41
|
-
nullable: boolean;
|
|
42
|
-
properties: {
|
|
43
|
-
token: {
|
|
44
|
-
type: string;
|
|
45
|
-
nullable: boolean;
|
|
46
|
-
};
|
|
47
|
-
host: {
|
|
48
|
-
type: string;
|
|
49
|
-
nullable: boolean;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
project: {
|
|
54
|
-
type: string;
|
|
55
|
-
nullable: boolean;
|
|
56
|
-
};
|
|
57
|
-
uploadAttachments: {
|
|
58
|
-
type: string;
|
|
59
|
-
nullable: boolean;
|
|
60
|
-
};
|
|
61
|
-
run: {
|
|
62
|
-
type: string;
|
|
63
|
-
nullable: boolean;
|
|
64
|
-
properties: {
|
|
65
|
-
id: {
|
|
66
|
-
type: string;
|
|
67
|
-
nullable: boolean;
|
|
68
|
-
};
|
|
69
|
-
title: {
|
|
70
|
-
type: string;
|
|
71
|
-
nullable: boolean;
|
|
72
|
-
};
|
|
73
|
-
description: {
|
|
74
|
-
type: string;
|
|
75
|
-
nullable: boolean;
|
|
76
|
-
};
|
|
77
|
-
complete: {
|
|
78
|
-
type: string;
|
|
79
|
-
nullable: boolean;
|
|
80
|
-
};
|
|
81
|
-
tags: {
|
|
82
|
-
type: string;
|
|
83
|
-
items: {
|
|
84
|
-
type: string;
|
|
85
|
-
};
|
|
86
|
-
nullable: boolean;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
plan: {
|
|
91
|
-
type: string;
|
|
92
|
-
nullable: boolean;
|
|
93
|
-
properties: {
|
|
94
|
-
id: {
|
|
95
|
-
type: string;
|
|
96
|
-
nullable: boolean;
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
batch: {
|
|
101
|
-
type: string;
|
|
102
|
-
nullable: boolean;
|
|
103
|
-
properties: {
|
|
104
|
-
size: {
|
|
105
|
-
type: string;
|
|
106
|
-
nullable: boolean;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
defect: {
|
|
111
|
-
type: string;
|
|
112
|
-
nullable: boolean;
|
|
113
|
-
};
|
|
114
|
-
configurations: {
|
|
115
|
-
type: string;
|
|
116
|
-
nullable: boolean;
|
|
117
|
-
properties: {
|
|
118
|
-
values: {
|
|
119
|
-
type: string;
|
|
120
|
-
items: {
|
|
121
|
-
type: string;
|
|
122
|
-
properties: {
|
|
123
|
-
name: {
|
|
124
|
-
type: string;
|
|
125
|
-
nullable: boolean;
|
|
126
|
-
};
|
|
127
|
-
value: {
|
|
128
|
-
type: string;
|
|
129
|
-
nullable: boolean;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
required: string[];
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
createIfNotExists: {
|
|
136
|
-
type: string;
|
|
137
|
-
nullable: boolean;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
required: string[];
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
report: {
|
|
145
|
-
type: string;
|
|
146
|
-
nullable: boolean;
|
|
147
|
-
properties: {
|
|
148
|
-
driver: {
|
|
149
|
-
type: string;
|
|
150
|
-
enum: DriverEnum[];
|
|
151
|
-
nullable: boolean;
|
|
152
|
-
};
|
|
153
|
-
connections: {
|
|
154
|
-
type: string;
|
|
155
|
-
nullable: boolean;
|
|
156
|
-
properties: {
|
|
157
|
-
local: {
|
|
158
|
-
type: string;
|
|
159
|
-
nullable: boolean;
|
|
160
|
-
properties: {
|
|
161
|
-
path: {
|
|
162
|
-
type: string;
|
|
163
|
-
nullable: boolean;
|
|
164
|
-
};
|
|
165
|
-
format: {
|
|
166
|
-
type: string;
|
|
167
|
-
enum: FormatEnum[];
|
|
168
|
-
nullable: boolean;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
};
|
|
6
|
+
export declare const configValidationSchema: JSONSchemaType<ConfigType>;
|
|
@@ -114,34 +114,6 @@ exports.configValidationSchema = {
|
|
|
114
114
|
type: 'boolean',
|
|
115
115
|
nullable: true,
|
|
116
116
|
},
|
|
117
|
-
configurations: {
|
|
118
|
-
type: 'object',
|
|
119
|
-
nullable: true,
|
|
120
|
-
properties: {
|
|
121
|
-
values: {
|
|
122
|
-
type: 'array',
|
|
123
|
-
items: {
|
|
124
|
-
type: 'object',
|
|
125
|
-
properties: {
|
|
126
|
-
name: {
|
|
127
|
-
type: 'string',
|
|
128
|
-
nullable: true,
|
|
129
|
-
},
|
|
130
|
-
value: {
|
|
131
|
-
type: 'string',
|
|
132
|
-
nullable: true,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
required: ['name', 'value'],
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
createIfNotExists: {
|
|
139
|
-
type: 'boolean',
|
|
140
|
-
nullable: true,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
required: ['values'],
|
|
144
|
-
},
|
|
145
117
|
},
|
|
146
118
|
},
|
|
147
119
|
report: {
|
package/dist/env/env-enum.d.ts
CHANGED
|
@@ -46,13 +46,6 @@ export declare enum EnvPlanEnum {
|
|
|
46
46
|
export declare enum EnvBatchEnum {
|
|
47
47
|
size = "QASE_TESTOPS_BATCH_SIZE"
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
* @enum {string}
|
|
51
|
-
*/
|
|
52
|
-
export declare enum EnvConfigurationsEnum {
|
|
53
|
-
values = "QASE_TESTOPS_CONFIGURATIONS_VALUES",
|
|
54
|
-
createIfNotExists = "QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS"
|
|
55
|
-
}
|
|
56
49
|
/**
|
|
57
50
|
* @enum {string}
|
|
58
51
|
*/
|
package/dist/env/env-enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvLocalEnum = exports.
|
|
3
|
+
exports.EnvLocalEnum = exports.EnvBatchEnum = exports.EnvPlanEnum = exports.EnvRunEnum = exports.EnvApiEnum = exports.EnvTestOpsEnum = exports.EnvEnum = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @enum {string}
|
|
6
6
|
*/
|
|
@@ -55,14 +55,6 @@ var EnvBatchEnum;
|
|
|
55
55
|
(function (EnvBatchEnum) {
|
|
56
56
|
EnvBatchEnum["size"] = "QASE_TESTOPS_BATCH_SIZE";
|
|
57
57
|
})(EnvBatchEnum || (exports.EnvBatchEnum = EnvBatchEnum = {}));
|
|
58
|
-
/**
|
|
59
|
-
* @enum {string}
|
|
60
|
-
*/
|
|
61
|
-
var EnvConfigurationsEnum;
|
|
62
|
-
(function (EnvConfigurationsEnum) {
|
|
63
|
-
EnvConfigurationsEnum["values"] = "QASE_TESTOPS_CONFIGURATIONS_VALUES";
|
|
64
|
-
EnvConfigurationsEnum["createIfNotExists"] = "QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS";
|
|
65
|
-
})(EnvConfigurationsEnum || (exports.EnvConfigurationsEnum = EnvConfigurationsEnum = {}));
|
|
66
58
|
/**
|
|
67
59
|
* @enum {string}
|
|
68
60
|
*/
|
|
@@ -34,13 +34,6 @@ const envToConfig = (env) => ({
|
|
|
34
34
|
size: env[env_enum_1.EnvBatchEnum.size],
|
|
35
35
|
},
|
|
36
36
|
defect: env[env_enum_1.EnvTestOpsEnum.defect],
|
|
37
|
-
configurations: env[env_enum_1.EnvConfigurationsEnum.values] ? {
|
|
38
|
-
values: env[env_enum_1.EnvConfigurationsEnum.values].split(',').map(item => {
|
|
39
|
-
const [name, value] = item.split('=');
|
|
40
|
-
return { name: (name ?? '').trim(), value: value ? value.trim() : '' };
|
|
41
|
-
}),
|
|
42
|
-
createIfNotExists: env[env_enum_1.EnvConfigurationsEnum.createIfNotExists],
|
|
43
|
-
} : undefined,
|
|
44
37
|
},
|
|
45
38
|
report: {
|
|
46
39
|
connections: {
|
package/dist/env/env-type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum, EnvBatchEnum
|
|
1
|
+
import { EnvEnum, EnvTestOpsEnum, EnvApiEnum, EnvRunEnum, EnvLocalEnum, EnvPlanEnum, EnvBatchEnum } from './env-enum';
|
|
2
2
|
import { ModeEnum } from '../options';
|
|
3
3
|
import { FormatEnum } from '../writer';
|
|
4
4
|
export interface EnvType {
|
|
@@ -20,8 +20,6 @@ export interface EnvType {
|
|
|
20
20
|
[EnvRunEnum.tags]?: string;
|
|
21
21
|
[EnvPlanEnum.id]?: number;
|
|
22
22
|
[EnvBatchEnum.size]?: number;
|
|
23
|
-
[EnvConfigurationsEnum.values]?: string;
|
|
24
|
-
[EnvConfigurationsEnum.createIfNotExists]?: boolean;
|
|
25
23
|
[EnvLocalEnum.path]?: string;
|
|
26
24
|
[EnvLocalEnum.format]?: `${FormatEnum}`;
|
|
27
25
|
}
|
|
@@ -84,14 +84,6 @@ exports.envValidationSchema = {
|
|
|
84
84
|
type: 'number',
|
|
85
85
|
nullable: true,
|
|
86
86
|
},
|
|
87
|
-
[env_enum_1.EnvConfigurationsEnum.values]: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
nullable: true,
|
|
90
|
-
},
|
|
91
|
-
[env_enum_1.EnvConfigurationsEnum.createIfNotExists]: {
|
|
92
|
-
type: 'boolean',
|
|
93
|
-
nullable: true,
|
|
94
|
-
},
|
|
95
87
|
[env_enum_1.EnvLocalEnum.path]: {
|
|
96
88
|
type: 'string',
|
|
97
89
|
nullable: true,
|
|
@@ -6,15 +6,6 @@ export interface TestOpsOptionsType {
|
|
|
6
6
|
plan: TestOpsPlanType;
|
|
7
7
|
batch?: TestOpsBatchType;
|
|
8
8
|
defect?: boolean | undefined;
|
|
9
|
-
configurations?: TestOpsConfigurationType | undefined;
|
|
10
|
-
}
|
|
11
|
-
export interface TestOpsConfigurationType {
|
|
12
|
-
values: TestOpsConfigurationValueType[];
|
|
13
|
-
createIfNotExists?: boolean | undefined;
|
|
14
|
-
}
|
|
15
|
-
export interface TestOpsConfigurationValueType {
|
|
16
|
-
name: string;
|
|
17
|
-
value: string;
|
|
18
9
|
}
|
|
19
10
|
export interface TestOpsRunType {
|
|
20
11
|
id?: number | undefined;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export { StepStatusEnum } from './step-execution';
|
|
|
5
5
|
export { Attachment } from './attachment';
|
|
6
6
|
export { Report } from './report';
|
|
7
7
|
export { CompoundError } from './error';
|
|
8
|
-
export { ConfigurationGroup, ConfigurationItem, ConfigurationGroupResponse } from './configuration';
|
|
@@ -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
|
*/
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface ConfigurationGroup {
|
|
2
|
-
id: number;
|
|
3
|
-
title: string;
|
|
4
|
-
configurations: ConfigurationItem[];
|
|
5
|
-
}
|
|
6
|
-
export interface ConfigurationItem {
|
|
7
|
-
id: number;
|
|
8
|
-
title: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ConfigurationGroupResponse {
|
|
11
|
-
groups: ConfigurationGroup[];
|
|
12
|
-
}
|