@qavajs/format-report-portal 0.0.6 → 0.0.8

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.
Files changed (3) hide show
  1. package/CHANGELOG.MD +6 -0
  2. package/index.js +16 -10
  3. package/package.json +6 -5
package/CHANGELOG.MD CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.8
2
+ - :beetle: fixed sending duration
3
+
4
+ ## 0.0.7
5
+ - :beetle: implemented sending real step duration
6
+
1
7
  ## 0.0.6
2
8
  - :rocket: enable support of cucumber logs
3
9
 
package/index.js CHANGED
@@ -70,12 +70,14 @@ class RPFormatter extends Formatter {
70
70
  await featureItem.promise;
71
71
  }
72
72
 
73
- const featureTempId = this.features[featureName]
73
+ const featureTempId = this.features[featureName];
74
+ let startTime = this.rpClient.helpers.now();
75
+ let endTime;
74
76
  // Start test item
75
77
  const testItem = this.rpClient.startTestItem({
76
78
  description: this.formatTags(testCase.pickle.tags),
77
79
  name: testCase.pickle.name,
78
- startTime: this.rpClient.helpers.now(),
80
+ startTime,
79
81
  type: 'STEP'
80
82
  }, this.launchId, featureTempId);
81
83
  this.promiseQ.push(testItem.promise);
@@ -84,10 +86,12 @@ class RPFormatter extends Formatter {
84
86
  //send steps
85
87
  const steps = this.getStepResults(testCase)
86
88
  for (const step of steps) {
89
+ const duration = step.result.duration;
90
+ endTime = startTime + (duration.seconds * 1_000) + Math.floor(duration.nanos / 1_000_000);
87
91
  const nestedTestItem = this.rpClient.startTestItem({
88
92
  description: 'test description',
89
93
  name: this.getStepText(step, steps),
90
- startTime: this.rpClient.helpers.now(),
94
+ startTime,
91
95
  type: 'STEP',
92
96
  hasStats: false
93
97
  }, this.launchId, testItem.tempId);
@@ -97,22 +101,23 @@ class RPFormatter extends Formatter {
97
101
  const log = await this.rpClient.sendLog(nestedTestItem.tempId, {
98
102
  level: 'ERROR',
99
103
  message: this.getMessage(step),
100
- time: this.rpClient.helpers.now()
104
+ time: startTime
101
105
  });
102
106
  this.promiseQ.push(log.promise);
103
107
  await log.promise;
104
108
  }
105
109
  if (step.attachment) {
106
110
  for (const attachment of step.attachment) {
107
- await this.sendAttachment(attachment, nestedTestItem);
111
+ await this.sendAttachment(attachment, nestedTestItem, startTime);
108
112
  }
109
113
  }
110
114
  const nestedItemFinish = this.rpClient.finishTestItem(nestedTestItem.tempId, {
111
115
  status: this.getStatus(step),
112
- endTime: this.rpClient.helpers.now()
116
+ endTime
113
117
  });
114
118
  this.promiseQ.push(nestedItemFinish.promise);
115
119
  await nestedItemFinish.promise;
120
+ startTime = endTime;
116
121
  }
117
122
 
118
123
  //finish test item
@@ -120,7 +125,8 @@ class RPFormatter extends Formatter {
120
125
  ? Status.FAILED.toLowerCase()
121
126
  : Status.PASSED.toLowerCase()
122
127
  const testItemFinish = this.rpClient.finishTestItem(testItem.tempId, {
123
- status
128
+ status,
129
+ endTime
124
130
  });
125
131
  this.promiseQ.push(testItemFinish.promise);
126
132
  await testItemFinish.promise;
@@ -186,13 +192,13 @@ class RPFormatter extends Formatter {
186
192
  : attachment.body
187
193
  }
188
194
 
189
- async sendAttachment(attachment, testItem) {
195
+ async sendAttachment(attachment, testItem, startTime) {
190
196
  let log;
191
197
  if (attachment.mediaType === 'text/x.cucumber.log+plain') {
192
198
  log = await this.rpClient.sendLog(testItem.tempId, {
193
199
  level: 'INFO',
194
200
  message: attachment.body,
195
- time: this.rpClient.helpers.now()
201
+ time: startTime
196
202
  });
197
203
  } else {
198
204
  const attachmentData = {
@@ -203,7 +209,7 @@ class RPFormatter extends Formatter {
203
209
  log = await this.rpClient.sendLog(testItem.tempId, {
204
210
  level: 'INFO',
205
211
  message: 'Attachment',
206
- time: this.rpClient.helpers.now()
212
+ time: startTime
207
213
  }, attachmentData);
208
214
  }
209
215
  this.promiseQ.push(log.promise);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/format-report-portal",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "cucumber formatter for report portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,7 +11,8 @@
11
11
  "url": "git+https://github.com/qavajs/format-report-portal.git"
12
12
  },
13
13
  "authors": [
14
- "Alexandr Galichenko"
14
+ "Alexandr Galichenko",
15
+ "Alexandr Legchilov"
15
16
  ],
16
17
  "license": "MIT",
17
18
  "bugs": {
@@ -22,8 +23,8 @@
22
23
  "@reportportal/client-javascript": "^5.0.8"
23
24
  },
24
25
  "devDependencies": {
25
- "@cucumber/cucumber": "^9.0.0",
26
- "@qavajs/cli": "^0.0.19",
27
- "@qavajs/memory": "^1.2.0"
26
+ "@cucumber/cucumber": "^9.1.0",
27
+ "@qavajs/cli": "^0.0.21",
28
+ "@qavajs/memory": "^1.3.0"
28
29
  }
29
30
  }