testlens-playwright-reporter 0.1.9 → 0.2.0
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/index.js +57 -39
- package/index.ts +57 -39
- package/lib/index.js +56 -39
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -179,36 +179,47 @@ class TestLensReporter {
|
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
182
|
+
const testId = this.getTestId(test);
|
|
183
|
+
|
|
184
|
+
// Only send testStart event on first attempt (retry 0)
|
|
185
|
+
if (result.retry === 0) {
|
|
186
|
+
// Create test data
|
|
187
|
+
const testData = {
|
|
188
|
+
id: testId,
|
|
189
|
+
name: test.title,
|
|
190
|
+
status: 'passed',
|
|
191
|
+
originalStatus: 'passed',
|
|
192
|
+
duration: 0,
|
|
193
|
+
startTime: new Date().toISOString(),
|
|
194
|
+
endTime: '',
|
|
195
|
+
errorMessages: [],
|
|
196
|
+
retryAttempts: test.retries,
|
|
197
|
+
currentRetry: result.retry,
|
|
198
|
+
annotations: test.annotations.map(ann => ({
|
|
199
|
+
type: ann.type,
|
|
200
|
+
description: ann.description
|
|
201
|
+
})),
|
|
202
|
+
projectName: test.parent.project()?.name || 'default',
|
|
203
|
+
workerIndex: result.workerIndex,
|
|
204
|
+
parallelIndex: result.parallelIndex
|
|
205
|
+
};
|
|
202
206
|
|
|
203
|
-
|
|
207
|
+
this.testMap.set(testData.id, testData);
|
|
204
208
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
// Send test start event to API
|
|
210
|
+
await this.sendToApi({
|
|
211
|
+
type: 'testStart',
|
|
212
|
+
runId: this.runId,
|
|
213
|
+
timestamp: new Date().toISOString(),
|
|
214
|
+
test: testData
|
|
215
|
+
});
|
|
216
|
+
} else {
|
|
217
|
+
// For retries, just update the existing test data
|
|
218
|
+
const existingTestData = this.testMap.get(testId);
|
|
219
|
+
if (existingTestData) {
|
|
220
|
+
existingTestData.currentRetry = result.retry;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
212
223
|
}
|
|
213
224
|
|
|
214
225
|
async onTestEnd(test, result) {
|
|
@@ -216,24 +227,31 @@ class TestLensReporter {
|
|
|
216
227
|
const testData = this.testMap.get(testId);
|
|
217
228
|
|
|
218
229
|
if (testData) {
|
|
219
|
-
//
|
|
230
|
+
// Update test data with latest result
|
|
220
231
|
testData.originalStatus = result.status;
|
|
221
232
|
testData.status = this.normalizeTestStatus(result.status);
|
|
222
233
|
testData.duration = result.duration;
|
|
223
234
|
testData.endTime = new Date().toISOString();
|
|
224
235
|
testData.errorMessages = result.errors.map(error => error.message || error.toString());
|
|
236
|
+
testData.currentRetry = result.retry;
|
|
225
237
|
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
test
|
|
232
|
-
|
|
238
|
+
// Only send testEnd event after final retry attempt
|
|
239
|
+
// If test passed or this is the last retry, send the event
|
|
240
|
+
const isFinalAttempt = result.status === 'passed' || result.status === 'skipped' || result.retry >= test.retries;
|
|
241
|
+
|
|
242
|
+
if (isFinalAttempt) {
|
|
243
|
+
// Send test end event to API
|
|
244
|
+
await this.sendToApi({
|
|
245
|
+
type: 'testEnd',
|
|
246
|
+
runId: this.runId,
|
|
247
|
+
timestamp: new Date().toISOString(),
|
|
248
|
+
test: testData
|
|
249
|
+
});
|
|
233
250
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
251
|
+
// Handle artifacts
|
|
252
|
+
if (this.config.enableArtifacts) {
|
|
253
|
+
await this.processArtifacts(testId, result);
|
|
254
|
+
}
|
|
237
255
|
}
|
|
238
256
|
}
|
|
239
257
|
|
package/index.ts
CHANGED
|
@@ -308,36 +308,47 @@ export class TestLensReporter implements Reporter {
|
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
311
|
+
const testId = this.getTestId(test);
|
|
312
|
+
|
|
313
|
+
// Only send testStart event on first attempt (retry 0)
|
|
314
|
+
if (result.retry === 0) {
|
|
315
|
+
// Create test data
|
|
316
|
+
const testData: TestData = {
|
|
317
|
+
id: testId,
|
|
318
|
+
name: test.title,
|
|
319
|
+
status: 'passed',
|
|
320
|
+
originalStatus: 'passed',
|
|
321
|
+
duration: 0,
|
|
322
|
+
startTime: new Date().toISOString(),
|
|
323
|
+
endTime: '',
|
|
324
|
+
errorMessages: [],
|
|
325
|
+
retryAttempts: test.retries,
|
|
326
|
+
currentRetry: result.retry,
|
|
327
|
+
annotations: test.annotations.map((ann: any) => ({
|
|
328
|
+
type: ann.type,
|
|
329
|
+
description: ann.description
|
|
330
|
+
})),
|
|
331
|
+
projectName: test.parent.project()?.name || 'default',
|
|
332
|
+
workerIndex: result.workerIndex,
|
|
333
|
+
parallelIndex: result.parallelIndex
|
|
334
|
+
};
|
|
331
335
|
|
|
332
|
-
|
|
336
|
+
this.testMap.set(testData.id, testData);
|
|
333
337
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
// Send test start event to API
|
|
339
|
+
await this.sendToApi({
|
|
340
|
+
type: 'testStart',
|
|
341
|
+
runId: this.runId,
|
|
342
|
+
timestamp: new Date().toISOString(),
|
|
343
|
+
test: testData
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
// For retries, just update the existing test data
|
|
347
|
+
const existingTestData = this.testMap.get(testId);
|
|
348
|
+
if (existingTestData) {
|
|
349
|
+
existingTestData.currentRetry = result.retry;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
341
352
|
}
|
|
342
353
|
|
|
343
354
|
async onTestEnd(test: TestCase, result: TestResult): Promise<void> {
|
|
@@ -345,24 +356,31 @@ export class TestLensReporter implements Reporter {
|
|
|
345
356
|
const testData = this.testMap.get(testId);
|
|
346
357
|
|
|
347
358
|
if (testData) {
|
|
348
|
-
//
|
|
359
|
+
// Update test data with latest result
|
|
349
360
|
testData.originalStatus = result.status;
|
|
350
361
|
testData.status = this.normalizeTestStatus(result.status);
|
|
351
362
|
testData.duration = result.duration;
|
|
352
363
|
testData.endTime = new Date().toISOString();
|
|
353
364
|
testData.errorMessages = result.errors.map((error: any) => error.message || error.toString());
|
|
365
|
+
testData.currentRetry = result.retry;
|
|
354
366
|
|
|
355
|
-
//
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
test
|
|
361
|
-
|
|
367
|
+
// Only send testEnd event after final retry attempt
|
|
368
|
+
// If test passed or this is the last retry, send the event
|
|
369
|
+
const isFinalAttempt = result.status === 'passed' || result.status === 'skipped' || result.retry >= test.retries;
|
|
370
|
+
|
|
371
|
+
if (isFinalAttempt) {
|
|
372
|
+
// Send test end event to API
|
|
373
|
+
await this.sendToApi({
|
|
374
|
+
type: 'testEnd',
|
|
375
|
+
runId: this.runId,
|
|
376
|
+
timestamp: new Date().toISOString(),
|
|
377
|
+
test: testData
|
|
378
|
+
});
|
|
362
379
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
380
|
+
// Handle artifacts
|
|
381
|
+
if (this.config.enableArtifacts) {
|
|
382
|
+
await this.processArtifacts(testId, result);
|
|
383
|
+
}
|
|
366
384
|
}
|
|
367
385
|
}
|
|
368
386
|
|
package/lib/index.js
CHANGED
|
@@ -196,55 +196,72 @@ class TestLensReporter {
|
|
|
196
196
|
spec: specData
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
199
|
+
const testId = this.getTestId(test);
|
|
200
|
+
// Only send testStart event on first attempt (retry 0)
|
|
201
|
+
if (result.retry === 0) {
|
|
202
|
+
// Create test data
|
|
203
|
+
const testData = {
|
|
204
|
+
id: testId,
|
|
205
|
+
name: test.title,
|
|
206
|
+
status: 'passed',
|
|
207
|
+
originalStatus: 'passed',
|
|
208
|
+
duration: 0,
|
|
209
|
+
startTime: new Date().toISOString(),
|
|
210
|
+
endTime: '',
|
|
211
|
+
errorMessages: [],
|
|
212
|
+
retryAttempts: test.retries,
|
|
213
|
+
currentRetry: result.retry,
|
|
214
|
+
annotations: test.annotations.map((ann) => ({
|
|
215
|
+
type: ann.type,
|
|
216
|
+
description: ann.description
|
|
217
|
+
})),
|
|
218
|
+
projectName: test.parent.project()?.name || 'default',
|
|
219
|
+
workerIndex: result.workerIndex,
|
|
220
|
+
parallelIndex: result.parallelIndex
|
|
221
|
+
};
|
|
222
|
+
this.testMap.set(testData.id, testData);
|
|
223
|
+
// Send test start event to API
|
|
224
|
+
await this.sendToApi({
|
|
225
|
+
type: 'testStart',
|
|
226
|
+
runId: this.runId,
|
|
227
|
+
timestamp: new Date().toISOString(),
|
|
228
|
+
test: testData
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
// For retries, just update the existing test data
|
|
233
|
+
const existingTestData = this.testMap.get(testId);
|
|
234
|
+
if (existingTestData) {
|
|
235
|
+
existingTestData.currentRetry = result.retry;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
227
238
|
}
|
|
228
239
|
async onTestEnd(test, result) {
|
|
229
240
|
const testId = this.getTestId(test);
|
|
230
241
|
const testData = this.testMap.get(testId);
|
|
231
242
|
if (testData) {
|
|
232
|
-
//
|
|
243
|
+
// Update test data with latest result
|
|
233
244
|
testData.originalStatus = result.status;
|
|
234
245
|
testData.status = this.normalizeTestStatus(result.status);
|
|
235
246
|
testData.duration = result.duration;
|
|
236
247
|
testData.endTime = new Date().toISOString();
|
|
237
248
|
testData.errorMessages = result.errors.map((error) => error.message || error.toString());
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
test
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
249
|
+
testData.currentRetry = result.retry;
|
|
250
|
+
// Only send testEnd event after final retry attempt
|
|
251
|
+
// If test passed or this is the last retry, send the event
|
|
252
|
+
const isFinalAttempt = result.status === 'passed' || result.status === 'skipped' || result.retry >= test.retries;
|
|
253
|
+
if (isFinalAttempt) {
|
|
254
|
+
// Send test end event to API
|
|
255
|
+
await this.sendToApi({
|
|
256
|
+
type: 'testEnd',
|
|
257
|
+
runId: this.runId,
|
|
258
|
+
timestamp: new Date().toISOString(),
|
|
259
|
+
test: testData
|
|
260
|
+
});
|
|
261
|
+
// Handle artifacts
|
|
262
|
+
if (this.config.enableArtifacts) {
|
|
263
|
+
await this.processArtifacts(testId, result);
|
|
264
|
+
}
|
|
248
265
|
}
|
|
249
266
|
}
|
|
250
267
|
// Update spec status
|
package/package.json
CHANGED