@empiricalrun/playwright-utils 0.32.0 → 0.33.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6c4f6de: feat: support html reporter for 1.57.0
|
|
8
|
+
- a94a7f7: fix: resolve multipart upload retry failures
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [a94a7f7]
|
|
13
|
+
- @empiricalrun/r2-uploader@0.5.0
|
|
14
|
+
- @empiricalrun/test-gen@0.78.3
|
|
15
|
+
|
|
3
16
|
## 0.32.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAanC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,UAAU,CACwE;IAE1F,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,6BAA6B,CA4BnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAanC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,UAAU,CACwE;IAE1F,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,6BAA6B,CA4BnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IA8EtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA+G/B;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -67,49 +67,54 @@ class EmpiricalReporter {
|
|
|
67
67
|
}
|
|
68
68
|
try {
|
|
69
69
|
const attachmentPromises = result.attachments.map(async (attachment) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
try {
|
|
71
|
+
const fileMap = await this.enqueTestAttachmentUploadTask(attachment);
|
|
72
|
+
if (!fileMap) {
|
|
73
|
+
logger_1.logger.error(`No upload result for ${attachment.name}`);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
const url = Object.values(fileMap)[0];
|
|
77
|
+
if (!url) {
|
|
78
|
+
logger_1.logger.error(`No url in file map for ${attachment.name}`);
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (!attachment.path) {
|
|
82
|
+
logger_1.logger.error(`No path in attachment for ${attachment.name}`);
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
name: attachment.name,
|
|
87
|
+
contentType: attachment.contentType,
|
|
88
|
+
path: attachment.path,
|
|
89
|
+
url,
|
|
90
|
+
};
|
|
80
91
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
logger_1.logger.error(`No path in file map for ${attachment}`);
|
|
92
|
+
catch (err) {
|
|
93
|
+
logger_1.logger.error(`[Empirical Reporter] Error uploading attachment ${attachment.name} for test ${test.title}:`, err);
|
|
84
94
|
return undefined;
|
|
85
95
|
}
|
|
86
|
-
return {
|
|
87
|
-
name: attachment.name,
|
|
88
|
-
contentType: attachment.contentType,
|
|
89
|
-
path: attachment.path,
|
|
90
|
-
url,
|
|
91
|
-
};
|
|
92
96
|
});
|
|
93
97
|
const testCaseRunEventTask = async () => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
const uploadedAttachments = await Promise.all(attachmentPromises);
|
|
99
|
+
const successfulAttachments = uploadedAttachments.filter((a) => a !== undefined);
|
|
100
|
+
try {
|
|
101
|
+
logger_1.logger.debug(`[Empirical Reporter] Attachments for test ${test.title} are uploaded:`, successfulAttachments);
|
|
97
102
|
const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
|
|
98
103
|
const params = {
|
|
99
104
|
test,
|
|
100
105
|
suites,
|
|
101
106
|
result,
|
|
102
107
|
projectName,
|
|
103
|
-
attachments:
|
|
108
|
+
attachments: successfulAttachments,
|
|
104
109
|
runId: process.env.TEST_RUN_GITHUB_ACTION_ID,
|
|
105
110
|
};
|
|
106
111
|
return (0, util_1.sendTestCaseUpdateToDashboard)(params);
|
|
107
|
-
}
|
|
108
|
-
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
109
114
|
logger_1.logger.error(`[Empirical Reporter] Error sending test case event for: ${test.title}:`, error);
|
|
110
|
-
}
|
|
115
|
+
}
|
|
111
116
|
};
|
|
112
|
-
void (
|
|
117
|
+
void testCaseRunEventTask();
|
|
113
118
|
return;
|
|
114
119
|
}
|
|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AAiB,CAC/B,QAAQ,EAAE,GAAG,EACb,iBAAiB,EAAE,GAAG,CACpB,MAAM,EACN;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CACjD,QA+BF;AAGD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,oBAAoB,EACjC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,QAavC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,OAAe,GAC9B,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CAAC,CA4C/D;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,6CAoClB"}
|
package/dist/reporter/util.js
CHANGED
|
@@ -166,7 +166,12 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
|
|
|
166
166
|
console.error(`❌ Failed to read HTML file at ${htmlFilePath}:`, err);
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
// Support both old format (1.53.x) and new format (1.57.0+)
|
|
170
|
+
// Old: window.playwrightReportBase64 = "data:application/zip;base64,..."
|
|
171
|
+
// New: <script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,...</script>
|
|
172
|
+
const oldFormatMatch = htmlFile.match(/window\.playwrightReportBase64\s*=\s*"(?:data:application\/zip;base64,)?([^"]+)"/);
|
|
173
|
+
const newFormatMatch = htmlFile.match(/<script\s+id="playwrightReportBase64"[^>]*>(?:data:application\/zip;base64,)?([^<]+)<\/script>/);
|
|
174
|
+
const base64 = oldFormatMatch?.[1] || newFormatMatch?.[1];
|
|
170
175
|
if (!base64) {
|
|
171
176
|
console.error("❌ Base64 zip data not found in HTML.");
|
|
172
177
|
return;
|
|
@@ -203,7 +208,15 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
|
|
|
203
208
|
const newZip = new adm_zip_1.default();
|
|
204
209
|
newZip.addLocalFolder(tempDir);
|
|
205
210
|
const newBase64 = newZip.toBuffer().toString("base64");
|
|
206
|
-
|
|
211
|
+
let updatedHtml;
|
|
212
|
+
if (oldFormatMatch) {
|
|
213
|
+
// Old format (1.53.x): window.playwrightReportBase64 = "..."
|
|
214
|
+
updatedHtml = htmlFile.replace(/(window\.playwrightReportBase64\s*=\s*")(?:data:application\/zip;base64,)?[^"]*(")/, `$1data:application/zip;base64,${newBase64}$2`);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// New format (1.57.0+): <script id="playwrightReportBase64" ...>...</script>
|
|
218
|
+
updatedHtml = htmlFile.replace(/(<script\s+id="playwrightReportBase64"[^>]*>)(?:data:application\/zip;base64,)?[^<]*(<\/script>)/, `$1data:application/zip;base64,${newBase64}$2`);
|
|
219
|
+
}
|
|
207
220
|
await fs_1.default.promises.writeFile(htmlFilePath, updatedHtml, "utf8");
|
|
208
221
|
logger_1.logger.debug("✅ HTML file updated with new base64 zip attachment.");
|
|
209
222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"@empiricalrun/llm": "^0.25.1",
|
|
46
|
-
"@empiricalrun/r2-uploader": "^0.
|
|
47
|
-
"@empiricalrun/test-gen": "^0.78.
|
|
46
|
+
"@empiricalrun/r2-uploader": "^0.5.0",
|
|
47
|
+
"@empiricalrun/test-gen": "^0.78.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "tsc --build --watch",
|