@empiricalrun/playwright-utils 0.48.2 → 0.48.4
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 +13 -0
- package/dist/overlay-tests/visual.spec.d.ts +2 -0
- package/dist/overlay-tests/visual.spec.d.ts.map +1 -0
- package/dist/overlay-tests/visual.spec.js +24 -0
- package/dist/telemetry.d.ts +5 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +21 -0
- package/dist/test/expect/types.d.ts +1 -0
- package/dist/test/expect/types.d.ts.map +1 -1
- package/dist/test/expect/visual.d.ts +2 -2
- package/dist/test/expect/visual.d.ts.map +1 -1
- package/dist/test/expect/visual.js +49 -3
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +19 -44
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.48.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 18aa8e1: chore: simplify webhook assertions
|
|
8
|
+
|
|
9
|
+
## 0.48.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d2acb85: feat: attach visual assertion screenshots to test info
|
|
14
|
+
- 46e7acd: feat: telemetry for visual assertions
|
|
15
|
+
|
|
3
16
|
## 0.48.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual.spec.d.ts","sourceRoot":"","sources":["../../src/overlay-tests/visual.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("../test");
|
|
4
|
+
const fixtures_1 = require("./fixtures");
|
|
5
|
+
const expect = (0, test_1.extendExpect)(fixtures_1.expect);
|
|
6
|
+
(0, fixtures_1.test)("toLookRight on page attaches screenshot", async ({ page, server, }, testInfo) => {
|
|
7
|
+
await page.goto(`${server.baseURL}/visual-test.html`);
|
|
8
|
+
await expect(page).toLookRight("A welcome page with a heading and a paragraph of text");
|
|
9
|
+
const pageAttachment = testInfo.attachments.find((a) => a.name.startsWith("toLookRight-"));
|
|
10
|
+
expect(pageAttachment).toBeDefined();
|
|
11
|
+
expect(pageAttachment.name).toBe("toLookRight-L11-a-welcome-page-with-a-heading-and-a-paragraph-of-text");
|
|
12
|
+
expect(pageAttachment.contentType).toBe("image/png");
|
|
13
|
+
expect(pageAttachment.body.length).toBeGreaterThan(0);
|
|
14
|
+
});
|
|
15
|
+
(0, fixtures_1.test)("toLookRight on locator attaches screenshot", async ({ page, server, }, testInfo) => {
|
|
16
|
+
await page.goto(`${server.baseURL}/visual-test.html`);
|
|
17
|
+
const heading = page.locator("h1");
|
|
18
|
+
await expect(heading).toLookRight("A heading that says Welcome to the App");
|
|
19
|
+
const locatorAttachment = testInfo.attachments.find((a) => a.name.startsWith("toLookRight-"));
|
|
20
|
+
expect(locatorAttachment).toBeDefined();
|
|
21
|
+
expect(locatorAttachment.name).toBe("toLookRight-L31-a-heading-that-says-welcome-to-the-app");
|
|
22
|
+
expect(locatorAttachment.contentType).toBe("image/png");
|
|
23
|
+
expect(locatorAttachment.body.length).toBeGreaterThan(0);
|
|
24
|
+
});
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ interface TrackReportUploadParams {
|
|
|
7
7
|
sizeBytes: number;
|
|
8
8
|
}
|
|
9
9
|
export declare function trackReportUpload(params: TrackReportUploadParams): Promise<void>;
|
|
10
|
+
export declare function trackLLMResponseGenerated(opts: {
|
|
11
|
+
modelName: string;
|
|
12
|
+
tokensInput: number;
|
|
13
|
+
tokensOutput: number;
|
|
14
|
+
}): Promise<void>;
|
|
10
15
|
export declare function trackOverlayDismissed(opts: {
|
|
11
16
|
original: string | undefined;
|
|
12
17
|
description: 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,CAqBrE;AAED,UAAU,uBAAuB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,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,UAAU,EAAE,MAAM,CAAC;IACnB,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,OAAO,CAAC,IAAI,CAAC,CAsBhB"}
|
|
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,UAAU,uBAAuB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,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,UAAU,EAAE,MAAM,CAAC;IACnB,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,OAAO,CAAC,IAAI,CAAC,CAsBhB"}
|
package/dist/telemetry.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.trackEvent = trackEvent;
|
|
4
4
|
exports.trackReportUpload = trackReportUpload;
|
|
5
|
+
exports.trackLLMResponseGenerated = trackLLMResponseGenerated;
|
|
5
6
|
exports.trackOverlayDismissed = trackOverlayDismissed;
|
|
6
7
|
const TELEMETRY_WORKER_URL = "https://telemetry-worker.empirical-run.workers.dev";
|
|
7
8
|
async function trackEvent(event) {
|
|
@@ -41,6 +42,26 @@ async function trackReportUpload(params) {
|
|
|
41
42
|
},
|
|
42
43
|
});
|
|
43
44
|
}
|
|
45
|
+
async function trackLLMResponseGenerated(opts) {
|
|
46
|
+
const environment = process.env.TEST_RUN_ENVIRONMENT || "unknown";
|
|
47
|
+
await trackEvent({
|
|
48
|
+
name: "llm_response_generated",
|
|
49
|
+
properties: {
|
|
50
|
+
environment,
|
|
51
|
+
model_name: opts.modelName,
|
|
52
|
+
chat_session_id: undefined,
|
|
53
|
+
chat_session_source: "to_look_right",
|
|
54
|
+
tokens_input: opts.tokensInput,
|
|
55
|
+
tokens_output: opts.tokensOutput,
|
|
56
|
+
cost_input: 0,
|
|
57
|
+
cost_output: 0,
|
|
58
|
+
tokens_cache_read: 0,
|
|
59
|
+
tokens_cache_creation: 0,
|
|
60
|
+
project_repo_name: process.env.GIT_REPO_NAME ?? "unknown",
|
|
61
|
+
repo_name: process.env.GIT_REPO_NAME ?? "unknown",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
44
65
|
async function trackOverlayDismissed(opts) {
|
|
45
66
|
const environment = process.env.TEST_RUN_ENVIRONMENT || "unknown";
|
|
46
67
|
await trackEvent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/test/expect/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/test/expect/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page } from "@playwright/test";
|
|
1
|
+
import type { Locator, Page } from "@playwright/test";
|
|
2
2
|
import type { MatcherResult } from "./types";
|
|
3
|
-
export declare function toLookRight(
|
|
3
|
+
export declare function toLookRight(target: Page | Locator, pageDescription: string): Promise<MatcherResult>;
|
|
4
4
|
//# sourceMappingURL=visual.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAC;AAOhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA8D7C,wBAAsB,WAAW,CAC/B,MAAM,EAAE,IAAI,GAAG,OAAO,EACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CA2FxB"}
|
|
@@ -3,7 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toLookRight = toLookRight;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const vision_1 = require("@empiricalrun/llm/vision");
|
|
6
|
+
const telemetry_1 = require("../../telemetry");
|
|
6
7
|
const mouse_pointer_1 = require("../scripts/mouse-pointer");
|
|
8
|
+
function getCallerLine() {
|
|
9
|
+
const stack = new Error().stack;
|
|
10
|
+
if (!stack)
|
|
11
|
+
return "unknown";
|
|
12
|
+
const frames = stack.split("\n").slice(1);
|
|
13
|
+
// Find the test file frame (e.g. .spec.ts, .test.ts)
|
|
14
|
+
const testFrame = frames.find((f) => /\.(spec|test)\.[jt]sx?:/.test(f));
|
|
15
|
+
if (!testFrame)
|
|
16
|
+
return "unknown";
|
|
17
|
+
const match = testFrame.match(/:(\d+):\d+\)?$/);
|
|
18
|
+
return match?.[1] ?? "unknown";
|
|
19
|
+
}
|
|
20
|
+
function attachScreenshot(screenshot, pageDescription) {
|
|
21
|
+
try {
|
|
22
|
+
// test.info() is only available during a Playwright test run
|
|
23
|
+
const { test } = require("@playwright/test");
|
|
24
|
+
const testInfo = test.info();
|
|
25
|
+
const slug = pageDescription
|
|
26
|
+
.slice(0, 60)
|
|
27
|
+
.trim()
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
30
|
+
.replace(/(^-|-$)/g, "");
|
|
31
|
+
const line = getCallerLine();
|
|
32
|
+
testInfo.attach(`toLookRight-L${line}-${slug}`, {
|
|
33
|
+
body: screenshot,
|
|
34
|
+
contentType: "image/png",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Not in a Playwright test context, skip attachment
|
|
39
|
+
}
|
|
40
|
+
}
|
|
7
41
|
const SYSTEM_PROMPT = `
|
|
8
42
|
You are a software QA tester who specializes in visual testing. You look at a
|
|
9
43
|
UI screenshot and evaluate whether the UI is rendered correctly. While you don't
|
|
@@ -27,14 +61,20 @@ issues or page loading bugs.
|
|
|
27
61
|
You are to respond to your visual evaluation with a Pass or Fail, and provide
|
|
28
62
|
a reason for your evaluation.
|
|
29
63
|
`;
|
|
30
|
-
|
|
64
|
+
function isLocator(target) {
|
|
65
|
+
return "page" in target && typeof target.page === "function";
|
|
66
|
+
}
|
|
67
|
+
async function toLookRight(target, pageDescription) {
|
|
68
|
+
const page = isLocator(target) ? target.page() : target;
|
|
31
69
|
await (0, mouse_pointer_1.removeMousePointerHighlighter)(page);
|
|
32
|
-
const screenshot = await
|
|
70
|
+
const screenshot = await target.screenshot();
|
|
71
|
+
attachScreenshot(screenshot, pageDescription);
|
|
33
72
|
const base64Image = screenshot.toString("base64");
|
|
34
73
|
await (0, mouse_pointer_1.addHighlighterScriptsToPage)(page);
|
|
74
|
+
const model = "gpt-4o";
|
|
35
75
|
const llm = new llm_1.LLM({
|
|
36
76
|
provider: "openai",
|
|
37
|
-
defaultModel:
|
|
77
|
+
defaultModel: model,
|
|
38
78
|
});
|
|
39
79
|
const response = await llm.createChatCompletion({
|
|
40
80
|
messages: [
|
|
@@ -92,6 +132,11 @@ go through the reasons and pick the one that made you choose Fail`,
|
|
|
92
132
|
},
|
|
93
133
|
],
|
|
94
134
|
});
|
|
135
|
+
(0, telemetry_1.trackLLMResponseGenerated)({
|
|
136
|
+
modelName: model,
|
|
137
|
+
tokensInput: llm.promptTokens,
|
|
138
|
+
tokensOutput: llm.completionTokens,
|
|
139
|
+
});
|
|
95
140
|
const rawResponse = response.tool_calls[0];
|
|
96
141
|
if (!("function" in rawResponse)) {
|
|
97
142
|
throw new Error("Expected a function tool call in the response, but got: " +
|
|
@@ -101,5 +146,6 @@ go through the reasons and pick the one that made you choose Fail`,
|
|
|
101
146
|
return {
|
|
102
147
|
message: () => result.most_critical_reason,
|
|
103
148
|
pass: result.result === "Pass",
|
|
149
|
+
screenshot,
|
|
104
150
|
};
|
|
105
151
|
}
|
package/dist/webhook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;AAyQhD,wBAAsB,aAAa,CACjC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAO,GACnE,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GACzB,OAAO,CAAC,cAAc,EAAE,CAAC,CAO3B"}
|
package/dist/webhook.js
CHANGED
|
@@ -141,26 +141,15 @@ function inboxRowToWebhookRequest(row) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
async function inboxGetUrl() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const result = await apiClient.request("/api/inbox/proxy", {
|
|
149
|
-
method: "POST",
|
|
150
|
-
body: { method: "POST", path: "/api/hooks/token" },
|
|
151
|
-
});
|
|
152
|
-
const tokenData = result.data;
|
|
153
|
-
return `${INBOX_WORKER_URL}/hooks/${tokenData.uuid}`;
|
|
154
|
-
}
|
|
155
|
-
const response = await fetch(`${INBOX_WORKER_URL}/api/hooks/token`, {
|
|
144
|
+
const apiClient = new dashboard_client_1.DashboardAPIClient({
|
|
145
|
+
authType: "project-api-key",
|
|
146
|
+
});
|
|
147
|
+
const result = await apiClient.request("/api/inbox/proxy", {
|
|
156
148
|
method: "POST",
|
|
149
|
+
body: { method: "POST", path: "/api/hooks/token" },
|
|
157
150
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
throw new Error(`inbox webhook error [${response.status} ${response.statusText}]: ${body}`);
|
|
161
|
-
}
|
|
162
|
-
const { uuid } = await response.json();
|
|
163
|
-
return `${INBOX_WORKER_URL}/hooks/${uuid}`;
|
|
151
|
+
const tokenData = result.data;
|
|
152
|
+
return `${INBOX_WORKER_URL}/hooks/${tokenData.uuid}`;
|
|
164
153
|
}
|
|
165
154
|
async function inboxQuery(token, content) {
|
|
166
155
|
const terms = Array.isArray(content) ? content : [content];
|
|
@@ -172,35 +161,21 @@ async function inboxQuery(token, content) {
|
|
|
172
161
|
for (const t of terms) {
|
|
173
162
|
params.append("content", t);
|
|
174
163
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
authType: "project-api-key",
|
|
178
|
-
});
|
|
179
|
-
const result = await apiClient.request("/api/inbox/proxy", {
|
|
180
|
-
method: "POST",
|
|
181
|
-
body: {
|
|
182
|
-
method: "GET",
|
|
183
|
-
path: `/api/hooks?${params.toString()}`,
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
const response = result.data;
|
|
187
|
-
if (!response || !Array.isArray(response.data)) {
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
190
|
-
return response.data.map(inboxRowToWebhookRequest);
|
|
191
|
-
}
|
|
192
|
-
const rawResponse = await fetch(`${INBOX_WORKER_URL}/api/hooks?${params.toString()}`);
|
|
193
|
-
if (!rawResponse.ok) {
|
|
194
|
-
const body = await rawResponse.text().catch(() => "");
|
|
195
|
-
throw new Error(`inbox webhook error [${rawResponse.status} ${rawResponse.statusText}]: ${body}`);
|
|
196
|
-
}
|
|
197
|
-
const json = await rawResponse.json().catch((e) => {
|
|
198
|
-
throw new Error(`inbox webhook returned invalid JSON: ${String(e)}`);
|
|
164
|
+
const apiClient = new dashboard_client_1.DashboardAPIClient({
|
|
165
|
+
authType: "project-api-key",
|
|
199
166
|
});
|
|
200
|
-
|
|
167
|
+
const result = await apiClient.request("/api/inbox/proxy", {
|
|
168
|
+
method: "POST",
|
|
169
|
+
body: {
|
|
170
|
+
method: "GET",
|
|
171
|
+
path: `/api/hooks?${params.toString()}`,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
const response = result.data;
|
|
175
|
+
if (!response || !Array.isArray(response.data)) {
|
|
201
176
|
return [];
|
|
202
177
|
}
|
|
203
|
-
return
|
|
178
|
+
return response.data.map(inboxRowToWebhookRequest);
|
|
204
179
|
}
|
|
205
180
|
// ── public API ──
|
|
206
181
|
function extractToken(webhookUrl) {
|
package/package.json
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/email.ts","./src/inbox-client.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/types.ts","./src/webhook.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/config/index.ts","./src/config/proxy.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/attachment-cleanup-test-reporter.ts","./src/reporter/attachment-cleanup.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/failing-line.ts","./src/reporter/harness.ts","./src/reporter/ibr-utils.ts","./src/reporter/incremental-blob-reporter.ts","./src/reporter/lifecycle-events.ts","./src/reporter/local-test.ts","./src/reporter/reporter-state.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/coverage.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/expect/index.ts","./src/test/expect/types.ts","./src/test/expect/visual.ts","./src/test/expect/webhook.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/inbox-client.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/types.ts","./src/webhook.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/config/index.ts","./src/config/proxy.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/overlay-tests/visual.spec.ts","./src/reporter/attachment-cleanup-test-reporter.ts","./src/reporter/attachment-cleanup.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/failing-line.ts","./src/reporter/harness.ts","./src/reporter/ibr-utils.ts","./src/reporter/incremental-blob-reporter.ts","./src/reporter/lifecycle-events.ts","./src/reporter/local-test.ts","./src/reporter/reporter-state.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/coverage.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/expect/index.ts","./src/test/expect/types.ts","./src/test/expect/visual.ts","./src/test/expect/webhook.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"}
|