@testomatio/reporter 1.6.4 → 1.6.6-beta-detach-xml-1
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/xmlReader.js +3 -1
- 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,
|
package/lib/xmlReader.js
CHANGED
|
@@ -21,7 +21,7 @@ const config = require('./config');
|
|
|
21
21
|
const ridRunId = randomUUID();
|
|
22
22
|
|
|
23
23
|
const TESTOMATIO_URL = process.env.TESTOMATIO_URL || 'https://app.testomat.io';
|
|
24
|
-
const { TESTOMATIO_RUNGROUP_TITLE, TESTOMATIO_TITLE, TESTOMATIO_ENV, TESTOMATIO_RUN } = process.env;
|
|
24
|
+
const { TESTOMATIO_RUNGROUP_TITLE, TESTOMATIO_TITLE, TESTOMATIO_ENV, TESTOMATIO_RUN, TESTOMATIO_MARK_DETACHED } = process.env;
|
|
25
25
|
|
|
26
26
|
const options = {
|
|
27
27
|
ignoreDeclaration: true,
|
|
@@ -41,6 +41,7 @@ class XmlReader {
|
|
|
41
41
|
title: TESTOMATIO_TITLE,
|
|
42
42
|
env: TESTOMATIO_ENV,
|
|
43
43
|
group_title: TESTOMATIO_RUNGROUP_TITLE,
|
|
44
|
+
detach: !!TESTOMATIO_MARK_DETACHED,
|
|
44
45
|
// batch uploading is implemented for xml already
|
|
45
46
|
isBatchEnabled: false,
|
|
46
47
|
};
|
|
@@ -425,6 +426,7 @@ class XmlReader {
|
|
|
425
426
|
const dataString = {
|
|
426
427
|
...this.stats,
|
|
427
428
|
api_key: this.requestParams.apiKey,
|
|
429
|
+
detach: this.requestParams.detach,
|
|
428
430
|
status: 'finished',
|
|
429
431
|
tests: this.tests,
|
|
430
432
|
};
|