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