@empiricalrun/playwright-utils 0.19.27 → 0.19.29

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,17 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.19.29
4
+
5
+ ### Patch Changes
6
+
7
+ - 541031b: feat: add filter params to waitForEmail
8
+
9
+ ## 0.19.28
10
+
11
+ ### Patch Changes
12
+
13
+ - 3dff70d: fix: add survicate specific handler for overlays
14
+
3
15
  ## 0.19.27
4
16
 
5
17
  ### Patch Changes
package/dist/email.d.ts CHANGED
@@ -10,6 +10,11 @@ export type Email = {
10
10
  links: Link[];
11
11
  codes: string[];
12
12
  };
13
+ type QueryFilter = {
14
+ from: string;
15
+ subject: string;
16
+ body: string;
17
+ };
13
18
  type EmailClientOptions = {
14
19
  timeout?: number;
15
20
  emailId?: string;
@@ -21,7 +26,7 @@ export declare class EmailClient {
21
26
  serverId: string;
22
27
  constructor(opts?: EmailClientOptions);
23
28
  getAddress(): string;
24
- waitForEmail(): Promise<Email | undefined>;
29
+ waitForEmail(filter?: QueryFilter): Promise<Email | undefined>;
25
30
  }
26
31
  export {};
27
32
  //# sourceMappingURL=email.d.ts.map
@@ -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;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CAAC,KAAK,GAAG,SAAS,CAAC;CA6CrE"}
package/dist/email.js CHANGED
@@ -23,13 +23,16 @@ class EmailClient {
23
23
  getAddress() {
24
24
  return this.address;
25
25
  }
26
- async waitForEmail() {
26
+ async waitForEmail(filter) {
27
27
  const now = new Date();
28
28
  const bufferPeriod = 5000;
29
29
  const receivedAfter = new Date(now.getTime() - bufferPeriod);
30
30
  try {
31
31
  const email = await this.client.messages.get(this.serverId, {
32
32
  sentTo: this.address,
33
+ sentFrom: filter?.from,
34
+ subject: filter?.subject,
35
+ body: filter?.body,
33
36
  }, {
34
37
  timeout: this.timeout,
35
38
  receivedAfter,
@@ -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;AA6BhD,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAC3D;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GACD,SAAS,CAiCZ;AA8CD,wBAAgB,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAmCzE"}
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,EAAQ,MAAM,kBAAkB,CAAC;AA6BtD,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAC3D;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GACD,SAAS,CAiCZ;AAmDD,wBAAgB,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAwCzE"}
@@ -106,6 +106,10 @@ function annotateForReport(description) {
106
106
  description,
107
107
  });
108
108
  }
109
+ function isSurvicateOverlay(errorMessage) {
110
+ const element = overlayElementInfo(errorMessage);
111
+ return element?.includes("survicate");
112
+ }
109
113
  function patchClick(LocatorClass) {
110
114
  // Check if already patched
111
115
  if (isClickPatched.get(LocatorClass)) {
@@ -127,7 +131,13 @@ function patchClick(LocatorClass) {
127
131
  }
128
132
  annotateForReport(`Attempting to auto-dismiss overlay ${overlayElementInfo(originalError.message)}`);
129
133
  try {
130
- await runAgentOnOverlay(this._frame._page);
134
+ if (isSurvicateOverlay(originalError.message)) {
135
+ // TODO: Survicate specific handling that bypasses the agent; this is temporary!
136
+ await this._frame._page.getByLabel("Close the survey").click();
137
+ }
138
+ else {
139
+ await runAgentOnOverlay(this._frame._page);
140
+ }
131
141
  }
132
142
  catch (agentError) {
133
143
  annotateForReport(`Error in overlay dismiss: ${agentError.toString()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.19.27",
3
+ "version": "0.19.29",
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.32",
46
- "@empiricalrun/r2-uploader": "^0.3.8",
47
- "@empiricalrun/test-gen": "^0.42.18"
46
+ "@empiricalrun/test-gen": "^0.42.18",
47
+ "@empiricalrun/r2-uploader": "^0.3.8"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "tsc --build --watch",