@testomatio/reporter 1.6.3 → 1.6.5
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/lib/adapter/codecept.js +21 -18
- package/lib/adapter/playwright.js +26 -26
- package/package.json +1 -1
package/lib/adapter/codecept.js
CHANGED
|
@@ -40,8 +40,9 @@ function CodeceptReporter(config) {
|
|
|
40
40
|
const { apiKey } = config;
|
|
41
41
|
|
|
42
42
|
const getDuration = test => {
|
|
43
|
-
if (
|
|
44
|
-
|
|
43
|
+
if (!test.uid) return 0;
|
|
44
|
+
if (testTimeMap[test.uid]) {
|
|
45
|
+
return Date.now() - testTimeMap[test.uid];
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return 0;
|
|
@@ -118,7 +119,9 @@ function CodeceptReporter(config) {
|
|
|
118
119
|
event.dispatcher.on(event.test.started, test => {
|
|
119
120
|
services.setContext(test.fullTitle());
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
if (!test.uid) return;
|
|
123
|
+
|
|
124
|
+
testTimeMap[test.uid] = Date.now();
|
|
122
125
|
// start logging
|
|
123
126
|
});
|
|
124
127
|
|
|
@@ -135,9 +138,9 @@ function CodeceptReporter(config) {
|
|
|
135
138
|
});
|
|
136
139
|
|
|
137
140
|
event.dispatcher.on(event.test.passed, test => {
|
|
138
|
-
const {
|
|
139
|
-
if (
|
|
140
|
-
failedTests = failedTests.filter(failed =>
|
|
141
|
+
const { uid, tags, title } = test;
|
|
142
|
+
if (uid && failedTests.includes(uid)) {
|
|
143
|
+
failedTests = failedTests.filter(failed => uid !== failed);
|
|
141
144
|
}
|
|
142
145
|
const testObj = getTestAndMessage(title);
|
|
143
146
|
|
|
@@ -148,7 +151,7 @@ function CodeceptReporter(config) {
|
|
|
148
151
|
|
|
149
152
|
client.addTestRun(STATUS.PASSED, {
|
|
150
153
|
...stripExampleFromTitle(title),
|
|
151
|
-
rid:
|
|
154
|
+
rid: uid,
|
|
152
155
|
suite_title: test.parent && test.parent.title,
|
|
153
156
|
message: testObj.message,
|
|
154
157
|
time: getDuration(test),
|
|
@@ -171,12 +174,12 @@ function CodeceptReporter(config) {
|
|
|
171
174
|
if (!suite) return;
|
|
172
175
|
if (!suite.tests) return;
|
|
173
176
|
for (const test of suite.tests) {
|
|
174
|
-
const {
|
|
175
|
-
failedTests.push(
|
|
177
|
+
const { uid, tags, title } = test;
|
|
178
|
+
failedTests.push(uid || title);
|
|
176
179
|
const testId = getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`);
|
|
177
180
|
|
|
178
181
|
client.addTestRun(STATUS.FAILED, {
|
|
179
|
-
rid:
|
|
182
|
+
rid: uid,
|
|
180
183
|
...stripExampleFromTitle(title),
|
|
181
184
|
suite_title: suite.title,
|
|
182
185
|
test_id: testId,
|
|
@@ -190,8 +193,8 @@ function CodeceptReporter(config) {
|
|
|
190
193
|
event.dispatcher.on(event.test.after, test => {
|
|
191
194
|
if (test.state && test.state !== STATUS.FAILED) return;
|
|
192
195
|
if (test.err) error = test.err;
|
|
193
|
-
const {
|
|
194
|
-
failedTests.push(
|
|
196
|
+
const { uid, tags, title, artifacts } = test;
|
|
197
|
+
failedTests.push(uid || title);
|
|
195
198
|
const testObj = getTestAndMessage(title);
|
|
196
199
|
|
|
197
200
|
const files = [];
|
|
@@ -205,7 +208,7 @@ function CodeceptReporter(config) {
|
|
|
205
208
|
|
|
206
209
|
client.addTestRun(STATUS.FAILED, {
|
|
207
210
|
...stripExampleFromTitle(title),
|
|
208
|
-
rid:
|
|
211
|
+
rid: uid,
|
|
209
212
|
test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
|
|
210
213
|
suite_title: test.parent && test.parent.title,
|
|
211
214
|
error,
|
|
@@ -221,20 +224,20 @@ function CodeceptReporter(config) {
|
|
|
221
224
|
debug('artifacts', artifacts);
|
|
222
225
|
|
|
223
226
|
for (const aid in artifacts) {
|
|
224
|
-
if (aid.startsWith('video')) videos.push({ rid:
|
|
225
|
-
if (aid.startsWith('trace')) traces.push({ rid:
|
|
227
|
+
if (aid.startsWith('video')) videos.push({ rid: uid, title, path: artifacts[aid], type: 'video/webm' });
|
|
228
|
+
if (aid.startsWith('trace')) traces.push({ rid: uid, title, path: artifacts[aid], type: 'application/zip' });
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
// output.stop();
|
|
229
232
|
});
|
|
230
233
|
|
|
231
234
|
event.dispatcher.on(event.test.skipped, test => {
|
|
232
|
-
const {
|
|
233
|
-
if (failedTests.includes(
|
|
235
|
+
const { uid, tags, title } = test;
|
|
236
|
+
if (failedTests.includes(uid || title)) return;
|
|
234
237
|
|
|
235
238
|
const testObj = getTestAndMessage(title);
|
|
236
239
|
client.addTestRun(STATUS.SKIPPED, {
|
|
237
|
-
rid:
|
|
240
|
+
rid: uid,
|
|
238
241
|
...stripExampleFromTitle(title),
|
|
239
242
|
test_id: getTestomatIdFromTestTitle(`${title} ${tags?.join(' ')}`),
|
|
240
243
|
suite_title: test.parent && test.parent.title,
|
|
@@ -105,37 +105,37 @@ class PlaywrightReporter {
|
|
|
105
105
|
|
|
106
106
|
await Promise.all(reportTestPromises);
|
|
107
107
|
|
|
108
|
-
if (
|
|
108
|
+
if (this.uploads.length) {
|
|
109
|
+
if (this.client.uploader.isEnabled) console.log(APP_PREFIX, `🎞️ Uploading ${this.uploads.length} files...`);
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
const promises = [];
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
// ? possible move to addTestRun (needs investigation if files are ready)
|
|
114
|
+
for (const upload of this.uploads) {
|
|
115
|
+
const { rid, file, title } = upload;
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const { rid, file, title } = upload;
|
|
117
|
-
|
|
118
|
-
const files = upload.files.map(attachment => ({
|
|
119
|
-
path: this.#getArtifactPath(attachment),
|
|
120
|
-
title,
|
|
121
|
-
type: attachment.contentType,
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
if (!this.client.uploader.isEnabled) {
|
|
125
|
-
files.forEach(f => this.client.uploader.storeUploadedFile(f, this.client.runId, rid, false));
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
promises.push(
|
|
130
|
-
this.client.addTestRun(undefined, {
|
|
131
|
-
rid,
|
|
117
|
+
const files = upload.files.map(attachment => ({
|
|
118
|
+
path: this.#getArtifactPath(attachment),
|
|
132
119
|
title,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
type: attachment.contentType,
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
if (!this.client.uploader.isEnabled) {
|
|
124
|
+
files.forEach(f => this.client.uploader.storeUploadedFile(f, this.client.runId, rid, false));
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
promises.push(
|
|
129
|
+
this.client.addTestRun(undefined, {
|
|
130
|
+
rid,
|
|
131
|
+
title,
|
|
132
|
+
files,
|
|
133
|
+
file,
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
await Promise.all(promises);
|
|
137
138
|
}
|
|
138
|
-
await Promise.all(promises);
|
|
139
139
|
|
|
140
140
|
await this.client.updateRunStatus(checkStatus(result.status));
|
|
141
141
|
}
|