@empiricalrun/playwright-utils 0.43.0 → 0.44.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,17 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d3981f9: fix: prevent attachment upload in blob zip
8
+
9
+ ## 0.43.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 5c120e0: fix: summary json generated after html
14
+
3
15
  ## 0.43.0
4
16
 
5
17
  ### Minor Changes
@@ -51,8 +51,8 @@ function getReporters() {
51
51
  ],
52
52
  ]
53
53
  : [
54
- ["json", { outputFile: "playwright-report/summary.json" }],
55
54
  ["html", { open: "never" }],
55
+ ["json", { outputFile: "playwright-report/summary.json" }],
56
56
  ];
57
57
  return [
58
58
  ["list"],
@@ -11,7 +11,7 @@ declare class EmpiricalReporter implements Reporter {
11
11
  private enqueTestAttachmentUploadTask;
12
12
  onTestEnd(test: TestCase, result: TestResult): void;
13
13
  onEnd(result: FullResult): Promise<void>;
14
- private _logMissingFiles;
14
+ private _logReportDirContents;
15
15
  private _patchBlobReport;
16
16
  private _uploadBlobReport;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAqBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;;IAM1C,OAAO,CAAC,6BAA6B,CAkCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAuGtC,KAAK,CAAC,MAAM,EAAE,UAAU;IAkH9B,OAAO,CAAC,gBAAgB;YAoBV,gBAAgB;YAOhB,iBAAiB;CAmChC;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAqBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;;IAM1C,OAAO,CAAC,6BAA6B,CAkCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAuGtC,KAAK,CAAC,MAAM,EAAE,UAAU;IAiG9B,OAAO,CAAC,qBAAqB;YAkBf,gBAAgB;YAOhB,iBAAiB;CAmChC;AAED,eAAe,iBAAiB,CAAC"}
@@ -129,35 +129,29 @@ class EmpiricalReporter {
129
129
  logger_1.logger.debug(`[Empirical Reporter] Test run completed with status: ${result.status}`);
130
130
  logger_1.logger.debug(`[Empirical Reporter] State: cwd=${this._currentWorkingDir}, hasSharding=${this._hasSharding}`);
131
131
  const startTime = Date.now();
132
- logger_1.logger.debug("[Empirical Reporter] Starting final report upload at: ", new Intl.DateTimeFormat("en-US", {
133
- hour: "2-digit",
134
- minute: "2-digit",
135
- second: "2-digit",
136
- }).format(startTime));
137
- const jsonFilePath = path_1.default.join(this._currentWorkingDir, "playwright-report", "summary.json");
132
+ const reportDir = path_1.default.join(this._currentWorkingDir, "playwright-report");
133
+ const jsonFilePath = path_1.default.join(reportDir, "summary.json");
134
+ const htmlFilePath = path_1.default.join(reportDir, "index.html");
138
135
  const jsonExists = fs_1.default.existsSync(jsonFilePath);
139
- const htmlFilePath = path_1.default.join(this._currentWorkingDir, "playwright-report/index.html");
140
- const htmlExists = await (0, util_1.checkFileExistsAsync)(htmlFilePath);
136
+ const htmlExists = fs_1.default.existsSync(htmlFilePath);
141
137
  if (!htmlExists || !jsonExists) {
142
- this._logMissingFiles();
138
+ this._logReportDirContents();
143
139
  }
144
140
  if (htmlExists && jsonExists) {
145
- logger_1.logger.debug("[Empirical Reporter] Updating the HTML Zip");
141
+ logger_1.logger.debug("[Empirical Reporter] Patching HTML with attachment URLs");
146
142
  await (0, util_1.updateHtmlZipFileAttachmentPaths)(jsonFilePath, htmlFilePath, this._testResultSourceDir);
147
- logger_1.logger.debug("[Empirical Reporter] Uploading HTML file");
148
143
  await this._uploader.uploadFile(htmlFilePath, "index.html");
149
144
  }
150
- else {
151
- logger_1.logger.error(`[Empirical Reporter] playwright-report/index.html does not exist at: ${htmlFilePath}`);
145
+ else if (!htmlExists) {
146
+ logger_1.logger.error(`[Empirical Reporter] index.html not found at: ${htmlFilePath}`);
152
147
  }
153
148
  if (jsonExists) {
154
- logger_1.logger.debug("[Empirical Reporter] Updating the JSON file");
149
+ logger_1.logger.debug("[Empirical Reporter] Patching summary.json with attachment URLs");
155
150
  await (0, util_1.updateSummaryJsonAttachmentPaths)(jsonFilePath, this._testResultSourceDir, `${this._uploader.urlPrefix}/data`);
156
- logger_1.logger.debug("[Empirical Reporter] Uploading JSON file");
157
151
  await this._uploader.uploadFile(jsonFilePath, "summary.json");
158
152
  }
159
153
  else {
160
- logger_1.logger.error(`[Empirical Reporter] summary.json does not exist at: ${jsonFilePath}`);
154
+ logger_1.logger.error(`[Empirical Reporter] summary.json not found at: ${jsonFilePath}`);
161
155
  }
162
156
  const traceFilePath = path_1.default.join(this._currentWorkingDir, "playwright-report/trace");
163
157
  const traceExists = await (0, util_1.checkFileExistsAsync)(traceFilePath);
@@ -188,21 +182,19 @@ class EmpiricalReporter {
188
182
  const timeDiff = Date.now() - startTime;
189
183
  logger_1.logger.debug("[Empirical Reporter] Time taken to upload after tests ended: ", timeDiff, "ms");
190
184
  }
191
- _logMissingFiles() {
185
+ _logReportDirContents() {
192
186
  try {
193
- const cwdFiles = fs_1.default.readdirSync(this._currentWorkingDir);
194
- logger_1.logger.debug(`[Empirical Reporter] Files in cwd: ${cwdFiles.join(", ")}`);
195
187
  const reportDir = path_1.default.join(this._currentWorkingDir, "playwright-report");
196
188
  if (fs_1.default.existsSync(reportDir)) {
197
189
  const reportFiles = fs_1.default.readdirSync(reportDir);
198
- logger_1.logger.debug(`[Empirical Reporter] Files in playwright-report: ${reportFiles.join(", ")}`);
190
+ logger_1.logger.info(`[Empirical Reporter] Files in playwright-report: ${reportFiles.join(", ")}`);
199
191
  }
200
192
  else {
201
- logger_1.logger.debug(`[Empirical Reporter] playwright-report directory does not exist`);
193
+ logger_1.logger.warn(`[Empirical Reporter] playwright-report directory does not exist`);
202
194
  }
203
195
  }
204
196
  catch (e) {
205
- logger_1.logger.debug(`[Empirical Reporter] Error listing files: ${e}`);
197
+ logger_1.logger.error(`[Empirical Reporter] Error listing report dir: ${e}`);
206
198
  }
207
199
  }
208
200
  async _patchBlobReport(blobDir) {
@@ -1 +1 @@
1
- {"version":3,"file":"incremental-blob-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/incremental-blob-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAUnC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,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AAM,GAAG,IAAI;IAI5D,aAAa,IAAI,OAAO;CAGzB;AAID,wBAAgB,0BAA0B,IAAI,uBAAuB,GAAG,IAAI,CAE3E;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,eAAe,uBAAuB,CAAC"}
@@ -13,6 +13,9 @@ const os_1 = __importDefault(require("os"));
13
13
  const path_1 = __importDefault(require("path"));
14
14
  const uploader_1 = require("./uploader");
15
15
  const BLOB_REPORT_VERSION = 2;
16
+ function isLocalTesting() {
17
+ return process.env.LOCAL_TEST === "true";
18
+ }
16
19
  class IncrementalBlobReporter {
17
20
  _currentWorkingDir = process.cwd();
18
21
  _stagingDir = path_1.default.join(this._currentWorkingDir, "blob-report-incremental", "staging");
@@ -48,7 +51,8 @@ class IncrementalBlobReporter {
48
51
  console.log("[IncrementalBlobReporter] SIGINT received, flushing and uploading...");
49
52
  this._flushAndUpload()
50
53
  .then(() => {
51
- console.log("[IncrementalBlobReporter] Flush and upload complete on SIGINT");
54
+ console.log("[IncrementalBlobReporter] Flush and upload complete on SIGINT, exiting");
55
+ process.exit(0);
52
56
  })
53
57
  .catch((err) => {
54
58
  console.error("[IncrementalBlobReporter] Flush/upload failed on SIGINT:", err);
@@ -80,7 +84,7 @@ class IncrementalBlobReporter {
80
84
  await this._uploader.uploadFile(this._zipPath, `blobs/incremental-report-${this._shardIndex}.zip`);
81
85
  await this._uploader.waitForUploads();
82
86
  console.log("[IncrementalBlobReporter] Flush and upload complete on SIGINT");
83
- if (process.env.LOCAL_TEST === "true") {
87
+ if (isLocalTesting()) {
84
88
  await this._mergeForLocalTest();
85
89
  }
86
90
  }
@@ -127,6 +131,9 @@ class IncrementalBlobReporter {
127
131
  _embedAttachment(attachmentPath, resultId) {
128
132
  if (!attachmentPath || !fs_1.default.existsSync(attachmentPath))
129
133
  return null;
134
+ if (!isLocalTesting()) {
135
+ return null;
136
+ }
130
137
  const ext = path_1.default.extname(attachmentPath);
131
138
  const uniqueName = `${resultId}-${this._generateId()}${ext}`;
132
139
  const destPath = path_1.default.join(this._stagingDir, uniqueName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -43,11 +43,11 @@
43
43
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
44
44
  "rimraf": "^6.0.1",
45
45
  "ts-morph": "^23.0.0",
46
+ "@empiricalrun/llm": "^0.26.0",
46
47
  "@empiricalrun/cua": "^0.3.0",
47
48
  "@empiricalrun/dashboard-client": "^0.2.0",
48
- "@empiricalrun/llm": "^0.26.0",
49
- "@empiricalrun/r2-uploader": "^0.9.1",
50
- "@empiricalrun/reporter": "^0.28.0"
49
+ "@empiricalrun/reporter": "^0.28.0",
50
+ "@empiricalrun/r2-uploader": "^0.9.1"
51
51
  },
52
52
  "scripts": {
53
53
  "dev": "tsc --build --watch",