Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/tool-server/src/tools/screenshot-diff/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ const zodSchema = z
.describe(
"Target device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial)."
),
captureBaseline: z.coerce
captureBaseline: z
.boolean()
.optional()
.describe(
"Capture the baseline screenshot live at full resolution before diffing. Cannot be combined with captureCurrent."
),
captureCurrent: z.coerce
captureCurrent: z
.boolean()
.optional()
.describe(
Expand Down
11 changes: 11 additions & 0 deletions packages/tool-server/test/screenshot-diff-tool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ describe("screenshotDiffTool", () => {
expect(result.success).toBe(false);
});

it.each(["captureBaseline", "captureCurrent"])("rejects a string %s", (flag) => {
const result = screenshotDiffTool.zodSchema!.safeParse({
baselinePath: "/tmp/baseline.png",
currentPath: "/tmp/current.png",
udid: "ABC",
[flag]: "false",
});

expect(result.error?.issues).toMatchObject([{ code: "invalid_type", path: [flag] }]);
});

it("requires udid and only declares the simulator-server service for live captures", () => {
expect(
screenshotDiffTool.zodSchema!.safeParse({
Expand Down
Loading