@empiricalrun/playwright-utils 0.23.19 → 0.24.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,20 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b84661c: feat: use computer-use for overlay dismissals and enable caching
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [ae47eed]
12
+ - Updated dependencies [beb704e]
13
+ - Updated dependencies [3d9c868]
14
+ - Updated dependencies [f283696]
15
+ - @empiricalrun/test-gen@0.51.5
16
+ - @empiricalrun/llm@0.11.4
17
+
3
18
  ## 0.23.19
4
19
 
5
20
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAYzC,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,WAKhE;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,cAAc,GAAG,SAAS,iBA+DpC;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B;AAwBD,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,aAAa,EAAE,GAAG,EAClB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAYzC,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,WAKhE;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,cAAc,GAAG,SAAS,iBA8EpC;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B;AAwBD,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,aAAa,EAAE,GAAG,EAClB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
@@ -5,7 +5,7 @@ const run_1 = require("@empiricalrun/test-gen/agent/master/run");
5
5
  const cache_1 = require("./cache");
6
6
  const utils_1 = require("./utils");
7
7
  const ERROR_SUBSTRING_INTERCEPTION = "intercepts pointer events";
8
- const PREFERRED_AGENT = "inhouse-master";
8
+ const PREFERRED_AGENT = "openai-cua";
9
9
  function isErrorSupported(errorMessage) {
10
10
  if (!errorMessage) {
11
11
  return false;
@@ -17,7 +17,7 @@ async function runAgentOnOverlay(pageRef, element) {
17
17
  const text = await (0, utils_1.textContent)(pageRef, element);
18
18
  const promptAddition = text
19
19
  ? `
20
- The popup can be identified with its text content:
20
+ In this case, the popup can be identified with its text content:
21
21
 
22
22
  <popup_text_content>
23
23
  ${text}
@@ -27,7 +27,17 @@ async function runAgentOnOverlay(pageRef, element) {
27
27
  let task = `
28
28
  Find a way to dismiss the popup. If the popup is non dismissible or there is no popup then return immediately.
29
29
  Do all actions required to dismiss the popup - don't ask for user confirmation.
30
- Also note that you just need to dismiss popup and do nothing else.
30
+
31
+ Note that you just need to dismiss popup and DO NOTHING ELSE. If you do more steps, the remainder
32
+ of the workflow will fail, because ONLY the popup is expected to be dismissed by your actions.
33
+
34
+ Examples of typical popups:
35
+ 1. Feature announcements, which can be generally dismissed by close/dismiss buttons.
36
+ 2. Product tours which might require going through the tour steps.
37
+ 3. Consents for cookies or updated terms of service, which can be dismissed by clicking on the accept/continue button.
38
+ 4. Forms that capture traffic sources or persona information. Make up content for the input fields, if that's required to dismiss the popup.
39
+ 5. Anything else that can be dismissed by taking a few user actions.
40
+
31
41
  ${promptAddition}`;
32
42
  if ((0, utils_1.isProductFruitsOverlay)(element)) {
33
43
  // Special handling for product fruits overlay: Overwrite the task
@@ -47,15 +57,16 @@ The only way to work around this is to Click on any other sidebar link element.
47
57
  Don't reattempt the click on Target element, your job is done after the first click.
48
58
  `;
49
59
  }
60
+ const { success } = await (0, cache_1.executeFromCache)({
61
+ page: pageRef,
62
+ dom: element?.interceptor,
63
+ text,
64
+ });
65
+ if (success) {
66
+ return;
67
+ }
68
+ let generatedCode;
50
69
  if (PREFERRED_AGENT === "inhouse-master") {
51
- const { success } = await (0, cache_1.executeFromCache)({
52
- page: pageRef,
53
- dom: element?.interceptor,
54
- text,
55
- });
56
- if (success) {
57
- return;
58
- }
59
70
  const result = await (0, run_1.createTestUsingMasterAgent)({
60
71
  task,
61
72
  page: pageRef,
@@ -63,17 +74,21 @@ Don't reattempt the click on Target element, your job is done after the first cl
63
74
  useActionSpecificAnnotations: true,
64
75
  },
65
76
  });
66
- await (0, cache_1.setCodeToCache)({
67
- dom: element?.interceptor,
68
- text,
69
- code: result.code,
70
- });
77
+ generatedCode = result.code;
71
78
  }
72
79
  else if (PREFERRED_AGENT === "openai-cua") {
73
- await (0, run_1.createTestUsingComputerUseAgent)({
80
+ const result = await (0, run_1.createTestUsingComputerUseAgent)({
74
81
  page: pageRef,
75
82
  task,
76
83
  });
84
+ generatedCode = result.code;
85
+ }
86
+ if (generatedCode) {
87
+ await (0, cache_1.setCodeToCache)({
88
+ dom: element?.interceptor,
89
+ text,
90
+ code: generatedCode,
91
+ });
77
92
  }
78
93
  }
79
94
  exports.runAgentOnOverlay = runAgentOnOverlay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.23.19",
3
+ "version": "0.24.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -42,9 +42,9 @@
42
42
  "mime": "3.0.0",
43
43
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
44
44
  "rimraf": "^6.0.1",
45
- "@empiricalrun/llm": "^0.11.3",
45
+ "@empiricalrun/llm": "^0.11.4",
46
46
  "@empiricalrun/r2-uploader": "^0.3.8",
47
- "@empiricalrun/test-gen": "^0.51.4"
47
+ "@empiricalrun/test-gen": "^0.51.5"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "tsc --build --watch",
@@ -7,7 +7,7 @@ export default defineConfig({
7
7
  retries: 0,
8
8
  // Test timeout needs to be large enough for master agent etc.
9
9
  // to run overlay dismissal. Action timeout can be small.
10
- timeout: 90_000,
10
+ timeout: 150_000,
11
11
  fullyParallel: true,
12
12
  workers: "50%",
13
13
  use: {