@empiricalrun/playwright-utils 0.38.0 → 0.38.2

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,18 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.38.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1ce3166: chore: track usage of overlay dismissal agent
8
+
9
+ ## 0.38.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [0dfc150]
14
+ - @empiricalrun/test-gen@0.79.0
15
+
3
16
  ## 0.38.0
4
17
 
5
18
  ### Minor Changes
@@ -0,0 +1,8 @@
1
+ import { TelemetryEvent } from "@empiricalrun/shared-types/telemetry";
2
+ export declare function trackEvent(event: TelemetryEvent): Promise<void>;
3
+ export declare function trackOverlayDismissed(opts: {
4
+ overlayDescription: string;
5
+ cacheHit: boolean;
6
+ success: boolean;
7
+ }): void;
8
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAKtE,wBAAsB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,IAAI,CAaP"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trackEvent = trackEvent;
4
+ exports.trackOverlayDismissed = trackOverlayDismissed;
5
+ const TELEMETRY_WORKER_URL = "https://telemetry-worker.empirical-run.workers.dev";
6
+ async function trackEvent(event) {
7
+ const apiKey = process.env.EMPIRICAL_TELEMETRY_API_KEY;
8
+ if (!apiKey) {
9
+ return;
10
+ }
11
+ try {
12
+ const response = await fetch(`${TELEMETRY_WORKER_URL}/track`, {
13
+ method: "POST",
14
+ headers: {
15
+ "Content-Type": "application/json",
16
+ Authorization: `Bearer ${apiKey}`,
17
+ },
18
+ body: JSON.stringify(event),
19
+ });
20
+ if (!response.ok) {
21
+ throw new Error(`Telemetry request failed: ${response.status}`);
22
+ }
23
+ }
24
+ catch {
25
+ // Don't throw - telemetry failures shouldn't break the application
26
+ }
27
+ }
28
+ function trackOverlayDismissed(opts) {
29
+ const environment = process.env.TEST_RUN_ENVIRONMENT || "unknown";
30
+ void trackEvent({
31
+ name: "overlay.dismissed",
32
+ properties: {
33
+ environment,
34
+ overlay_description: opts.overlayDescription,
35
+ cache_hit: opts.cacheHit,
36
+ success: opts.success,
37
+ project_name: process.env.PROJECT_NAME ?? "",
38
+ test_run_id: process.env.TEST_RUN_GITHUB_ACTION_ID ?? "",
39
+ },
40
+ });
41
+ }
@@ -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;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAO9C,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,WAKhE;AAED,qBAAa,mBAAmB;IAOlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IANjC,OAAO,CAAC,iBAAiB,CAIhB;gBAEoB,IAAI,EAAE,IAAI;IAEjC,WAAW;IAMX,GAAG,CACP,aAAa,EAAE,GAAG,EAClB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EACvC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;YA4BF,QAAQ;CAwCvB;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B"}
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;AAGxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAO9C,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,WAKhE;AAED,qBAAa,mBAAmB;IAOlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IANjC,OAAO,CAAC,iBAAiB,CAIhB;gBAEoB,IAAI,EAAE,IAAI;IAEjC,WAAW;IAMX,GAAG,CACP,aAAa,EAAE,GAAG,EAClB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EACvC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;YA2CF,QAAQ;CAwCvB;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B"}
@@ -4,6 +4,7 @@ exports.OverlayDismissAgent = void 0;
4
4
  exports.isErrorSupported = isErrorSupported;
5
5
  exports.extractInterceptingElement = extractInterceptingElement;
6
6
  const run_1 = require("@empiricalrun/test-gen/agent/master/run");
7
+ const telemetry_1 = require("../../../../telemetry");
7
8
  const cache_1 = require("./cache");
8
9
  const prompt_1 = require("./prompt");
9
10
  const utils_1 = require("./utils");
@@ -34,7 +35,7 @@ class OverlayDismissAgent {
34
35
  catch {
35
36
  // Ignoring this error
36
37
  }
37
- const description = (0, utils_1.overlayDescription)(element);
38
+ const description = (0, utils_1.overlayDescription)(element) ?? "unknown";
38
39
  reporter(`Attempting to auto-dismiss overlay: ${description}`);
39
40
  try {
40
41
  const text = await (0, utils_1.textContent)(this.page, element);
@@ -44,12 +45,27 @@ class OverlayDismissAgent {
44
45
  text,
45
46
  });
46
47
  if (success) {
48
+ (0, telemetry_1.trackOverlayDismissed)({
49
+ overlayDescription: description,
50
+ cacheHit: true,
51
+ success: true,
52
+ });
47
53
  return;
48
54
  }
49
55
  await this.runAgent(element, text, testFn);
56
+ (0, telemetry_1.trackOverlayDismissed)({
57
+ overlayDescription: description,
58
+ cacheHit: false,
59
+ success: true,
60
+ });
50
61
  }
51
62
  catch (agentError) {
52
63
  reporter(`Error during overlay dismissal agent execution: ${agentError.toString()}`);
64
+ (0, telemetry_1.trackOverlayDismissed)({
65
+ overlayDescription: description,
66
+ cacheHit: false,
67
+ success: false,
68
+ });
53
69
  throw originalError;
54
70
  }
55
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.38.0",
3
+ "version": "0.38.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -44,7 +44,7 @@
44
44
  "rimraf": "^6.0.1",
45
45
  "@empiricalrun/llm": "^0.25.1",
46
46
  "@empiricalrun/r2-uploader": "^0.9.0",
47
- "@empiricalrun/test-gen": "^0.78.7"
47
+ "@empiricalrun/test-gen": "^0.79.0"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "tsc --build --watch",
@@ -1 +1 @@
1
- {"root":["./src/email.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/postgres.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/expect.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
1
+ {"root":["./src/email.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/postgres.ts","./src/telemetry.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/expect.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}