@empiricalrun/playwright-utils 0.50.0 → 0.50.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.50.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8b1be9e: fix: html report attachment urls for pw 1.60.0
8
+ - Updated dependencies [8b1be9e]
9
+ - @empiricalrun/reporter@0.29.1
10
+
3
11
  ## 0.50.0
4
12
 
5
13
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAMhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACL,UAAU,IAAI,oBAAoB,EAElC,QAAQ,EACT,MAAM,2BAA2B,CAAC;AA0BnC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmB7D;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,UAMhC;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAy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to read HTML file at ${htmlFilePath}:`, err);
174
174
  return;
175
175
  }
176
- // Support both old format (1.53.x) and new format (1.57.0+)
176
+ // Support the global assignment, script tag, and Playwright 1.60 template tag.
177
177
  // Old: window.playwrightReportBase64 = "data:application/zip;base64,..."
178
- // New: <script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,...</script>
179
- const oldFormatMatch = htmlFile.match(/window\.playwrightReportBase64\s*=\s*"(?:data:application\/zip;base64,)?([^"]+)"/);
180
- const newFormatMatch = htmlFile.match(/<script\s+id="playwrightReportBase64"[^>]*>(?:data:application\/zip;base64,)?([^<]+)<\/script>/);
181
- const base64 = oldFormatMatch?.[1] || newFormatMatch?.[1];
178
+ // Newer: <script|template id="playwrightReportBase64">data:application/zip;base64,...</script|template>
179
+ const base64 = (0, reporter_1.findPlaywrightReportBase64)(htmlFile);
182
180
  if (!base64) {
183
181
  console.error("❌ Base64 zip data not found in HTML.");
184
182
  return;
@@ -214,15 +212,7 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
214
212
  }
215
213
  const newBuffer = await (0, zip_1.createZipFromDirectory)(tempDir);
216
214
  const newBase64 = newBuffer.toString("base64");
217
- let updatedHtml;
218
- if (oldFormatMatch) {
219
- // Old format (1.53.x): window.playwrightReportBase64 = "..."
220
- updatedHtml = htmlFile.replace(/(window\.playwrightReportBase64\s*=\s*")(?:data:application\/zip;base64,)?[^"]*(")/, `$1data:application/zip;base64,${newBase64}$2`);
221
- }
222
- else {
223
- // New format (1.57.0+): <script id="playwrightReportBase64" ...>...</script>
224
- updatedHtml = htmlFile.replace(/(<script\s+id="playwrightReportBase64"[^>]*>)(?:data:application\/zip;base64,)?[^<]*(<\/script>)/, `$1data:application/zip;base64,${newBase64}$2`);
225
- }
215
+ const updatedHtml = (0, reporter_1.replacePlaywrightReportBase64)(htmlFile, newBase64);
226
216
  await fs_1.default.promises.writeFile(htmlFilePath, updatedHtml, "utf8");
227
217
  logger_1.logger.debug("✅ HTML file updated with new base64 zip attachment.");
228
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.50.0",
3
+ "version": "0.50.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -50,7 +50,7 @@
50
50
  "@empiricalrun/dashboard-client": "^0.3.0",
51
51
  "@empiricalrun/llm": "^0.27.0",
52
52
  "@empiricalrun/r2-uploader": "^0.9.1",
53
- "@empiricalrun/reporter": "^0.29.0"
53
+ "@empiricalrun/reporter": "^0.29.1"
54
54
  },
55
55
  "scripts": {
56
56
  "dev": "tsc --build --watch",