@empiricalrun/playwright-utils 0.28.7 → 0.29.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/config/index.js +1 -6
  4. package/dist/playwright-extensions.d.ts.map +1 -1
  5. package/dist/reporter/empirical-reporter.d.ts +1 -1
  6. package/dist/reporter/empirical-reporter.d.ts.map +1 -1
  7. package/dist/reporter/empirical-reporter.js +38 -38
  8. package/dist/reporter/uploader.d.ts +1 -12
  9. package/dist/reporter/uploader.d.ts.map +1 -1
  10. package/dist/reporter/uploader.js +0 -42
  11. package/dist/reporter/util.d.ts +3 -21
  12. package/dist/reporter/util.d.ts.map +1 -1
  13. package/dist/reporter/util.js +0 -17
  14. package/package.json +6 -6
  15. package/playwright.config.ts +7 -4
  16. package/tsconfig.tsbuildinfo +1 -1
  17. package/dist/reporter/base.d.ts +0 -41
  18. package/dist/reporter/base.d.ts.map +0 -1
  19. package/dist/reporter/base.js +0 -177
  20. package/dist/reporter/custom.d.ts +0 -72
  21. package/dist/reporter/custom.d.ts.map +0 -1
  22. package/dist/reporter/custom.js +0 -824
  23. package/dist/reporter/queue.d.ts +0 -8
  24. package/dist/reporter/queue.d.ts.map +0 -1
  25. package/dist/reporter/queue.js +0 -88
  26. package/dist/reporter/reporterV2.d.ts +0 -36
  27. package/dist/reporter/reporterV2.d.ts.map +0 -1
  28. package/dist/reporter/reporterV2.js +0 -19
  29. package/dist/reporter/third_party/html-reporter-types.d.ts +0 -107
  30. package/dist/reporter/third_party/html-reporter-types.d.ts.map +0 -1
  31. package/dist/reporter/third_party/html-reporter-types.js +0 -18
  32. package/dist/reporter/types.d.ts +0 -3
  33. package/dist/reporter/types.d.ts.map +0 -1
  34. package/dist/reporter/types.js +0 -2
  35. package/eslint.config.mjs +0 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b01be05: feat: move task queue to r2-uploader package
8
+
9
+ ### Patch Changes
10
+
11
+ - 6920cda: feat: send all attachments from pw-utils to dash
12
+ - Updated dependencies [b01be05]
13
+ - Updated dependencies [e65313e]
14
+ - @empiricalrun/r2-uploader@0.4.0
15
+ - @empiricalrun/test-gen@0.78.0
16
+ - @empiricalrun/llm@0.24.0
17
+
18
+ ## 0.28.8
19
+
20
+ ### Patch Changes
21
+
22
+ - a085efd: chore: remove custom reporter for playwright 1.47
23
+ - 7077c69: fix: empirical-reporter video url array bug
24
+ - Updated dependencies [8ff49e5]
25
+ - Updated dependencies [bc38c65]
26
+ - Updated dependencies [a45714d]
27
+ - Updated dependencies [e5e45e0]
28
+ - Updated dependencies [ba65440]
29
+ - Updated dependencies [cf991ee]
30
+ - Updated dependencies [44373a4]
31
+ - Updated dependencies [8a206cf]
32
+ - Updated dependencies [eda0ccd]
33
+ - Updated dependencies [151dc8f]
34
+ - Updated dependencies [49b44a6]
35
+ - Updated dependencies [25bd9b6]
36
+ - Updated dependencies [1f7e8b0]
37
+ - Updated dependencies [42e19ee]
38
+ - Updated dependencies [82a6fe7]
39
+ - Updated dependencies [f9a7023]
40
+ - Updated dependencies [d56954c]
41
+ - Updated dependencies [02c3532]
42
+ - Updated dependencies [8f3a25f]
43
+ - Updated dependencies [bd61b13]
44
+ - Updated dependencies [a25735a]
45
+ - @empiricalrun/llm@0.23.0
46
+ - @empiricalrun/test-gen@0.77.0
47
+
3
48
  ## 0.28.7
4
49
 
5
50
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAczD,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AA2CD,eAAO,MAAM,UAAU,EAAE,oBA0BxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAarB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAczD,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AAwCD,eAAO,MAAM,UAAU,EAAE,oBA0BxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAarB,CAAC"}
@@ -53,13 +53,8 @@ function isPlaywrightV147() {
53
53
  return version && version.includes("1.47") ? true : false;
54
54
  }
55
55
  function getReporters() {
56
- // TODO: Remove this once we have migrated to 1.53.X for all repos
57
56
  if (isPlaywrightV147()) {
58
- return [
59
- ["list"],
60
- ["json", { outputFile: "playwright-report/summary.json" }],
61
- ["./node_modules/@empiricalrun/playwright-utils/dist/reporter/custom.js"],
62
- ];
57
+ throw new Error("Please upgrade to Playwright version 1.53.X or above to use the latest reporters");
63
58
  }
64
59
  return [
65
60
  ["list"],
@@ -1 +1 @@
1
- {"version":3,"file":"playwright-extensions.d.ts","sourceRoot":"","sources":["../src/playwright-extensions.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,OAAO,QAAQ,iBAAiB,CAAC;IAC/B,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C"}
1
+ {"version":3,"file":"playwright-extensions.d.ts","sourceRoot":"","sources":["../src/playwright-extensions.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,OAAO,QAAQ,iBAAiB,CAAC;IAC/B,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C"}
@@ -9,7 +9,7 @@ declare class EmpiricalReporter implements Reporter {
9
9
  private _urlPrefix;
10
10
  private checkR2Creds;
11
11
  constructor();
12
- private processTestAttachment;
12
+ private enqueTestAttachmentUploadTask;
13
13
  onTestEnd(test: TestCase, result: TestResult): void;
14
14
  onEnd(result: FullResult): Promise<void>;
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAiBnC,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,CAA2F;IAE7G,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,qBAAqB,CAuB3B;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAyEtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA+G/B;AAED,eAAe,iBAAiB,CAAC"}
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;IAsEtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA+G/B;AAED,eAAe,iBAAiB,CAAC"}
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const crypto_1 = require("crypto");
6
+ const r2_uploader_1 = require("@empiricalrun/r2-uploader");
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const logger_1 = require("../logger");
10
- const queue_1 = require("./queue");
11
10
  const uploader_1 = require("./uploader");
12
11
  const util_1 = require("./util");
13
12
  class EmpiricalReporter {
@@ -36,9 +35,11 @@ class EmpiricalReporter {
36
35
  this._destinationDir = path_1.default.join(process.env.PROJECT_NAME, process.env.TEST_RUN_GITHUB_ACTION_ID);
37
36
  this._willUploadArtifacts = this.checkR2Creds();
38
37
  }
39
- processTestAttachment = async (attachment) => {
40
- if (!attachment.path)
38
+ enqueTestAttachmentUploadTask = async (attachment) => {
39
+ if (!attachment.path) {
40
+ logger_1.logger.warn(`[Empirical Reporter] Skipping attachment without path: ${attachment.name}`);
41
41
  return;
42
+ }
42
43
  const exists = await (0, util_1.checkFileExistsAsync)(attachment.path);
43
44
  if (exists) {
44
45
  logger_1.logger.debug(`[Empirical Reporter] Processing attachment: File exists`);
@@ -54,7 +55,7 @@ class EmpiricalReporter {
54
55
  uploadBucket: this._uploadBucket,
55
56
  baseUrl: this._baseUrl,
56
57
  });
57
- return (0, queue_1.sendTaskToQueue)(uploadTask);
58
+ return (0, r2_uploader_1.sendTaskToQueue)(uploadTask);
58
59
  };
59
60
  onTestEnd(test, result) {
60
61
  if (!this._willUploadArtifacts) {
@@ -65,51 +66,50 @@ class EmpiricalReporter {
65
66
  return;
66
67
  }
67
68
  try {
68
- const attachmentPromises = result.attachments.map((attachment) => {
69
- return this.processTestAttachment(attachment);
69
+ const attachmentPromises = result.attachments.map(async (attachment) => {
70
+ const fileMap = await this.enqueTestAttachmentUploadTask(attachment);
71
+ if (!fileMap) {
72
+ logger_1.logger.error(`No upload result for ${attachment}`);
73
+ return undefined;
74
+ }
75
+ // Since we are uploading a single attachmnet, the fileMap will have one entry
76
+ const url = Object.values(fileMap)[0];
77
+ if (!url) {
78
+ logger_1.logger.error(`No url in file map for ${attachment}`);
79
+ return undefined;
80
+ }
81
+ if (!attachment.path) {
82
+ // This should never happen because we only upload if attachment.path is there
83
+ logger_1.logger.error(`No path in file map for ${attachment}`);
84
+ return undefined;
85
+ }
86
+ return {
87
+ name: attachment.name,
88
+ contentType: attachment.contentType,
89
+ path: attachment.path,
90
+ url,
91
+ };
70
92
  });
71
93
  const testCaseRunEventTask = async () => {
72
94
  return Promise.all(attachmentPromises)
73
95
  .then((uploadedAttachments) => {
74
96
  logger_1.logger.debug(`[Empirical Reporter] Attachments for test ${test.title} are uploaded:`, uploadedAttachments);
75
97
  const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
76
- let params = {
98
+ const params = {
77
99
  test,
78
- result,
79
- assetsURL: {
80
- trace: "",
81
- videos: [],
82
- errorContext: "",
83
- },
84
100
  suites,
101
+ result,
85
102
  projectName,
86
- runId: process.env.TEST_RUN_GITHUB_ACTION_ID || "",
103
+ attachments: uploadedAttachments.filter((a) => a !== undefined),
104
+ runId: process.env.TEST_RUN_GITHUB_ACTION_ID,
87
105
  };
88
- uploadedAttachments.forEach((attachment) => {
89
- if (attachment) {
90
- Object.entries(attachment).forEach(([key, value]) => {
91
- if (key.includes("video")) {
92
- params.assetsURL.videos.push({
93
- name: `test-${test.id}-slug-${(0, crypto_1.randomUUID)()}`,
94
- url: value,
95
- });
96
- }
97
- if (key.includes("trace")) {
98
- params.assetsURL.trace = value;
99
- }
100
- if (key.includes("error-context")) {
101
- params.assetsURL.errorContext = value;
102
- }
103
- });
104
- }
105
- });
106
106
  return (0, util_1.sendTestCaseUpdateToDashboard)(params);
107
107
  })
108
108
  .catch((error) => {
109
109
  logger_1.logger.error(`[Empirical Reporter] Error sending test case event for: ${test.title}:`, error);
110
110
  });
111
111
  };
112
- void (0, queue_1.sendTaskToQueue)(testCaseRunEventTask);
112
+ void (0, r2_uploader_1.sendTaskToQueue)(testCaseRunEventTask);
113
113
  return;
114
114
  }
115
115
  catch (error) {
@@ -142,7 +142,7 @@ class EmpiricalReporter {
142
142
  uploadBucket: this._uploadBucket,
143
143
  baseUrl: this._baseUrl,
144
144
  });
145
- void (0, queue_1.sendTaskToQueue)(uploadHtmlTask);
145
+ void (0, r2_uploader_1.sendTaskToQueue)(uploadHtmlTask);
146
146
  }
147
147
  else {
148
148
  logger_1.logger.error(`[Empirical Reporter] playwright-report/index.html does not exist at: ${htmlFilePath}`);
@@ -158,7 +158,7 @@ class EmpiricalReporter {
158
158
  uploadBucket: this._uploadBucket,
159
159
  baseUrl: this._baseUrl,
160
160
  });
161
- void (0, queue_1.sendTaskToQueue)(uploadJsonTask);
161
+ void (0, r2_uploader_1.sendTaskToQueue)(uploadJsonTask);
162
162
  }
163
163
  else {
164
164
  logger_1.logger.error(`[Empirical Reporter] summary.json does not exist at: ${jsonFilePath}`);
@@ -173,13 +173,13 @@ class EmpiricalReporter {
173
173
  uploadBucket: this._uploadBucket,
174
174
  baseUrl: this._baseUrl,
175
175
  });
176
- void (0, queue_1.sendTaskToQueue)(uploadTraceTask);
176
+ void (0, r2_uploader_1.sendTaskToQueue)(uploadTraceTask);
177
177
  }
178
178
  else {
179
179
  logger_1.logger.error(`[Empirical Reporter] playwright-report/trace does not exist at: ${traceFilePath}`);
180
180
  return;
181
181
  }
182
- await (0, queue_1.waitForTaskQueueToFinish)();
182
+ await (0, r2_uploader_1.waitForTaskQueueToFinish)();
183
183
  logger_1.logger.debug("[Empirical Reporter] All uploads finished");
184
184
  const endTime = new Date().getTime();
185
185
  logger_1.logger.debug("[Empirical Reporter] Finished final report upload at: ", new Intl.DateTimeFormat("en-US", {
@@ -1,15 +1,4 @@
1
- import { FileMap } from "@empiricalrun/r2-uploader";
2
- import { AsyncTask } from "./queue";
3
- export declare function uploadFiles({ fileList, outputFolder, relativePath, }: {
4
- outputFolder: string;
5
- fileList?: string[];
6
- relativePath: string;
7
- }): Promise<FileMap | void>;
8
- export declare function createUploadTask({ fileList, outputFolder, relativePath, }: {
9
- outputFolder: string;
10
- fileList?: string[];
11
- relativePath?: string;
12
- }): AsyncTask;
1
+ import { AsyncTask } from "@empiricalrun/r2-uploader";
13
2
  /**
14
3
  * Creates an async task for uploading files to R2 storage.
15
4
  * This is an improved version of createUploadTask that:
@@ -1 +1 @@
1
- {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,2BAA2B,CAAC;AAIrE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,wBAAsB,WAAW,CAAC,EAChC,QAAQ,EACR,YAAY,EACZ,YAAY,GACb,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAwB1B;AAGD,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,YAAY,EACZ,YAAiB,GAClB,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,SAAS,CAaZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CA8BZ"}
1
+ {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,2BAA2B,CAAC;AAKhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CA8BZ"}
@@ -3,52 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.uploadFiles = uploadFiles;
7
- exports.createUploadTask = createUploadTask;
8
6
  exports.createUploadTaskV2 = createUploadTaskV2;
9
7
  const r2_uploader_1 = require("@empiricalrun/r2-uploader");
10
8
  const path_1 = __importDefault(require("path"));
11
9
  const logger_1 = require("../logger");
12
- // TODO: Remove this once we have migrated to 1.53.X for all repos
13
- const R2_BUCKET_NAME = "test-report";
14
- const R2_BASE_URL = "https://reports.empirical.run";
15
- // TODO: Remove this once we have migrated to 1.53.X for all repos
16
- async function uploadFiles({ fileList, outputFolder, relativePath, }) {
17
- if (!process.env.PROJECT_NAME || !process.env.TEST_RUN_GITHUB_ACTION_ID) {
18
- return;
19
- }
20
- const urls = {};
21
- const sourceDir = path_1.default.join(outputFolder, relativePath);
22
- const destinationDir = path_1.default.join(process.env.PROJECT_NAME, process.env.TEST_RUN_GITHUB_ACTION_ID, relativePath);
23
- const uploadedfiles = await (0, r2_uploader_1.uploadDirectory)({
24
- sourceDir,
25
- fileList,
26
- destinationDir,
27
- uploadBucket: R2_BUCKET_NAME,
28
- });
29
- Object.entries(uploadedfiles).forEach(([filePath]) => {
30
- const fileName = filePath.split("/").pop() || "";
31
- const fileUrl = new URL(path_1.default.join(destinationDir, fileName), R2_BASE_URL);
32
- urls[fileName] = fileUrl.toString();
33
- });
34
- logger_1.logger.debug("Finished uploading files:", urls);
35
- return urls;
36
- }
37
- // TODO: Remove this once we have migrated to 1.53.X for all repos
38
- function createUploadTask({ fileList, outputFolder, relativePath = "", }) {
39
- return async () => {
40
- return uploadFiles({
41
- fileList,
42
- outputFolder,
43
- relativePath,
44
- })
45
- .then((fileMap) => {
46
- logger_1.logger.debug("Finished uploading files", fileMap);
47
- return fileMap;
48
- })
49
- .catch((e) => logger_1.logger.error("Error uploading files", e));
50
- };
51
- }
52
10
  /**
53
11
  * Creates an async task for uploading files to R2 storage.
54
12
  * This is an improved version of createUploadTask that:
@@ -1,23 +1,5 @@
1
- /**
2
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/util.ts
3
- * Copyright (c) Microsoft Corporation.
4
- * Modifications copyright (c) Forge AI Private Limited
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- import { GenericPlaywrightAttachment } from "@empiricalrun/shared-types";
19
- import { JSONReport as PlaywrightJSONReport, JSONReportSpec, TestCase } from "@playwright/test/reporter";
20
- import { TestCaseRunEndEvent } from "./types";
1
+ import { GenericPlaywrightAttachment, TestCaseRunEndEventV2 } from "@empiricalrun/shared-types";
2
+ import { JSONReportSpec, JSONReport as PlaywrightJSONReport, TestCase } from "@playwright/test/reporter";
21
3
  export declare function getPackageJsonPath(folderPath: string): string;
22
4
  export declare function resolveReporterOutputPath(defaultValue: string, configDir: string, configValue: string | undefined): string;
23
5
  export declare function normalizeAndSaveAttachment(outputPath: string, name: string, options?: {
@@ -34,7 +16,7 @@ export declare function suitesAndProjectForTest(test: TestCase): {
34
16
  suites: string[];
35
17
  projectName: string;
36
18
  };
37
- export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEvent): Promise<void>;
19
+ export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEventV2): Promise<void>;
38
20
  export declare function safelySerialiseJSON(obj: any, keyFilter?: (key: string) => boolean): any;
39
21
  export declare function updateHtmlZipFileAttachmentPaths(jsonFilePath: string, htmlFilePath: string, repoPath: string): Promise<void>;
40
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,UAAU,IAAI,oBAAoB,EAClC,cAAc,EAId,QAAQ,EACT,MAAM,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"use strict";
2
- /**
3
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/util.ts
4
- * Copyright (c) Microsoft Corporation.
5
- * Modifications copyright (c) Forge AI Private Limited
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
20
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
21
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.28.7",
3
+ "version": "0.29.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -32,7 +32,7 @@
32
32
  "@types/adm-zip": "^0.5.7",
33
33
  "playwright-core": "1.53.2",
34
34
  "serve-handler": "^6.1.6",
35
- "@empiricalrun/shared-types": "0.11.0"
35
+ "@empiricalrun/shared-types": "0.12.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/code-frame": "^7.24.7",
@@ -43,15 +43,15 @@
43
43
  "mailosaur": "^8.6.1",
44
44
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
45
45
  "rimraf": "^6.0.1",
46
- "@empiricalrun/llm": "^0.22.0",
47
- "@empiricalrun/r2-uploader": "^0.3.11",
48
- "@empiricalrun/test-gen": "^0.76.0"
46
+ "@empiricalrun/llm": "^0.24.0",
47
+ "@empiricalrun/r2-uploader": "^0.4.0",
48
+ "@empiricalrun/test-gen": "^0.78.0"
49
49
  },
50
50
  "scripts": {
51
51
  "dev": "tsc --build --watch",
52
52
  "build": "tsc --build",
53
53
  "clean": "tsc --build --clean",
54
- "lint": "eslint .",
54
+ "lint": "biome check --unsafe",
55
55
  "test": "vitest run",
56
56
  "test-browser": "npx playwright test",
57
57
  "test:watch": "vitest"
@@ -18,8 +18,11 @@ export default defineConfig({
18
18
  actionTimeout: 5_000,
19
19
  },
20
20
  expect: { timeout: 5_000 },
21
- projects: [{ name: "chromium" }, {
22
- name: "regex-test",
23
- testMatch: /.*\.random-ext.spec\.ts/,
24
- }],
21
+ projects: [
22
+ { name: "chromium" },
23
+ {
24
+ name: "regex-test",
25
+ testMatch: /.*\.random-ext.spec\.ts/,
26
+ },
27
+ ],
25
28
  });
@@ -1 +1 @@
1
- {"root":["./src/email.ts","./src/index.ts","./src/logger.ts","./src/playwright-extensions.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/base.ts","./src/reporter/custom.ts","./src/reporter/empirical-reporter.ts","./src/reporter/queue.ts","./src/reporter/reporterV2.ts","./src/reporter/types.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/reporter/third_party/html-reporter-types.ts","./src/test/constants.ts","./src/test/expect.ts","./src/test/index.ts","./src/test/types.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
1
+ {"root":["./src/email.ts","./src/index.ts","./src/logger.ts","./src/playwright-extensions.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/empirical-reporter.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/expect.ts","./src/test/index.ts","./src/test/types.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
@@ -1,41 +0,0 @@
1
- /**
2
- * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/reporters/base.ts
3
- * Copyright (c) Microsoft Corporation.
4
- * Modifications copyright (c) Forge AI Private Limited
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- import type { FullConfig, Location, TestCase, TestError, TestResult, TestStep } from "@playwright/test/reporter";
19
- export type TestResultOutput = {
20
- chunk: string | Buffer;
21
- type: "stdout" | "stderr";
22
- };
23
- export declare const kOutputSymbol: unique symbol;
24
- type ErrorDetails = {
25
- message: string;
26
- location?: Location;
27
- };
28
- export declare const isTTY: boolean, ttyWidth: number, colors: any;
29
- export declare function formatResultFailure(test: TestCase, result: TestResult, initialIndent: string, highlightCode: boolean): ErrorDetails[];
30
- export declare function relativeFilePath(config: FullConfig, file: string): string;
31
- export declare function stepSuffix(step: TestStep | undefined): string;
32
- export declare function formatError(error: TestError, highlightCode: boolean): ErrorDetails;
33
- export declare function separator(text?: string): string;
34
- export declare function prepareErrorStack(stack: string): {
35
- message: string;
36
- stackLines: string[];
37
- location?: Location;
38
- };
39
- export declare function stripAnsiEscapes(str: string): string;
40
- export {};
41
- //# sourceMappingURL=base.d.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