@empiricalrun/playwright-utils 0.38.4 → 0.38.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.
- package/CHANGELOG.md +6 -0
- package/dist/telemetry.d.ts +2 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +3 -0
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.js +19 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/telemetry.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { TelemetryEvent } from "@empiricalrun/shared-types/telemetry";
|
|
2
2
|
export declare function trackEvent(event: TelemetryEvent): Promise<void>;
|
|
3
3
|
export declare function trackOverlayDismissed(opts: {
|
|
4
|
+
original: string | undefined;
|
|
4
5
|
description: string;
|
|
6
|
+
text: string | undefined;
|
|
5
7
|
cache: boolean;
|
|
6
8
|
success: boolean;
|
|
7
9
|
testName?: string;
|
package/dist/telemetry.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,CAsBrE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C,GAAG,IAAI,CAoBP"}
|
package/dist/telemetry.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.trackEvent = trackEvent;
|
|
|
4
4
|
exports.trackOverlayDismissed = trackOverlayDismissed;
|
|
5
5
|
const TELEMETRY_WORKER_URL = "https://telemetry-worker.empirical-run.workers.dev";
|
|
6
6
|
async function trackEvent(event) {
|
|
7
|
+
console.log("----", event);
|
|
7
8
|
const apiKey = process.env.EMPIRICAL_TELEMETRY_API_KEY;
|
|
8
9
|
if (!apiKey) {
|
|
9
10
|
return;
|
|
@@ -32,6 +33,8 @@ function trackOverlayDismissed(opts) {
|
|
|
32
33
|
properties: {
|
|
33
34
|
environment,
|
|
34
35
|
overlay_description: opts.description,
|
|
36
|
+
overlay_text: opts.text ?? "",
|
|
37
|
+
original_locator: opts.original ?? "",
|
|
35
38
|
cache_hit: opts.cache,
|
|
36
39
|
success: opts.success,
|
|
37
40
|
project_name: process.env.PROJECT_NAME ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AACA,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;AAK9C,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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AACA,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;AAK9C,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;YAqDF,QAAQ;CA6BvB;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B"}
|
|
@@ -37,8 +37,14 @@ class OverlayDismissAgent {
|
|
|
37
37
|
const description = (0, utils_1.overlayDescription)(element) ?? "unknown";
|
|
38
38
|
const testName = testFn.info().title;
|
|
39
39
|
reporter(`Attempting to auto-dismiss overlay: ${description}`);
|
|
40
|
+
const text = await (0, utils_1.textContent)(this.page, element);
|
|
41
|
+
const eventProps = {
|
|
42
|
+
description,
|
|
43
|
+
text,
|
|
44
|
+
testName,
|
|
45
|
+
original: originalFailingLocator(originalError.message),
|
|
46
|
+
};
|
|
40
47
|
try {
|
|
41
|
-
const text = await (0, utils_1.textContent)(this.page, element);
|
|
42
48
|
const { success } = await (0, cache_1.executeFromCache)({
|
|
43
49
|
page: this.page,
|
|
44
50
|
dom: element?.interceptor,
|
|
@@ -46,19 +52,17 @@ class OverlayDismissAgent {
|
|
|
46
52
|
});
|
|
47
53
|
if (success) {
|
|
48
54
|
(0, telemetry_1.trackOverlayDismissed)({
|
|
49
|
-
|
|
55
|
+
...eventProps,
|
|
50
56
|
cache: true,
|
|
51
57
|
success: true,
|
|
52
|
-
testName,
|
|
53
58
|
});
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
const usage = await this.runAgent(element, text, testFn);
|
|
57
62
|
(0, telemetry_1.trackOverlayDismissed)({
|
|
58
|
-
|
|
63
|
+
...eventProps,
|
|
59
64
|
cache: false,
|
|
60
65
|
success: true,
|
|
61
|
-
testName,
|
|
62
66
|
tokens: usage.tokens,
|
|
63
67
|
cost: usage.cost,
|
|
64
68
|
});
|
|
@@ -66,10 +70,9 @@ class OverlayDismissAgent {
|
|
|
66
70
|
catch (agentError) {
|
|
67
71
|
reporter(`Error during overlay dismissal agent execution: ${agentError.toString()}`);
|
|
68
72
|
(0, telemetry_1.trackOverlayDismissed)({
|
|
69
|
-
|
|
73
|
+
...eventProps,
|
|
70
74
|
cache: false,
|
|
71
75
|
success: false,
|
|
72
|
-
testName,
|
|
73
76
|
});
|
|
74
77
|
throw originalError;
|
|
75
78
|
}
|
|
@@ -134,6 +137,15 @@ function extractInterceptingElement(errorMessage) {
|
|
|
134
137
|
};
|
|
135
138
|
}
|
|
136
139
|
}
|
|
140
|
+
function originalFailingLocator(errorMessage) {
|
|
141
|
+
try {
|
|
142
|
+
const p = removeAnsiCodes(errorMessage).split("waiting for ")[1];
|
|
143
|
+
return p?.split("\n")[0];
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
137
149
|
function removeAnsiCodes(str) {
|
|
138
150
|
const ansiRegex = new RegExp(String.raw `\u001b\[[0-9;]*m`, "g");
|
|
139
151
|
return str.replace(ansiRegex, "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"author": "Empirical Team <hey@empirical.run>",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@playwright/test": "1.
|
|
25
|
+
"@playwright/test": "1.57.0",
|
|
26
26
|
"@types/async-retry": "^1.4.8",
|
|
27
27
|
"@types/authenticator": "^1.1.4",
|
|
28
28
|
"@types/babel__code-frame": "^7.0.6",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/node": "^20.14.9",
|
|
31
31
|
"@types/serve-handler": "^6.1.4",
|
|
32
32
|
"@types/pg": "^8.11.6",
|
|
33
|
-
"playwright-core": "1.
|
|
33
|
+
"playwright-core": "1.57.0",
|
|
34
34
|
"serve-handler": "^6.1.6",
|
|
35
35
|
"@empiricalrun/shared-types": "0.12.0"
|
|
36
36
|
},
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"@empiricalrun/llm": "^0.25.2",
|
|
46
|
-
"@empiricalrun/
|
|
47
|
-
"@empiricalrun/
|
|
46
|
+
"@empiricalrun/test-gen": "^0.79.1",
|
|
47
|
+
"@empiricalrun/r2-uploader": "^0.9.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "tsc --build --watch",
|