@empiricalrun/playwright-utils 0.20.11 → 0.20.13

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.20.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 27ddfd8: test: add failing test for productfruits
8
+ - f524620: fix: product fruits tooltip auto dismissal
9
+ - 0359471: test: fill form to dismiss overlay
10
+
11
+ ## 0.20.12
12
+
13
+ ### Patch Changes
14
+
15
+ - bc52ebf: test: failing test for overlay
16
+ - a0dd85c: feat: email client returns links from html/text body
17
+
3
18
  ## 0.20.11
4
19
 
5
20
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,WAAW,CAAC;AAGxC,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,SAAc;gBAEV,IAAI,GAAE,kBAAuB;IAmBzC,UAAU;IAIJ,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CA6CrE"}
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,WAAW,CAAC;AAGxC,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,SAAc;gBAEV,IAAI,GAAE,kBAAuB;IAmBzC,UAAU;IAIJ,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAiDrE"}
package/dist/email.js CHANGED
@@ -46,11 +46,15 @@ class EmailClient {
46
46
  receivedAfter,
47
47
  });
48
48
  const codesAsString = (email.html?.codes || []).map((code) => code.value);
49
+ const allLinks = [
50
+ ...(email.html?.links || []),
51
+ ...(email.text?.links || []),
52
+ ];
49
53
  return {
50
54
  subject: email.subject,
51
55
  text: email.text?.body,
52
56
  html: email.html?.body,
53
- links: email.html?.links || [],
57
+ links: allLinks,
54
58
  codes: codesAsString,
55
59
  };
56
60
  }
@@ -102,14 +102,18 @@ test_1.test.beforeEach(async ({ page }) => {
102
102
  (0, test_1.expect)(firstLineThatStartsWithAt).toBeDefined();
103
103
  (0, test_1.expect)(firstLineThatStartsWithAt).toContain("overlay-tests/click.spec.ts:106");
104
104
  });
105
- (0, test_1.test)("should return from master agent planner", async ({ page }) => {
105
+ test_1.test.fail("should return from master agent planner", async ({ page }) => {
106
106
  await page.goto(`http://localhost:${PORT}/no-overlay.html`);
107
- try {
108
- // Deliberately click on a button that doesn't exist
109
- await page.getByRole("button", { name: "Login" }).click();
110
- }
111
- catch (e) {
112
- (0, test_1.expect)(e.message).toContain("locator.apply: Timeout 5000ms exceeded");
113
- (0, test_1.expect)(e.message).toContain("waiting for getByRole('button', { name: 'Login' })");
114
- }
107
+ // Deliberately click on a button that doesn't exist
108
+ await page.getByRole("button", { name: "Bottom Button" }).click();
109
+ });
110
+ (0, test_1.test)("should be able to pass through pf overlay", async ({ page }) => {
111
+ await page.goto(`http://localhost:${PORT}/productfruits.html`);
112
+ await page.locator("#sidebar-menu").getByText("Customise UI").click();
113
+ await (0, test_1.expect)(page.getByText("This is the Customise UI page")).toBeVisible();
114
+ });
115
+ test_1.test.skip("should be able to fill form and dismiss overlay", async ({ page, }) => {
116
+ await page.goto(`http://localhost:${PORT}/overlay-form.html`);
117
+ await page.getByRole("button", { name: "Target" }).click();
118
+ await (0, test_1.expect)(page.getByText("Target was clicked")).toBeVisible();
115
119
  });
@@ -1 +1 @@
1
- {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8BrC,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B;AA4FD,wBAAgB,UAAU,CACxB,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,EAC/C,MAAM,EAAE,MAAM,QA+Df"}
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/highlight/click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8BrC,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B;AAkHD,wBAAgB,UAAU,CACxB,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,EAC/C,MAAM,EAAE,MAAM,QA+Df"}
@@ -117,6 +117,10 @@ async function textContent(pageRef, element) {
117
117
  }, [startTag, endTag]);
118
118
  }
119
119
  }
120
+ function isProductFruitsOverlay(element) {
121
+ return (element?.parent?.includes("productfruits--container") ||
122
+ element?.interceptor.includes("productfruits--container"));
123
+ }
120
124
  async function runAgentOnOverlay(pageRef, element) {
121
125
  const content = await textContent(pageRef, element);
122
126
  const promptAddition = content
@@ -124,13 +128,29 @@ async function runAgentOnOverlay(pageRef, element) {
124
128
  The popup can be identified with its text content:
125
129
  ${content}`
126
130
  : ``;
127
- await (0, run_1.createTestUsingMasterAgent)({
128
- task: `
131
+ let task = isProductFruitsOverlay(element)
132
+ ? `
133
+ We are attempting to do a click action on Target element.
134
+
135
+ This action is failing because our Target element is covered with another element (called Overlapper).
136
+
137
+ The Overlapper element can be identifed with the following text content:
138
+
139
+ <overlapper_element_text_content>
140
+ ${content}
141
+ </overlapper_element_text_content>
142
+
143
+ The only way to work around this is to Click on any other sidebar link element.
144
+
145
+ Don't reattempt the click on Target element, your job is done after the first click.
146
+ `
147
+ : `
129
148
  Find a way to dismiss the popup. If the popup is non dismissible or there is no popup then return immediately.
130
149
  Also note that you just need to dismiss popup and do nothing else.
131
150
 
132
- ${promptAddition}
133
- `,
151
+ ${promptAddition}`;
152
+ await (0, run_1.createTestUsingMasterAgent)({
153
+ task,
134
154
  page: pageRef,
135
155
  options: {
136
156
  useActionSpecificAnnotations: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.20.11",
3
+ "version": "0.20.13",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -43,8 +43,8 @@
43
43
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
44
44
  "rimraf": "^6.0.1",
45
45
  "@empiricalrun/llm": "^0.9.35",
46
- "@empiricalrun/test-gen": "^0.45.0",
47
- "@empiricalrun/r2-uploader": "^0.3.8"
46
+ "@empiricalrun/r2-uploader": "^0.3.8",
47
+ "@empiricalrun/test-gen": "^0.45.0"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "tsc --build --watch",