@empiricalrun/playwright-utils 0.18.4 → 0.18.5

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 (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/test/scripts/agent-capabilities.d.ts.map +1 -1
  3. package/dist/test/scripts/pw-locator-patch/highlight/click.d.ts +1 -1
  4. package/dist/test/scripts/pw-locator-patch/highlight/click.d.ts.map +1 -1
  5. package/dist/test/scripts/pw-locator-patch/highlight/click.js +8 -0
  6. package/dist/test/scripts/pw-locator-patch/highlight/expect.d.ts +1 -1
  7. package/dist/test/scripts/pw-locator-patch/highlight/expect.d.ts.map +1 -1
  8. package/dist/test/scripts/pw-locator-patch/highlight/expect.js +5 -0
  9. package/dist/test/scripts/pw-locator-patch/highlight/hover.d.ts +1 -1
  10. package/dist/test/scripts/pw-locator-patch/highlight/hover.d.ts.map +1 -1
  11. package/dist/test/scripts/pw-locator-patch/highlight/hover.js +5 -1
  12. package/dist/test/scripts/pw-locator-patch/highlight/inner-text.d.ts +1 -1
  13. package/dist/test/scripts/pw-locator-patch/highlight/inner-text.d.ts.map +1 -1
  14. package/dist/test/scripts/pw-locator-patch/highlight/inner-text.js +7 -2
  15. package/dist/test/scripts/pw-locator-patch/highlight/input-value.d.ts +1 -1
  16. package/dist/test/scripts/pw-locator-patch/highlight/input-value.d.ts.map +1 -1
  17. package/dist/test/scripts/pw-locator-patch/highlight/input-value.js +5 -0
  18. package/dist/test/scripts/pw-locator-patch/highlight/is-checked.d.ts +1 -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 +5 -0
  21. package/dist/test/scripts/pw-locator-patch/highlight/is-disabled.d.ts +1 -1
  22. package/dist/test/scripts/pw-locator-patch/highlight/is-disabled.d.ts.map +1 -1
  23. package/dist/test/scripts/pw-locator-patch/highlight/is-disabled.js +5 -0
  24. package/dist/test/scripts/pw-locator-patch/highlight/is-editable.d.ts +1 -1
  25. package/dist/test/scripts/pw-locator-patch/highlight/is-editable.d.ts.map +1 -1
  26. package/dist/test/scripts/pw-locator-patch/highlight/is-editable.js +5 -1
  27. package/dist/test/scripts/pw-locator-patch/highlight/text-content.d.ts +1 -1
  28. package/dist/test/scripts/pw-locator-patch/highlight/text-content.d.ts.map +1 -1
  29. package/dist/test/scripts/pw-locator-patch/highlight/text-content.js +5 -0
  30. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.18.5
4
+
5
+ ### Patch Changes
6
+
7
+ - f3ee082: fix: prevent re-patching click handler
8
+
3
9
  ## 0.18.4
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"agent-capabilities.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/agent-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAK9C"}
1
+ {"version":3,"file":"agent-capabilities.d.ts","sourceRoot":"","sources":["../../../src/test/scripts/agent-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAK9C"}
@@ -1,5 +1,5 @@
1
1
  import type { Locator } from "@playwright/test";
2
- export declare function patchClick(LocatorClass: {
2
+ export declare function patchClick(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=click.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA+C9D"}
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,wBAAgB,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAuDzE"}
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchClick = void 0;
4
4
  const planner_1 = require("@empiricalrun/test-gen/agent/master/planner");
5
5
  const run_1 = require("@empiricalrun/test-gen/agent/master/run");
6
+ // Static flag to track if click has been patched
7
+ const isClickPatched = new WeakMap();
6
8
  function patchClick(LocatorClass) {
9
+ // Check if already patched
10
+ if (isClickPatched.get(LocatorClass)) {
11
+ return;
12
+ }
7
13
  const originalClick = LocatorClass.prototype.click;
8
14
  //ref: github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L255
9
15
  LocatorClass.prototype.click = async function (options) {
@@ -46,5 +52,7 @@ function patchClick(LocatorClass) {
46
52
  await originalClick.apply(this, [options]);
47
53
  }
48
54
  };
55
+ // Set flag to indicate patching is complete
56
+ isClickPatched.set(LocatorClass, true);
49
57
  }
50
58
  exports.patchClick = patchClick;
@@ -1,5 +1,5 @@
1
1
  import type { Locator } from "@playwright/test";
2
- export declare function patchExpect(LocatorClass: {
2
+ export declare function patchExpect(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=expect.d.ts.map
@@ -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;AAKhD,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;AAOhD,wBAAgB,WAAW,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAuC1E"}
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchExpect = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isExpectPatched = new WeakMap();
6
7
  function patchExpect(LocatorClass) {
8
+ if (isExpectPatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  //@ts-ignore _expect returnsPromise<{ matches: boolean, received?: any, log?: string[], timedOut?: boolean }>
8
12
  const originalExpect = LocatorClass.prototype._expect;
9
13
  // @ts-ignore _expect is a private method in playwright
@@ -33,5 +37,6 @@ function patchExpect(LocatorClass) {
33
37
  }
34
38
  return result;
35
39
  };
40
+ isExpectPatched.set(LocatorClass, true);
36
41
  }
37
42
  exports.patchExpect = patchExpect;
@@ -1,5 +1,5 @@
1
1
  import { Locator } from "@playwright/test";
2
- export declare function patchHover(LocatorClass: {
2
+ export declare function patchHover(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=hover.d.ts.map
@@ -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;AAK3C,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;AAO3C,wBAAgB,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA8BzE"}
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchHover = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isHoverPatched = new WeakMap();
6
7
  function patchHover(LocatorClass) {
8
+ if (isHoverPatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalHover = LocatorClass.prototype.hover;
8
12
  LocatorClass.prototype.hover = async function (options) {
9
- // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L243
10
13
  await originalHover.apply(this, [options]);
11
14
  try {
12
15
  await this.evaluate((node) => {
@@ -28,5 +31,6 @@ function patchHover(LocatorClass) {
28
31
  logger_1.logger.debug("Failed to add highlight for locator method: hover");
29
32
  }
30
33
  };
34
+ isHoverPatched.set(LocatorClass, true);
31
35
  }
32
36
  exports.patchHover = patchHover;
@@ -1,5 +1,5 @@
1
1
  import type { Locator } from "@playwright/test";
2
- export declare function patchInnerText(LocatorClass: {
2
+ export declare function patchInnerText(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=inner-text.d.ts.map
@@ -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;AAKhD,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;AAOhD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAiChD"}
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchInnerText = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isInnerTextPatched = new WeakMap();
6
7
  function patchInnerText(LocatorClass) {
7
- const originalInputValue = LocatorClass.prototype.innerText;
8
+ if (isInnerTextPatched.get(LocatorClass)) {
9
+ return;
10
+ }
11
+ const originalInnerText = LocatorClass.prototype.innerText;
8
12
  //ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L251
9
13
  LocatorClass.prototype.innerText = async function (options) {
10
- const result = await originalInputValue.apply(this, [options]);
14
+ const result = await originalInnerText.apply(this, [options]);
11
15
  try {
12
16
  await this.evaluate((node) => {
13
17
  if (node.scrollIntoViewIfNeeded) {
@@ -29,5 +33,6 @@ function patchInnerText(LocatorClass) {
29
33
  }
30
34
  return result;
31
35
  };
36
+ isInnerTextPatched.set(LocatorClass, true);
32
37
  }
33
38
  exports.patchInnerText = patchInnerText;
@@ -1,5 +1,5 @@
1
1
  import type { Locator } from "@playwright/test";
2
- export declare function patchInputValue(LocatorClass: {
2
+ export declare function patchInputValue(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=input-value.d.ts.map
@@ -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;AAKhD,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;AAOhD,wBAAgB,eAAe,CAC7B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAiChD"}
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchInputValue = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isInputValuePatched = new WeakMap();
6
7
  function patchInputValue(LocatorClass) {
8
+ if (isInputValuePatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalInputValue = LocatorClass.prototype.inputValue;
8
12
  //ref: github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L255
9
13
  LocatorClass.prototype.inputValue = async function (options) {
@@ -29,5 +33,6 @@ function patchInputValue(LocatorClass) {
29
33
  }
30
34
  return result;
31
35
  };
36
+ isInputValuePatched.set(LocatorClass, true);
32
37
  }
33
38
  exports.patchInputValue = patchInputValue;
@@ -1,5 +1,5 @@
1
1
  import { Locator } from "@playwright/test";
2
- export declare function patchIsChecked(LocatorClass: {
2
+ export declare function patchIsChecked(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=is-checked.d.ts.map
@@ -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;AAK3C,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;AAO3C,wBAAgB,cAAc,CAC5B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAiChD"}
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsChecked = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isCheckedPatched = new WeakMap();
6
7
  function patchIsChecked(LocatorClass) {
8
+ if (isCheckedPatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalIsChecked = LocatorClass.prototype.isChecked;
8
12
  LocatorClass.prototype.isChecked = async function (options) {
9
13
  // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L259
@@ -29,5 +33,6 @@ function patchIsChecked(LocatorClass) {
29
33
  }
30
34
  return result;
31
35
  };
36
+ isCheckedPatched.set(LocatorClass, true);
32
37
  }
33
38
  exports.patchIsChecked = patchIsChecked;
@@ -1,5 +1,5 @@
1
1
  import { Locator } from "@playwright/test";
2
- export declare function patchIsDisabled(LocatorClass: {
2
+ export declare function patchIsDisabled(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=is-disabled.d.ts.map
@@ -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;AAK3C,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;AAO3C,wBAAgB,eAAe,CAC7B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAiChD"}
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsDisabled = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isDisabledPatched = new WeakMap();
6
7
  function patchIsDisabled(LocatorClass) {
8
+ if (isDisabledPatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalIsDisabled = LocatorClass.prototype.isDisabled;
8
12
  LocatorClass.prototype.isDisabled = async function (options) {
9
13
  // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L263
@@ -29,5 +33,6 @@ function patchIsDisabled(LocatorClass) {
29
33
  }
30
34
  return result;
31
35
  };
36
+ isDisabledPatched.set(LocatorClass, true);
32
37
  }
33
38
  exports.patchIsDisabled = patchIsDisabled;
@@ -1,5 +1,5 @@
1
1
  import { Locator } from "@playwright/test";
2
- export declare function patchIsEditable(LocatorClass: {
2
+ export declare function patchIsEditable(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=is-editable.d.ts.map
@@ -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;AAK3C,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;AAO3C,wBAAgB,eAAe,CAC7B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAgChD"}
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchIsEditable = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isEditablePatched = new WeakMap();
6
7
  function patchIsEditable(LocatorClass) {
8
+ if (isEditablePatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalIsEditable = LocatorClass.prototype.isEditable;
8
12
  LocatorClass.prototype.isEditable = async function (options) {
9
- // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L267
10
13
  const result = await originalIsEditable.apply(this, [options]);
11
14
  try {
12
15
  await this.evaluate((node) => {
@@ -29,5 +32,6 @@ function patchIsEditable(LocatorClass) {
29
32
  }
30
33
  return result;
31
34
  };
35
+ isEditablePatched.set(LocatorClass, true);
32
36
  }
33
37
  exports.patchIsEditable = patchIsEditable;
@@ -1,5 +1,5 @@
1
1
  import type { Locator } from "@playwright/test";
2
- export declare function patchTextContent(LocatorClass: {
2
+ export declare function patchTextContent(LocatorClass: Function & {
3
3
  prototype: Locator;
4
4
  }): void;
5
5
  //# sourceMappingURL=text-content.d.ts.map
@@ -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;AAKhD,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;AAOhD,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAiChD"}
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchTextContent = void 0;
4
4
  const logger_1 = require("../../../../logger");
5
5
  const constants_1 = require("../../../constants");
6
+ const isTextContentPatched = new WeakMap();
6
7
  function patchTextContent(LocatorClass) {
8
+ if (isTextContentPatched.get(LocatorClass)) {
9
+ return;
10
+ }
7
11
  const originalTextContent = LocatorClass.prototype.textContent;
8
12
  //ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L318
9
13
  LocatorClass.prototype.textContent = async function (options) {
@@ -29,5 +33,6 @@ function patchTextContent(LocatorClass) {
29
33
  }
30
34
  return result;
31
35
  };
36
+ isTextContentPatched.set(LocatorClass, true);
32
37
  }
33
38
  exports.patchTextContent = patchTextContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -41,9 +41,9 @@
41
41
  "playwright-extra": "^4.3.6",
42
42
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
43
43
  "rimraf": "^6.0.1",
44
+ "@empiricalrun/r2-uploader": "^0.3.7",
44
45
  "@empiricalrun/test-gen": "^0.38.33",
45
- "@empiricalrun/llm": "^0.9.28",
46
- "@empiricalrun/r2-uploader": "^0.3.7"
46
+ "@empiricalrun/llm": "^0.9.28"
47
47
  },
48
48
  "scripts": {
49
49
  "dev": "tsc --build --watch",