testlens-playwright-reporter 0.2.2 → 0.2.4

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/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to the testlens-playwright-reporter package will be documented in this file.
4
+
5
+ ## [0.2.4] - 2025-11-18
6
+
7
+ ### Fixed
8
+ - **TypeScript source updated**: Applied trace file extension preservation fix to TypeScript source (`index.ts`) and rebuilt `lib/index.js` to ensure both TypeScript and JavaScript implementations have the fix.
9
+
10
+ ### Fixed
11
+ - **Package entry point**: Changed main entry point from `lib/index.js` to `index.js` to use the correct implementation with trace file extension preservation fix.
12
+
13
+ ## [0.2.3] - 2025-11-18
14
+
15
+ ### Fixed
16
+ - **Trace file extension preservation**: Fixed issue where Playwright trace files were being uploaded to S3 without their `.zip` extension, causing "Could not load trace" errors in Playwright Trace Viewer. The reporter now preserves the original file extension from `attachment.path` when uploading artifacts, ensuring trace files maintain their `.zip` format required by the viewer.
17
+
18
+ ## [0.2.2] - Previous release
19
+
20
+ ### Features
21
+ - Direct S3 uploads with presigned URLs
22
+ - Asynchronous artifact processing
23
+ - Enhanced error handling and retry logic
package/index.js CHANGED
@@ -371,14 +371,20 @@ class TestLensReporter {
371
371
  try {
372
372
  console.log(`📤 Processing ${attachment.name} asynchronously...`);
373
373
 
374
+ // Preserve original file extension from path (important for traces which must be .zip)
375
+ const originalExt = path.extname(attachment.path);
376
+ const fileName = attachment.name.includes(originalExt)
377
+ ? attachment.name
378
+ : attachment.name + originalExt;
379
+
374
380
  // Upload to S3 first
375
- const s3Data = await this.uploadArtifactToS3(attachment.path, testId, attachment.name);
381
+ const s3Data = await this.uploadArtifactToS3(attachment.path, testId, fileName);
376
382
 
377
383
  const artifactData = {
378
384
  testId,
379
- type: this.getArtifactType(attachment.name),
385
+ type: this.getArtifactType(fileName),
380
386
  path: attachment.path,
381
- name: attachment.name,
387
+ name: fileName,
382
388
  contentType: attachment.contentType,
383
389
  fileSize: this.getFileSize(attachment.path),
384
390
  storageType: 's3',
package/index.ts CHANGED
@@ -483,20 +483,26 @@ export class TestLensReporter implements Reporter {
483
483
  for (const attachment of attachments) {
484
484
  if (attachment.path) {
485
485
  try {
486
+ // Preserve original file extension from path (important for traces which must be .zip)
487
+ const originalExt = path.extname(attachment.path);
488
+ const fileName = attachment.name.includes(originalExt)
489
+ ? attachment.name
490
+ : attachment.name + originalExt;
491
+
486
492
  // Upload to S3 first
487
- const s3Data = await this.uploadArtifactToS3(attachment.path, testId, attachment.name);
493
+ const s3Data = await this.uploadArtifactToS3(attachment.path, testId, fileName);
488
494
 
489
495
  // Skip if upload failed or file was too large
490
496
  if (!s3Data) {
491
- console.log(`⏭️ Skipping artifact ${attachment.name} - upload failed or file too large`);
497
+ console.log(`⏭️ Skipping artifact ${fileName} - upload failed or file too large`);
492
498
  continue;
493
499
  }
494
500
 
495
501
  const artifactData = {
496
502
  testId,
497
- type: this.getArtifactType(attachment.name),
503
+ type: this.getArtifactType(fileName),
498
504
  path: attachment.path,
499
- name: attachment.name,
505
+ name: fileName,
500
506
  contentType: attachment.contentType,
501
507
  fileSize: this.getFileSize(attachment.path),
502
508
  storageType: 's3',
package/lib/index.js CHANGED
@@ -352,18 +352,23 @@ class TestLensReporter {
352
352
  for (const attachment of attachments) {
353
353
  if (attachment.path) {
354
354
  try {
355
+ // Preserve original file extension from path (important for traces which must be .zip)
356
+ const originalExt = path.extname(attachment.path);
357
+ const fileName = attachment.name.includes(originalExt)
358
+ ? attachment.name
359
+ : attachment.name + originalExt;
355
360
  // Upload to S3 first
356
- const s3Data = await this.uploadArtifactToS3(attachment.path, testId, attachment.name);
361
+ const s3Data = await this.uploadArtifactToS3(attachment.path, testId, fileName);
357
362
  // Skip if upload failed or file was too large
358
363
  if (!s3Data) {
359
- console.log(`⏭️ Skipping artifact ${attachment.name} - upload failed or file too large`);
364
+ console.log(`⏭️ Skipping artifact ${fileName} - upload failed or file too large`);
360
365
  continue;
361
366
  }
362
367
  const artifactData = {
363
368
  testId,
364
- type: this.getArtifactType(attachment.name),
369
+ type: this.getArtifactType(fileName),
365
370
  path: attachment.path,
366
- name: attachment.name,
371
+ name: fileName,
367
372
  contentType: attachment.contentType,
368
373
  fileSize: this.getFileSize(attachment.path),
369
374
  storageType: 's3',
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "testlens-playwright-reporter",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Universal Playwright reporter for TestLens - works with both TypeScript and JavaScript projects",
5
- "main": "lib/index.js",
5
+ "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
8
8
  "index.js",