@empiricalrun/playwright-utils 0.14.13 → 0.14.15

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 (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/logger.d.ts +3 -0
  3. package/dist/logger.d.ts.map +1 -0
  4. package/dist/logger.js +11 -0
  5. package/dist/reporter/custom.d.ts.map +1 -1
  6. package/dist/reporter/custom.js +33 -27
  7. package/dist/test/scripts/index.d.ts.map +1 -1
  8. package/dist/test/scripts/index.js +2 -1
  9. package/dist/test/scripts/mouse-pointer.d.ts.map +1 -1
  10. package/dist/test/scripts/mouse-pointer.js +2 -1
  11. package/dist/test/scripts/pw-locator-patch/highlight/expect.d.ts.map +1 -1
  12. package/dist/test/scripts/pw-locator-patch/highlight/expect.js +2 -1
  13. package/dist/test/scripts/pw-locator-patch/highlight/hover.d.ts.map +1 -1
  14. package/dist/test/scripts/pw-locator-patch/highlight/hover.js +2 -1
  15. package/dist/test/scripts/pw-locator-patch/highlight/inner-text.d.ts.map +1 -1
  16. package/dist/test/scripts/pw-locator-patch/highlight/inner-text.js +2 -1
  17. package/dist/test/scripts/pw-locator-patch/highlight/input-value.d.ts.map +1 -1
  18. package/dist/test/scripts/pw-locator-patch/highlight/input-value.js +2 -1
  19. package/dist/test/scripts/pw-locator-patch/highlight/is-checked.d.ts.map +1 -1
  20. package/dist/test/scripts/pw-locator-patch/highlight/is-checked.js +2 -1
  21. package/dist/test/scripts/pw-locator-patch/highlight/is-disabled.d.ts.map +1 -1
  22. package/dist/test/scripts/pw-locator-patch/highlight/is-disabled.js +2 -1
  23. package/dist/test/scripts/pw-locator-patch/highlight/is-editable.d.ts.map +1 -1
  24. package/dist/test/scripts/pw-locator-patch/highlight/is-editable.js +2 -1
  25. package/dist/test/scripts/pw-locator-patch/highlight/text-content.d.ts.map +1 -1
  26. package/dist/test/scripts/pw-locator-patch/highlight/text-content.js +2 -1
  27. package/package.json +6 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.14.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 193e986: fix: handle missing trace error
8
+
9
+ ## 0.14.14
10
+
11
+ ### Patch Changes
12
+
13
+ - a1e8599: chore: add logger for playwright utils
14
+ - Updated dependencies [a1e8599]
15
+ - @empiricalrun/r2-uploader@0.3.6
16
+
3
17
  ## 0.14.13
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import Logger from "console-log-level";
2
+ export declare const logger: Logger.Logger;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,MAAyB,MAAM,mBAAmB,CAAC;AAE1D,eAAO,MAAM,MAAM,eAGjB,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = void 0;
7
+ const console_log_level_1 = __importDefault(require("console-log-level"));
8
+ exports.logger = (0, console_log_level_1.default)({
9
+ prefix: "playwright-utils",
10
+ level: process.env.LOG_LEVEL || "info",
11
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/reporter/custom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAEV,KAAK,EACL,QAAQ,IAAI,cAAc,EAC1B,SAAS,EACT,UAAU,IAAI,gBAAgB,EAE/B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAML,UAAU,EAMX,MAAM,2BAA2B,CAAC;AAgBnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc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O;IASxD,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIzB,KAAK,CAAC,MAAM,EAAE,UAAU;IAoIxB,MAAM;CA8Bb;AAkCD,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,GAAE,MAAoB,EAC1B,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,iBAqBhB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsBhE;AAqiBD,eAAe,YAAY,CAAC"}
@@ -31,6 +31,7 @@ const utilsBundle_1 = require("playwright-core/lib/utilsBundle");
31
31
  // @ts-ignore
32
32
  const zipBundle_1 = require("playwright-core/lib/zipBundle");
33
33
  const stream_1 = require("stream");
34
+ const logger_1 = require("../logger");
34
35
  const base_1 = require("./base");
35
36
  const util_1 = require("./util");
36
37
  const htmlReportOptions = ["always", "never", "on-failure"];
@@ -82,7 +83,7 @@ class HtmlReporter {
82
83
  if (task) {
83
84
  const promise = task()
84
85
  .catch((e) => {
85
- console.error("Error in processing task", e);
86
+ logger_1.logger.error("Error in processing task", e);
86
87
  })
87
88
  .finally(() => {
88
89
  // console.log("Finished upload execution from waiting queue"); // we already log in the upload function on successful upload
@@ -95,7 +96,7 @@ class HtmlReporter {
95
96
  }
96
97
  }
97
98
  catch (e) {
98
- console.error("Error while processing queue", e);
99
+ logger_1.logger.error("Error while processing queue", e);
99
100
  }
100
101
  }
101
102
  async waitForAllTasksToFinish() {
@@ -147,7 +148,7 @@ class HtmlReporter {
147
148
  if (this.uploadExecutionQueue.length <= this.uploadMaxQueueSize) {
148
149
  const promise = uploadTask()
149
150
  .catch((e) => {
150
- console.error("Upload failed for", attachment.path, e);
151
+ logger_1.logger.error("Upload failed for", attachment.path, e);
151
152
  // this.retryTask(uploadTask); // Retry logic
152
153
  })
153
154
  .finally(() => {
@@ -159,18 +160,18 @@ class HtmlReporter {
159
160
  this.uploadExecutionQueue.push(promise);
160
161
  }
161
162
  else {
162
- console.log("Queuing upload task ", attachment.path);
163
+ logger_1.logger.debug("Queuing upload task ", attachment.path);
163
164
  this.uploadWaitingQueue.push(uploadTask);
164
165
  }
165
166
  }
166
167
  catch (e) {
167
- console.log("Error while uploading attachment", e);
168
+ logger_1.logger.error("Error while uploading attachment", e);
168
169
  // tests shouldn't stop no matter whatever error we get
169
170
  }
170
171
  });
171
172
  }
172
173
  catch (e) {
173
- console.error("Error while processing attachments for test", e);
174
+ logger_1.logger.error("Error while processing attachments for test", e);
174
175
  }
175
176
  }
176
177
  onConfigure(config) {
@@ -211,7 +212,7 @@ class HtmlReporter {
211
212
  this._topLevelErrors.push(error);
212
213
  }
213
214
  async onEnd(result) {
214
- console.log(`Tests ended in ${(result.duration / (1000 * 60)).toFixed(2)} mins`);
215
+ console.info(`Tests ended in ${(result.duration / (1000 * 60)).toFixed(2)} mins`);
215
216
  const projectSuites = this.suite.suites;
216
217
  // Commenting out this line causes the outputs to not get deleted
217
218
  // await removeFolders([this._outputFolder]);
@@ -222,16 +223,19 @@ class HtmlReporter {
222
223
  // Skipping uploads since PROJECT_NAME or TEST_RUN_GITHUB_ACTION_ID is not set,
223
224
  return;
224
225
  }
225
- console.log("Starting final report upload at: ", new Intl.DateTimeFormat("en-US", {
226
+ logger_1.logger.info("Starting final report upload at: ", new Intl.DateTimeFormat("en-US", {
226
227
  hour: "2-digit",
227
228
  minute: "2-digit",
228
229
  second: "2-digit",
229
230
  }).format(startTime));
230
231
  try {
231
- console.log("uploading path", this._outputFolder);
232
- console.log(listFilesRecursively(this._outputFolder));
232
+ logger_1.logger.debug("uploading path", this._outputFolder);
233
+ logger_1.logger.debug("file list", listFilesRecursively(this._outputFolder));
234
+ const tracePath = this._outputFolder + "/trace";
235
+ const traceExists = fs_1.default.existsSync(tracePath);
236
+ logger_1.logger.debug("trace exists:", traceExists);
233
237
  const uploadTraceTask = async () => {
234
- console.log("Uploading playwright trace");
238
+ logger_1.logger.debug("Uploading playwright trace");
235
239
  return (0, r2_uploader_1.uploadDirectory)({
236
240
  sourceDir: this._outputFolder + "/trace",
237
241
  destinationDir: process.env.PROJECT_NAME +
@@ -241,13 +245,13 @@ class HtmlReporter {
241
245
  uploadBucket: "test-report",
242
246
  })
243
247
  .then((fileMap) => {
244
- console.log("Finished uploading playwright trace", fileMap);
248
+ logger_1.logger.debug("Finished uploading playwright trace", fileMap);
245
249
  })
246
- .catch((e) => console.error("Error uploading playwrighttrace", e));
250
+ .catch((e) => logger_1.logger.error("Error uploading playwright trace", e));
247
251
  };
248
252
  // upload index.html
249
253
  const uploadIndexTask = async () => {
250
- console.log("Uploading html report");
254
+ logger_1.logger.debug("Uploading html report");
251
255
  return (0, r2_uploader_1.uploadDirectory)({
252
256
  sourceDir: this._outputFolder,
253
257
  fileList: [path_1.default.join(this._outputFolder, "index.html")],
@@ -257,13 +261,13 @@ class HtmlReporter {
257
261
  uploadBucket: "test-report",
258
262
  })
259
263
  .then((fileMap) => {
260
- console.log("Finished uploading html report", fileMap);
264
+ logger_1.logger.debug("Finished uploading html report", fileMap);
261
265
  })
262
- .catch((e) => console.error("Error uploading html report", e));
266
+ .catch((e) => logger_1.logger.error("Error uploading html report", e));
263
267
  };
264
268
  // upload summary.json
265
269
  const uploadSummaryTask = async () => {
266
- console.log("Uploading json report");
270
+ logger_1.logger.debug("Uploading json report");
267
271
  return (0, r2_uploader_1.uploadDirectory)({
268
272
  sourceDir: this._outputFolder,
269
273
  fileList: [path_1.default.join(this._outputFolder, "summary.json")],
@@ -273,34 +277,36 @@ class HtmlReporter {
273
277
  uploadBucket: "test-report",
274
278
  })
275
279
  .then((fileMap) => {
276
- console.log("Finished uploading json report", fileMap);
280
+ logger_1.logger.debug("Finished uploading json report", fileMap);
277
281
  })
278
- .catch((e) => console.error("Error uploading json report", e));
282
+ .catch((e) => logger_1.logger.error("Error uploading json report", e));
279
283
  };
280
- console.log("Uploading waiting queue", this.uploadWaitingQueue.length);
281
- console.log("Uploading execution queue", this.uploadExecutionQueue.length);
284
+ logger_1.logger.debug("Uploading waiting queue", this.uploadWaitingQueue.length);
285
+ logger_1.logger.debug("Uploading execution queue", this.uploadExecutionQueue.length);
282
286
  const processQueue = !this.uploadExecutionQueue.length;
283
- this.uploadWaitingQueue.push(uploadTraceTask);
287
+ if (traceExists) {
288
+ this.uploadWaitingQueue.push(uploadTraceTask);
289
+ }
284
290
  this.uploadWaitingQueue.push(uploadIndexTask);
285
291
  this.uploadWaitingQueue.push(uploadSummaryTask);
286
292
  if (processQueue) {
287
293
  this.processQueue();
288
294
  }
289
- console.log("Waiting for all uploads to finish");
295
+ logger_1.logger.info("Waiting for all uploads to finish");
290
296
  await this.waitForAllTasksToFinish();
291
- console.log("All uploads finished");
297
+ logger_1.logger.info("All uploads finished");
292
298
  const endTime = new Date().getTime();
293
- console.log("Finished final report upload at: ", new Intl.DateTimeFormat("en-US", {
299
+ logger_1.logger.info("Finished final report upload at: ", new Intl.DateTimeFormat("en-US", {
294
300
  hour: "2-digit",
295
301
  minute: "2-digit",
296
302
  second: "2-digit",
297
303
  }).format(endTime));
298
304
  // time difference
299
305
  const timeDiff = endTime - startTime;
300
- console.log("Time taken to upload after tests ended: ", timeDiff, "ms");
306
+ logger_1.logger.info("Time taken to upload after tests ended: ", timeDiff, "ms");
301
307
  }
302
308
  catch (e) {
303
- console.error("Error in uploading final report ", e);
309
+ logger_1.logger.error("Error in uploading final report ", e);
304
310
  }
305
311
  }
306
312
  async onExit() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAK3C,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,eAIR,QAoBF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAK3C,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,eAIR,QAoBF"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.injectLocatorHighlightScripts = void 0;
4
+ const logger_1 = require("../../logger");
4
5
  const locator_highlights_1 = require("./locator-highlights");
5
6
  const locator_vision_1 = require("./locator-vision");
6
7
  const mouse_pointer_1 = require("./mouse-pointer");
@@ -26,7 +27,7 @@ function injectLocatorHighlightScripts(page, options = {
26
27
  }
27
28
  }
28
29
  catch (e) {
29
- console.error("Failed to add mouse pointer highlighter", e);
30
+ logger_1.logger.debug("Failed to add mouse pointer highlighter", e);
30
31
  }
31
32
  }
32
33
  exports.injectLocatorHighlightScripts = injectLocatorHighlightScripts;
@@ -1 +1 @@
1
- {"version":3,"file":"mouse-pointer.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/mouse-pointer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,QAoGpD"}
1
+ {"version":3,"file":"mouse-pointer.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/mouse-pointer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,QAoGpD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addMousePointerHighlighter = void 0;
4
+ const logger_1 = require("../../logger");
4
5
  function addMousePointerHighlighter(page) {
5
6
  page.on("load", async () => {
6
7
  try {
@@ -78,7 +79,7 @@ function addMousePointerHighlighter(page) {
78
79
  });
79
80
  }
80
81
  catch (e) {
81
- console.log(`Error adding mouse pointer highlighter`, e);
82
+ logger_1.logger.debug(`Error adding mouse pointer highlighter`, e);
82
83
  }
83
84
  });
84
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,WAAW,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAmC/D"}
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,wBAAgB,WAAW,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAmC/D"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchExpect = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchExpect(LocatorClass) {
6
7
  //@ts-ignore _expect returnsPromise<{ matches: boolean, received?: any, log?: string[], timedOut?: boolean }>
@@ -27,7 +28,7 @@ function patchExpect(LocatorClass) {
27
28
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
28
29
  }
29
30
  catch (e) {
30
- console.warn("Failed to add highlight for locator method: _expect");
31
+ logger_1.logger.debug("Failed to add highlight for locator method: _expect");
31
32
  }
32
33
  }
33
34
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,UAAU,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA2B9D"}
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,wBAAgB,UAAU,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA2B9D"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchHover = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchHover(LocatorClass) {
6
7
  const originalHover = LocatorClass.prototype.hover;
@@ -24,7 +25,7 @@ function patchHover(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: hover");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: hover");
28
29
  }
29
30
  };
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inner-text.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/inner-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
1
+ {"version":3,"file":"inner-text.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/inner-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchInnerText = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchInnerText(LocatorClass) {
6
7
  const originalInputValue = LocatorClass.prototype.innerText;
@@ -24,7 +25,7 @@ function patchInnerText(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: innerText");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: innerText");
28
29
  }
29
30
  return result;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"input-value.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/input-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
1
+ {"version":3,"file":"input-value.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/input-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchInputValue = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchInputValue(LocatorClass) {
6
7
  const originalInputValue = LocatorClass.prototype.inputValue;
@@ -24,7 +25,7 @@ function patchInputValue(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: inputValue");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: inputValue");
28
29
  }
29
30
  return result;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-checked.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-checked.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
1
+ {"version":3,"file":"is-checked.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-checked.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsChecked = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchIsChecked(LocatorClass) {
6
7
  const originalIsChecked = LocatorClass.prototype.isChecked;
@@ -24,7 +25,7 @@ function patchIsChecked(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: isChecked");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: isChecked");
28
29
  }
29
30
  return result;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-disabled.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
1
+ {"version":3,"file":"is-disabled.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsDisabled = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchIsDisabled(LocatorClass) {
6
7
  const originalIsDisabled = LocatorClass.prototype.isDisabled;
@@ -24,7 +25,7 @@ function patchIsDisabled(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: isDisabled");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: isDisabled");
28
29
  }
29
30
  return result;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-editable.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-editable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
1
+ {"version":3,"file":"is-editable.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/is-editable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsEditable = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchIsEditable(LocatorClass) {
6
7
  const originalIsEditable = LocatorClass.prototype.isEditable;
@@ -24,7 +25,7 @@ function patchIsEditable(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: isEditable");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: isEditable");
28
29
  }
29
30
  return result;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"text-content.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/text-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BpE"}
1
+ {"version":3,"file":"text-content.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/text-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BpE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchTextContent = void 0;
4
+ const logger_1 = require("../../../../logger");
4
5
  const constants_1 = require("../../../constants");
5
6
  function patchTextContent(LocatorClass) {
6
7
  const originalTextContent = LocatorClass.prototype.textContent;
@@ -24,7 +25,7 @@ function patchTextContent(LocatorClass) {
24
25
  }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
26
  }
26
27
  catch (e) {
27
- console.warn("Failed to add highlight for locator method: textContent");
28
+ logger_1.logger.debug("Failed to add highlight for locator method: textContent");
28
29
  }
29
30
  return result;
30
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.14.13",
3
+ "version": "0.14.15",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -23,15 +23,17 @@
23
23
  "author": "Empirical Team <hey@empirical.run>",
24
24
  "devDependencies": {
25
25
  "@playwright/test": "1.47.1",
26
- "@types/node": "^20.14.9",
27
26
  "@types/babel__code-frame": "^7.0.6",
27
+ "@types/console-log-level": "^1.4.5",
28
28
  "@types/md5": "^2.3.5",
29
- "@types/mime": "3.0.0"
29
+ "@types/mime": "3.0.0",
30
+ "@types/node": "^20.14.9"
30
31
  },
31
32
  "dependencies": {
32
33
  "@aws-sdk/client-s3": "^3.614.0",
33
34
  "@aws-sdk/s3-request-presigner": "^3.614.0",
34
35
  "@babel/code-frame": "^7.24.7",
36
+ "console-log-level": "^1.4.1",
35
37
  "mailosaur": "^8.6.1",
36
38
  "md5": "^2.3.0",
37
39
  "mime": "3.0.0",
@@ -39,7 +41,7 @@
39
41
  "playwright-extra": "^4.3.6",
40
42
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
41
43
  "@empiricalrun/llm": "^0.9.9",
42
- "@empiricalrun/r2-uploader": "^0.3.5"
44
+ "@empiricalrun/r2-uploader": "^0.3.6"
43
45
  },
44
46
  "scripts": {
45
47
  "dev": "tsc --build --watch",