fix: improve browser upload triggering

This commit is contained in:
Peter Steinberger
2026-01-01 09:35:20 +00:00
parent fbcbc60e85
commit bf0bee58b3
9 changed files with 50 additions and 0 deletions

View File

@@ -475,6 +475,24 @@ describe("browser control server", () => {
timeoutMs: 1234,
});
const uploadWithRef = await realFetch(`${base}/hooks/file-chooser`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ paths: ["/tmp/b.txt"], ref: "e12" }),
}).then((r) => r.json());
expect(uploadWithRef).toMatchObject({ ok: true });
expect(pwMocks.armFileUploadViaPlaywright).toHaveBeenCalledWith({
cdpPort: testPort + 1,
targetId: "abcd1234",
paths: ["/tmp/b.txt"],
timeoutMs: undefined,
});
expect(pwMocks.clickViaPlaywright).toHaveBeenCalledWith({
cdpPort: testPort + 1,
targetId: "abcd1234",
ref: "e12",
});
const dialog = await realFetch(`${base}/hooks/dialog`, {
method: "POST",
headers: { "Content-Type": "application/json" },