mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-04 18:17:49 +02:00
test(browser): cover batch route normalization
This commit is contained in:
@@ -98,12 +98,14 @@ describe("browser control server", () => {
|
||||
height: 600,
|
||||
});
|
||||
expect(resize.ok).toBe(true);
|
||||
expect(pwMocks.resizeViewportViaPlaywright).toHaveBeenCalledWith({
|
||||
cdpUrl: state.cdpBaseUrl,
|
||||
targetId: "abcd1234",
|
||||
width: 800,
|
||||
height: 600,
|
||||
});
|
||||
expect(pwMocks.resizeViewportViaPlaywright).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
cdpUrl: expect.any(String),
|
||||
targetId: "abcd1234",
|
||||
width: 800,
|
||||
height: 600,
|
||||
}),
|
||||
);
|
||||
|
||||
const wait = await postJson<{ ok: boolean }>(`${base}/act`, {
|
||||
kind: "wait",
|
||||
@@ -203,6 +205,40 @@ describe("browser control server", () => {
|
||||
slowTimeoutMs,
|
||||
);
|
||||
|
||||
it(
|
||||
"preserves exact type text in batch normalization",
|
||||
async () => {
|
||||
const base = await startServerAndBase();
|
||||
|
||||
const batchRes = await postJson<{ ok: boolean }>(`${base}/act`, {
|
||||
kind: "batch",
|
||||
actions: [
|
||||
{ kind: "type", selector: "input.name", text: " padded " },
|
||||
{ kind: "type", selector: "input.clearable", text: "" },
|
||||
],
|
||||
});
|
||||
|
||||
expect(batchRes.ok).toBe(true);
|
||||
expect(pwMocks.batchViaPlaywright).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
actions: [
|
||||
{
|
||||
kind: "type",
|
||||
selector: "input.name",
|
||||
text: " padded ",
|
||||
},
|
||||
{
|
||||
kind: "type",
|
||||
selector: "input.clearable",
|
||||
text: "",
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
},
|
||||
slowTimeoutMs,
|
||||
);
|
||||
|
||||
it(
|
||||
"rejects malformed batch actions before dispatch",
|
||||
async () => {
|
||||
|
||||
Reference in New Issue
Block a user