@empiricalrun/playwright-utils 0.43.0 → 0.43.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,11 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.43.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5c120e0: fix: summary json generated after html
8
+
3
9
  ## 0.43.0
4
10
 
5
11
  ### 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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.43.0",
3
+ "version": "0.43.1",
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/cua": "^0.3.0",
47
- "@empiricalrun/dashboard-client": "^0.2.0",
48
46
  "@empiricalrun/llm": "^0.26.0",
49
47
  "@empiricalrun/r2-uploader": "^0.9.1",
50
- "@empiricalrun/reporter": "^0.28.0"
48
+ "@empiricalrun/reporter": "^0.28.0",
49
+ "@empiricalrun/cua": "^0.3.0",
50
+ "@empiricalrun/dashboard-client": "^0.2.0"
51
51
  },
52
52
  "scripts": {
53
53
  "dev": "tsc --build --watch",