@testomatio/reporter 1.4.4 → 1.4.5-beta.1-report-id

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.
@@ -129,7 +129,7 @@ function CodeceptReporter(config) {
129
129
  await Promise.all(reportTestPromises);
130
130
 
131
131
  if (upload.isArtifactsEnabled()) {
132
- uploadAttachments(client, videos, '🎞️ Uploading', 'video');
132
+ uploadAttachments(client, videos, '🎞️ Uploading', 'video');
133
133
  uploadAttachments(client, traces, '📁 Uploading', 'trace');
134
134
  }
135
135
 
@@ -142,7 +142,6 @@ function CodeceptReporter(config) {
142
142
  if (id && failedTests.includes(id)) {
143
143
  failedTests = failedTests.filter(failed => id !== failed);
144
144
  }
145
- const testId = getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`);
146
145
  const testObj = getTestAndMessage(title);
147
146
 
148
147
  const logs = getTestLogs(test);
@@ -152,11 +151,12 @@ function CodeceptReporter(config) {
152
151
 
153
152
  client.addTestRun(STATUS.PASSED, {
154
153
  ...stripExampleFromTitle(title),
154
+ rid: id,
155
155
  suite_title: test.parent && test.parent.title,
156
156
  message: testObj.message,
157
157
  time: getDuration(test),
158
158
  steps: global.testomatioDataStore.steps.join('\n') || null,
159
- test_id: testId,
159
+ test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
160
160
  logs,
161
161
  manuallyAttachedArtifacts,
162
162
  meta: keyValues,
@@ -179,6 +179,7 @@ function CodeceptReporter(config) {
179
179
  const testId = getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`);
180
180
 
181
181
  client.addTestRun(STATUS.FAILED, {
182
+ rid: id,
182
183
  ...stripExampleFromTitle(title),
183
184
  suite_title: suite.title,
184
185
  test_id: testId,
@@ -194,7 +195,6 @@ function CodeceptReporter(config) {
194
195
  if (test.err) error = test.err;
195
196
  const { id, tags, title, artifacts } = test;
196
197
  failedTests.push(id || title);
197
- let testId = getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`);
198
198
  const testObj = getTestAndMessage(title);
199
199
 
200
200
  const files = [];
@@ -206,10 +206,10 @@ function CodeceptReporter(config) {
206
206
  const keyValues = services.keyValues.get(test.fullTitle());
207
207
  services.setContext(null);
208
208
 
209
- const reportTestPromise = client
210
- .addTestRun(STATUS.FAILED, {
209
+ client.addTestRun(STATUS.FAILED, {
211
210
  ...stripExampleFromTitle(title),
212
- test_id: testId,
211
+ rid: id,
212
+ test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
213
213
  suite_title: test.parent && test.parent.title,
214
214
  error,
215
215
  message: testObj.message,
@@ -219,19 +219,14 @@ function CodeceptReporter(config) {
219
219
  logs,
220
220
  manuallyAttachedArtifacts,
221
221
  meta: keyValues,
222
- })
223
- .then(pipes => {
224
- testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
222
+ });
225
223
 
226
- debug('artifacts', artifacts);
224
+ debug('artifacts', artifacts);
227
225
 
228
- for (const aid in artifacts) {
229
- if (aid.startsWith('video')) videos.push({ testId, title, path: artifacts[aid], type: 'video/webm' });
230
- if (aid.startsWith('trace')) traces.push({ testId, title, path: artifacts[aid], type: 'application/zip' });
231
- }
232
- });
233
-
234
- reportTestPromises.push(reportTestPromise);
226
+ for (const aid in artifacts) {
227
+ if (aid.startsWith('video')) videos.push({ rid: id, title, path: artifacts[aid], type: 'video/webm' });
228
+ if (aid.startsWith('trace')) traces.push({ rid: id, title, path: artifacts[aid], type: 'application/zip' });
229
+ }
235
230
 
236
231
  // output.stop();
237
232
  });
@@ -240,11 +235,11 @@ function CodeceptReporter(config) {
240
235
  const { id, tags, title } = test;
241
236
  if (failedTests.includes(id || title)) return;
242
237
 
243
- const testId = getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`);
244
238
  const testObj = getTestAndMessage(title);
245
239
  client.addTestRun(STATUS.SKIPPED, {
240
+ rid: id,
246
241
  ...stripExampleFromTitle(title),
247
- test_id: testId,
242
+ test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
248
243
  suite_title: test.parent && test.parent.title,
249
244
  message: testObj.message,
250
245
  time: getDuration(test),
@@ -313,11 +308,11 @@ async function uploadAttachments(client, attachments, messagePrefix, attachmentT
313
308
  console.log(APP_PREFIX, `Attachments: ${messagePrefix} ${attachments.length} ${attachmentType}/-s ...`);
314
309
 
315
310
  const promises = attachments.map(async attachment => {
316
- const { testId, title, path, type } = attachment;
311
+ const { rid, title, path, type } = attachment;
317
312
  const file = { path, type, title };
318
313
  return client.addTestRun(undefined, {
319
314
  ...stripExampleFromTitle(title),
320
- test_id: testId,
315
+ rid,
321
316
  files: [file],
322
317
  });
323
318
  });
@@ -39,8 +39,6 @@ class PlaywrightReporter {
39
39
 
40
40
  const { title } = test;
41
41
 
42
- let testId = getTestomatIdFromTestTitle(`${title} ${test.tags?.join(' ')}`);
43
-
44
42
  const { error, duration } = result;
45
43
 
46
44
  const suite_title = test.parent ? test.parent?.title : path.basename(test?.location?.file);
@@ -58,10 +56,10 @@ class PlaywrightReporter {
58
56
  const manuallyAttachedArtifacts = services.artifacts.get(fullTestTitle);
59
57
  const keyValues = services.keyValues.get(fullTestTitle);
60
58
 
61
- const reportTestPromise = this.client
62
- .addTestRun(checkStatus(result.status), {
59
+ const reportTestPromise = this.client.addTestRun(checkStatus(result.status), {
60
+ rid: test.testId,
63
61
  error,
64
- test_id: testId,
62
+ test_id: getTestomatIdFromTestTitle(`${title} ${test.tags?.join(' ')}`),
65
63
  suite_title,
66
64
  title,
67
65
  steps: steps.join('\n'),
@@ -70,21 +68,16 @@ class PlaywrightReporter {
70
68
  manuallyAttachedArtifacts,
71
69
  meta: keyValues,
72
70
  file: test.location?.file,
73
- })
74
- .then(pipes => {
75
- testId = pipes?.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
76
-
77
- this.uploads.push({
78
- testId,
79
- title,
80
- suite_title,
81
- files: result.attachments.filter(a => a.body || a.path),
82
- file: test.location?.file,
83
- });
84
- // remove empty uploads
85
- this.uploads = this.uploads.filter(upload => upload.files.length);
86
71
  });
87
72
 
73
+ this.uploads.push({
74
+ rid: test.testId,
75
+ files: result.attachments.filter(a => a.body || a.path),
76
+ file: test.location?.file,
77
+ });
78
+ // remove empty uploads
79
+ this.uploads = this.uploads.filter(upload => upload.files.length);
80
+
88
81
  reportTestPromises.push(reportTestPromise);
89
82
  }
90
83
 
@@ -110,7 +103,7 @@ class PlaywrightReporter {
110
103
  await Promise.all(reportTestPromises);
111
104
 
112
105
  if (this.uploads.length && isArtifactsEnabled()) {
113
- console.log(APP_PREFIX, `🎞️ Uploading ${this.uploads.length} files...`);
106
+ console.log(APP_PREFIX, `🎞️ Uploading ${this.uploads.length} files...`);
114
107
 
115
108
  const promises = [];
116
109
 
package/lib/client.js CHANGED
@@ -134,6 +134,7 @@ class Client {
134
134
  };
135
135
 
136
136
  const {
137
+ rid,
137
138
  error = null,
138
139
  time = '',
139
140
  example = null,
@@ -184,6 +185,7 @@ class Client {
184
185
  this.totalUploaded += artifacts.length;
185
186
 
186
187
  const data = {
188
+ rid,
187
189
  files,
188
190
  steps,
189
191
  status,
@@ -339,6 +339,9 @@ class TestomatioPipe {
339
339
  addTest(data) {
340
340
  if (!this.isEnabled) return;
341
341
  if (!this.runId) return;
342
+
343
+ // add test ID + run ID
344
+ data.rid = `${this.runId}-${data.rid}`;
342
345
  data.api_key = this.apiKey;
343
346
  data.create = this.createNewTests;
344
347
 
package/lib/xmlReader.js CHANGED
@@ -460,6 +460,7 @@ function reduceTestCases(prev, item) {
460
460
  // SpecFlow config
461
461
  let { title, tags } = fetchProperties(item.type === 'ParameterizedMethod' ? item : testCaseItem);
462
462
  let example = null;
463
+ const suiteTitle = reduceOptions.preferClassname ? testCaseItem.classname : item.name || testCaseItem.classname;
463
464
 
464
465
  title ||= testCaseItem.name || testCaseItem.methodname || testCaseItem.classname;
465
466
  tags ||= [];
@@ -493,7 +494,7 @@ function reduceTestCases(prev, item) {
493
494
  run_time: parseFloat(testCaseItem.time || testCaseItem.duration) * 1000,
494
495
  status,
495
496
  title,
496
- suite_title: reduceOptions.preferClassname ? testCaseItem.classname : item.name || testCaseItem.classname,
497
+ suite_title: suiteTitle,
497
498
  });
498
499
  });
499
500
  return prev;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.4.4",
3
+ "version": "1.4.5-beta.1-report-id",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",