qase-javascript-commons 2.1.2 → 2.2.0

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/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # qase-javascript-commons@2.1.3
2
+
3
+ ## What's new
4
+
5
+ Reporters will send all data on the results of the autotests. Including the data of the title, the description, etc.
6
+
7
+
1
8
  # qase-javascript-commons@2.1.1
2
9
 
3
10
  ## What's new
@@ -12,6 +12,7 @@ export declare class TestResultType {
12
12
  attachments: Attachment[];
13
13
  steps: TestStepType[];
14
14
  params: Record<string, string>;
15
+ group_params: Record<string, string>;
15
16
  author: string | null;
16
17
  relations: Relation | null;
17
18
  muted: boolean;
@@ -14,6 +14,7 @@ class TestResultType {
14
14
  this.attachments = [];
15
15
  this.steps = [];
16
16
  this.params = {};
17
+ this.group_params = {};
17
18
  this.author = null;
18
19
  this.relations = null;
19
20
  this.muted = false;
@@ -2,19 +2,19 @@ import { QaseApiInterface, ResultStepStatus, TestStepResultCreateStatusEnum } fr
2
2
  import { AbstractReporter } from './abstract-reporter';
3
3
  import { StepStatusEnum, TestResultType, TestStatusEnum } from '../models';
4
4
  import { LoggerInterface } from '../utils/logger';
5
- export type TestOpsRunType = {
5
+ export interface TestOpsRunType {
6
6
  id?: number | undefined;
7
7
  title: string;
8
8
  description: string;
9
9
  complete?: boolean | undefined;
10
- };
11
- export type TestOpsPlanType = {
10
+ }
11
+ export interface TestOpsPlanType {
12
12
  id?: number | undefined;
13
- };
14
- export type TestOpsBatchType = {
13
+ }
14
+ export interface TestOpsBatchType {
15
15
  size?: number | undefined;
16
- };
17
- export type TestOpsOptionsType = {
16
+ }
17
+ export interface TestOpsOptionsType {
18
18
  project: string;
19
19
  uploadAttachments?: boolean | undefined;
20
20
  run: TestOpsRunType;
@@ -22,7 +22,7 @@ export type TestOpsOptionsType = {
22
22
  batch?: TestOpsBatchType;
23
23
  defect?: boolean | undefined;
24
24
  useV2?: boolean | undefined;
25
- };
25
+ }
26
26
  /**
27
27
  * @class TestOpsReporter
28
28
  * @extends AbstractReporter
@@ -220,11 +220,32 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
220
220
  async transformTestResultV1(result) {
221
221
  const attachments = await this.uploadAttachments(result.attachments);
222
222
  const steps = await this.transformStepsV1(result.steps, result.title);
223
+ const param = {};
224
+ for (const key in result.params) {
225
+ const value = result.params[key];
226
+ if (!value) {
227
+ continue;
228
+ }
229
+ param[key] = value;
230
+ }
231
+ const group_params = [];
232
+ const keys = Object.keys(result.group_params);
233
+ if (keys.length > 0) {
234
+ group_params.push(keys);
235
+ }
236
+ for (const key in result.group_params) {
237
+ const value = result.group_params[key];
238
+ if (!value) {
239
+ continue;
240
+ }
241
+ param[key] = value;
242
+ }
223
243
  const resultCreate = {
224
244
  attachments: attachments,
225
245
  comment: result.message,
226
246
  defect: this.defect,
227
- param: result.params,
247
+ param: param,
248
+ param_groups: group_params,
228
249
  stacktrace: result.execution.stacktrace,
229
250
  start_time: result.execution.start_time ? result.execution.start_time | 0 : null,
230
251
  status: result.execution.status,
@@ -235,13 +256,24 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
235
256
  const id = Array.isArray(result.testops_id) ? null : result.testops_id;
236
257
  if (id) {
237
258
  resultCreate.case_id = id;
238
- return resultCreate;
239
259
  }
240
260
  const rootSuite = this.rootSuite ? `${this.rootSuite}\t` : '';
241
261
  resultCreate.case = {
242
262
  title: result.title,
243
- suite_title: result.relations?.suite ? `${rootSuite}${result.relations?.suite?.data.map((suite) => suite.title).join('\t')}` : rootSuite,
263
+ suite_title: result.relations?.suite ? `${rootSuite}${result.relations.suite.data.map((suite) => suite.title).join('\t')}` : rootSuite,
264
+ description: result.fields['description'] ?? null,
265
+ postconditions: result.fields['postconditions'] ?? null,
266
+ preconditions: result.fields['preconditions'] ?? null,
244
267
  };
268
+ if (result.fields['severity']) {
269
+ resultCreate.case.severity = result.fields['severity'];
270
+ }
271
+ if (result.fields['priority']) {
272
+ resultCreate.case.priority = result.fields['priority'];
273
+ }
274
+ if (result.fields['layer']) {
275
+ resultCreate.case.layer = result.fields['layer'];
276
+ }
245
277
  this.logger.logDebug(`Transformed result: ${JSON.stringify(resultCreate)}`);
246
278
  return resultCreate;
247
279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "lodash.merge": "^4.6.2",
34
34
  "lodash.mergewith": "^4.6.2",
35
35
  "mime-types": "^2.1.33",
36
- "qaseio": "~2.2.0",
36
+ "qaseio": "~2.3.0",
37
37
  "strip-ansi": "^6.0.1",
38
38
  "uuid": "^9.0.0"
39
39
  },