qase-javascript-commons 2.1.3 → 2.2.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 CHANGED
@@ -34,10 +34,10 @@ All configuration options are listed in the table below:
34
34
  | Description | Config file | Environment variable | Default value | Required | Possible values |
35
35
  |----------------------------------------------------------------------------------------------------------------------------|----------------------------|---------------------------------|-----------------------------------------|----------|----------------------------|
36
36
  | **Common** | | | | | |
37
- | Mode of reporter | `mode` | `QASE_MODE` | `testops` | No | `testops`, `report`, `off` |
37
+ | Mode of reporter | `mode` | `QASE_MODE` | `off` | No | `testops`, `report`, `off` |
38
38
  | Fallback mode of reporter | `fallback` | `QASE_FALLBACK` | `off` | No | `testops`, `report`, `off` |
39
- | Environment | `environment` | `QASE_ENVIRONMENT` | `local` | No | Any string |
40
- | Root suite | `rootSuite` | `QASE_ROOT_SUITE` | | No | Any string |
39
+ | Environment | `environment` | `QASE_ENVIRONMENT` | undefined | No | Any string |
40
+ | Root suite | `rootSuite` | `QASE_ROOT_SUITE` | undefined | No | Any string |
41
41
  | Enable debug logs | `debug` | `QASE_DEBUG` | `False` | No | `True`, `False` |
42
42
  | Enable capture logs from `stdout` and `stderr` | `testops.defect` | `QASE_CAPTURE_LOGS` | `False` | No | `True`, `False` |
43
43
  | **Qase Report configuration** | | | | | |
@@ -45,15 +45,15 @@ All configuration options are listed in the table below:
45
45
  | Path to save the report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | | |
46
46
  | Local report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `json` | | `json`, `jsonp` |
47
47
  | **Qase TestOps configuration** | | | | | |
48
- | Token for [API access](https://developers.qase.io/#authentication) | `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | | Yes | Any string |
48
+ | Token for [API access](https://developers.qase.io/#authentication) | `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | undefined | Yes | Any string |
49
49
  | Qase API host. For enterprise users, specify full address: `api-example.qase.io` | `testops.api.host` | `QASE_TESTOPS_API_HOST` | `qase.io` | No | Any string |
50
50
  | Qase enterprise environment | `testops.api.enterprise` | `QASE_TESTOPS_API_ENTERPRISE` | `False` | No | `True`, `False` |
51
- | Code of your project, which you can take from the URL: `https://app.qase.io/project/DEMOTR` - `DEMOTR` is the project code | `testops.project` | `QASE_TESTOPS_PROJECT` | | Yes | Any string |
52
- | Qase test run ID | `testops.run.id` | `QASE_TESTOPS_RUN_ID` | | No | Any integer |
51
+ | Code of your project, which you can take from the URL: `https://app.qase.io/project/DEMOTR` - `DEMOTR` is the project code | `testops.project` | `QASE_TESTOPS_PROJECT` | undefined | Yes | Any string |
52
+ | Qase test run ID | `testops.run.id` | `QASE_TESTOPS_RUN_ID` | undefined | No | Any integer |
53
53
  | Qase test run title | `testops.run.title` | `QASE_TESTOPS_RUN_TITLE` | `Automated run <Current date and time>` | No | Any string |
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
- | Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | | No | Any integer |
56
+ | Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | undefined | No | Any integer |
57
57
  | Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
58
58
  | Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
59
59
 
package/changelog.md CHANGED
@@ -1,10 +1,16 @@
1
+ # qase-javascript-commons@2.2.1
2
+
3
+ ## What's new
4
+
5
+ Support `author` field in the test result data.
6
+ You can specify author name or email in fields.
7
+
1
8
  # qase-javascript-commons@2.1.3
2
9
 
3
10
  ## What's new
4
11
 
5
12
  Reporters will send all data on the results of the autotests. Including the data of the title, the description, etc.
6
13
 
7
-
8
14
  # qase-javascript-commons@2.1.1
9
15
 
10
16
  ## What's new
@@ -21,8 +27,10 @@ Minor release of the commons package
21
27
 
22
28
  ## What's new
23
29
 
24
- - update a `InternalReporterInterface`. Added a new methods `sendResults` and `complete` to send the results and complete the test run.
25
- - add `StateManager` class to manage and share the state of the reporter between the different instances of the reporter.
30
+ - update a `InternalReporterInterface`. Added a new methods `sendResults` and `complete` to send the results and
31
+ complete the test run.
32
+ - add `StateManager` class to manage and share the state of the reporter between the different instances of the
33
+ reporter.
26
34
 
27
35
  # qase-javascript-commons@2.0.13
28
36
 
@@ -37,7 +45,6 @@ Minor release of the commons package
37
45
 
38
46
  Support qaseio package version 2.2.0
39
47
 
40
-
41
48
  # qase-javascript-commons@2.0.11
42
49
 
43
50
  ## What's new
@@ -60,7 +67,6 @@ Now the reporter will send the test results only once.
60
67
  The Cypress calls the `publish` method multiple times for the same test results because of the Cypress architecture.
61
68
  It calls the `publish` method for each test file.
62
69
 
63
-
64
70
  # qase-javascript-commons@2.0.9
65
71
 
66
72
  ## What's new
@@ -82,13 +88,15 @@ This option is available in the config file and the `QASE_ROOT_SUITE` env variab
82
88
 
83
89
  ## What's new
84
90
 
85
- Fixed an issue with creating a test run with environment when the reporter ignored the `environment` parameter in the configuration.
91
+ Fixed an issue with creating a test run with environment when the reporter ignored the `environment` parameter in the
92
+ configuration.
86
93
 
87
94
  # qase-javascript-commons@2.0.7
88
95
 
89
96
  ## What's new
90
97
 
91
- Fixed an issue with creating a defect for failed tests when the reporter ignored the `defect` parameter in the configuration.
98
+ Fixed an issue with creating a defect for failed tests when the reporter ignored the `defect` parameter in the
99
+ configuration.
92
100
 
93
101
  # qase-javascript-commons@2.0.6
94
102
 
@@ -143,7 +151,7 @@ Before this fix, the reporter added ANSI escape codes to the message and stack t
143
151
  ## What's new
144
152
 
145
153
  This is the first release version of the Qase JavaScript SDK.
146
- It is numbered `2.0.0` (and not `1.0.0`) to match the release series of
154
+ It is numbered `2.0.0` (and not `1.0.0`) to match the release series of
147
155
  test reporters for Playwright, Cypress, Jest, and other frameworks.
148
156
 
149
157
  ### Annotating test with field data
@@ -153,9 +161,9 @@ This feature is already implemented in the Playwright reporter:
153
161
 
154
162
  ```js
155
163
  test('Test with annotated fields', () => {
156
- qase.id(1);
157
- qase.fields({ 'severity': 'high', 'priority': 'medium' })
158
- // ...
164
+ qase.id(1);
165
+ qase.fields({ 'severity': 'high', 'priority': 'medium' })
166
+ // ...
159
167
  });
160
168
  ```
161
169
 
@@ -182,7 +190,8 @@ It helps bring test results faster and enables acting on them long before the te
182
190
  Qase JavaScript SDK brings configuration with config files and environment variables
183
191
  to a common standard, used with Qase reporters in all languages and frameworks.
184
192
 
185
- For details, see the [Configuration](https://github.com/qase-tms/qase-javascript/tree/main/qase-javascript-commons#configuration)
193
+ For details, see
194
+ the [Configuration](https://github.com/qase-tms/qase-javascript/tree/main/qase-javascript-commons#configuration)
186
195
  section in the README.
187
196
 
188
197
  ### Latest API
@@ -221,17 +230,17 @@ Fixed an issue when the results published before the test run creation.
221
230
 
222
231
  Improved debug logging for better testing and reporting errors.
223
232
 
224
- - Separate `logger` class for use in reporters, supporting logging to console and files.
225
- - Extra debug logs in both reporter modes: TestOps and Local.
233
+ - Separate `logger` class for use in reporters, supporting logging to console and files.
234
+ - Extra debug logs in both reporter modes: TestOps and Local.
226
235
 
227
236
  Fixed an issue with duplicate test runs created when the testing framework
228
237
  (such as Cypress) uses more than one instance of the Qase reporter.
229
238
  Now reporter handles Qase test runs in the following way:
230
239
 
231
- 1. The first instance of the reporter creates a Qase test run and stores the run ID
232
- in the ENV variable `QASE_TESTOPS_RUN_ID`.
233
- 2. Other instances of the reporter read this variable and report test results
234
- to the existing test run.
240
+ 1. The first instance of the reporter creates a Qase test run and stores the run ID
241
+ in the ENV variable `QASE_TESTOPS_RUN_ID`.
242
+ 2. Other instances of the reporter read this variable and report test results
243
+ to the existing test run.
235
244
 
236
245
  Nothing has changed in cases when there is a single instance of a reporter or
237
246
  when it is using a test run, created with other tools, such as with an API request
@@ -303,7 +312,7 @@ This commit introduces a way to select the API version to use.
303
312
  It enables using all new features of v2 JS reporters with the stable v1 API,
304
313
  and elso experimenting with the new v2 API.
305
314
 
306
- **Warning**: v2 API is still in beta.
315
+ **Warning**: v2 API is still in beta.
307
316
  If you want to try the v2 JS reporters, you don't have to enable the new API.
308
317
 
309
318
  To enable using API v2, set an environment variable before running the tests:
@@ -319,16 +328,17 @@ Such description can be collected from test's location and attributes
319
328
  or explicitly declared in the test.
320
329
 
321
330
  Add new data models:
331
+
322
332
  - Relation
323
333
  - Suite
324
334
  - SuiteData
325
335
 
326
-
327
336
  # qase-javascript-commons@2.0.0-beta.5
328
337
 
329
338
  ## What's new
330
339
 
331
- * Update the config of reporters. Added `captureLogs` field. If it is set to `true`, the reporter will capture logs from the test framework.
340
+ * Update the config of reporters. Added `captureLogs` field. If it is set to `true`, the reporter will capture logs from
341
+ the test framework.
332
342
  * Added `getMimeType` function to the commons package. It returns the MIME type of the file by its extension.
333
343
 
334
344
  # qase-javascript-commons@2.0.0-beta.4
@@ -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,
@@ -239,7 +260,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
239
260
  const rootSuite = this.rootSuite ? `${this.rootSuite}\t` : '';
240
261
  resultCreate.case = {
241
262
  title: result.title,
242
- 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,
243
264
  description: result.fields['description'] ?? null,
244
265
  postconditions: result.fields['postconditions'] ?? null,
245
266
  preconditions: result.fields['preconditions'] ?? null,
@@ -253,6 +274,13 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
253
274
  if (result.fields['layer']) {
254
275
  resultCreate.case.layer = result.fields['layer'];
255
276
  }
277
+ if (result.fields['author']) {
278
+ const resp = await this.api.authors.getAuthors(result.fields['author']);
279
+ if (resp.data.result?.entities && resp.data.result.entities.length > 0) {
280
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
281
+ resultCreate.author_id = resp.data.result.entities[0]?.author_id ?? null;
282
+ }
283
+ }
256
284
  this.logger.logDebug(`Transformed result: ${JSON.stringify(resultCreate)}`);
257
285
  return resultCreate;
258
286
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.1.3",
3
+ "version": "2.2.1",
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.1",
37
37
  "strip-ansi": "^6.0.1",
38
38
  "uuid": "^9.0.0"
39
39
  },