@qavajs/format-report-portal 0.13.0 → 0.14.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,13 @@
1
+ ## 0.14.0
2
+ - added config parameter for placing tags to attributes or description (default)
3
+
4
+ ## 0.13.2
5
+ - updated version to 0.13.2
6
+ - pull request template added to reduce human factor
7
+
8
+ ## 0.13.1
9
+ - fixed a missed bracket
10
+
1
11
  ## 0.13.0
2
12
  - changed an approach to distribute tags as attributes for suite and test entities
3
13
 
package/README.MD CHANGED
@@ -26,7 +26,8 @@ module.exports = {
26
26
  mode: 'DEFAULT',
27
27
  retry: 1, // number of retries to send result to report portal (default - 1)
28
28
  ignoreErrors: false, // ignore RP errors (default: false)
29
- showLaunchURL: true // log report portal launch link
29
+ showLaunchURL: true // log report portal launch link,
30
+ tagsAsAttributes: true // (default: false → tags go to description)
30
31
  },
31
32
  }
32
33
  }
@@ -45,8 +46,12 @@ Before(function () {
45
46
  this.log(`rp_attribute: random:${Date.now()}`); //dynamic attribute
46
47
  });
47
48
  ```
49
+ ### Run Unit Tests
50
+ add token.json file with rp token and other config
51
+ run
52
+ `npm run test`
48
53
 
49
- ### Run E2E Test
54
+ ### Run E2E Tests
50
55
  add token.json file with rp token and other config
51
56
  run
52
57
  `npm run test-e2e`
package/index.js CHANGED
@@ -10,7 +10,7 @@ class RPFormatter extends Formatter {
10
10
 
11
11
  constructor(options) {
12
12
  super(options);
13
- const rpEnable = options.parsedArgvOptions.rpConfig.enable;
13
+ const rpEnable = options.parsedArgvOptions?.rpConfig?.enable;
14
14
  if (rpEnable !== undefined && !rpEnable) return undefined;
15
15
  options.eventBroadcaster.on('envelope', this.processEnvelope.bind(this));
16
16
  this.rpConfig = options.parsedArgvOptions.rpConfig;
@@ -84,11 +84,10 @@ class RPFormatter extends Formatter {
84
84
  if (!this.features[featureName]) {
85
85
  await retry(async () => {
86
86
  const featureItem = this.rpClient.startTestItem({
87
- attributes: this.prepareTags(testCase.gherkinDocument.feature.tags),
87
+ attributes: this.rpConfig.tagsAsAttributes ? this.prepareTags(testCase.gherkinDocument.feature.tags) : [],
88
88
  description:
89
- this.formatTags(testCase.gherkinDocument.feature.tags) +
90
- '\n' +
91
- testCase.gherkinDocument.feature.description,
89
+ this.rpConfig.tagsAsAttributes ? '' : `${this.formatTags(testCase.gherkinDocument.feature.tags)}\n`
90
+ + testCase.gherkinDocument.feature.description,
92
91
  name: featureName,
93
92
  startTime: this.rpClient.helpers.now(),
94
93
  type: 'SUITE'
@@ -120,11 +119,13 @@ class RPFormatter extends Formatter {
120
119
  const retryTest = Boolean(testCase.attempt);
121
120
  const testItem = await retry(async () => {
122
121
  const testItem = this.rpClient.startTestItem({
123
- description: this.formatTags(testCase.pickle.tags),
122
+ description: this.rpConfig.tagsAsAttributes ? '' : this.formatTags(testCase.pickle.tags),
124
123
  name: testCase.pickle.name,
125
124
  startTime,
126
125
  type: 'STEP',
127
- attributes: [...attributes, ...this.prepareTags(testCase.pickle.tags) ],
126
+ attributes: [
127
+ ...attributes,
128
+ ...(this.rpConfig.tagsAsAttributes ? this.prepareTags(testCase.pickle.tags) : []) ],
128
129
  retry: retryTest
129
130
  }, this.launchId, featureTempId);
130
131
  await testItem.promise;
@@ -243,7 +244,8 @@ class RPFormatter extends Formatter {
243
244
 
244
245
  formatTags(tags) {
245
246
  return tags.map(tag => '<code>' + tag.name + '</code>').join('')
246
-
247
+ }
248
+
247
249
  prepareTags(tags) {
248
250
  return tags.map(tag => tag.name)
249
251
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@qavajs/format-report-portal",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "cucumber formatter for report portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test:e2e": "qavajs run --config test-e2e/config.js"
7
+ "test:e2e": "qavajs run --config test-e2e/config.js",
8
+ "test": "jest"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -24,7 +25,8 @@
24
25
  },
25
26
  "devDependencies": {
26
27
  "@cucumber/cucumber": "^9.5.1",
27
- "@qavajs/cli": "^0.28.0",
28
- "@qavajs/memory": "^1.6.2"
28
+ "@qavajs/cli": "^0.29.0",
29
+ "@qavajs/memory": "^1.6.2",
30
+ "jest": "^29.7.0"
29
31
  }
30
32
  }