@testomatio/reporter 1.4.5-beta.2-report-id → 1.4.5-beta.3-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.
@@ -2,6 +2,7 @@ const chalk = require('chalk');
2
2
  const crypto = require('crypto');
3
3
  const os = require('os');
4
4
  const path = require('path');
5
+ const { v4: uuidv4 } = require('uuid');
5
6
  const fs = require('fs');
6
7
  const { APP_PREFIX, STATUS: Status, TESTOMAT_TMP_STORAGE_DIR } = require('../constants');
7
8
  const TestomatioClient = require('../client');
@@ -56,8 +57,10 @@ class PlaywrightReporter {
56
57
  const manuallyAttachedArtifacts = services.artifacts.get(fullTestTitle);
57
58
  const keyValues = services.keyValues.get(fullTestTitle);
58
59
 
60
+ const rid = test.id || test.testId || uuidv4();
61
+
59
62
  const reportTestPromise = this.client.addTestRun(checkStatus(result.status), {
60
- rid: test.testId,
63
+ rid,
61
64
  error,
62
65
  test_id: getTestomatIdFromTestTitle(`${title} ${test.tags?.join(' ')}`),
63
66
  suite_title,
@@ -71,7 +74,8 @@ class PlaywrightReporter {
71
74
  });
72
75
 
73
76
  this.uploads.push({
74
- rid: test.testId,
77
+ rid,
78
+ title: test.title,
75
79
  files: result.attachments.filter(a => a.body || a.path),
76
80
  file: test.location?.file,
77
81
  });
@@ -103,12 +107,12 @@ class PlaywrightReporter {
103
107
  await Promise.all(reportTestPromises);
104
108
 
105
109
  if (this.uploads.length && isArtifactsEnabled()) {
106
- console.log(APP_PREFIX, `🎞️ Uploading ${this.uploads.length} files...`);
110
+ console.log(APP_PREFIX, `🎞️ Uploading ${this.uploads.length} files...`);
107
111
 
108
112
  const promises = [];
109
113
 
110
114
  for (const upload of this.uploads) {
111
- const { title, testId, suite_title } = upload;
115
+ const { rid, file, title } = upload;
112
116
 
113
117
  const files = upload.files.map(attachment => ({
114
118
  path: this.#getArtifactPath(attachment),
@@ -118,11 +122,10 @@ class PlaywrightReporter {
118
122
 
119
123
  promises.push(
120
124
  this.client.addTestRun(undefined, {
121
- test_id: testId,
125
+ rid,
122
126
  title,
123
- suite_title,
124
127
  files,
125
- file: upload.file,
128
+ file,
126
129
  }),
127
130
  );
128
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.4.5-beta.2-report-id",
3
+ "version": "1.4.5-beta.3-report-id",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",