fix: forward --exact flag to Playwright for role, label, and placeholder locators (#402) (#403)

Summary

- The `--exact` flag on `find role`, `find label`, and `find placeholder` was accepted by the CLI but silently dropped by the server. The Zod validation schema, TypeScript types, and action handlers all lacked the `exact` field, so it was stripped before reaching Playwright's `getByRole`, `getByLabel`, and `getByPlaceholder` calls.
- Added `exact` to the schema, types, and handler for all three locators so the flag is forwarded to Playwright as intended.
- Added tests confirming `exact: true` survives protocol parsing for `getbyrole`, `getbylabel`, and `getbyplaceholder`.

Fixes #402
This commit is contained in:
Chris Tate
2026-02-10 09:07:47 -06:00
committed by GitHub
parent 8e5ead85c8
commit cd4473aa64
4 changed files with 60 additions and 3 deletions
+3
View File
@@ -126,6 +126,7 @@ const getByRoleSchema = baseCommandSchema.extend({
action: z.literal('getbyrole'),
role: z.string().min(1),
name: z.string().optional(),
exact: z.boolean().optional(),
subaction: z.enum(['click', 'fill', 'check', 'hover']),
value: z.string().optional(),
});
@@ -140,6 +141,7 @@ const getByTextSchema = baseCommandSchema.extend({
const getByLabelSchema = baseCommandSchema.extend({
action: z.literal('getbylabel'),
label: z.string().min(1),
exact: z.boolean().optional(),
subaction: z.enum(['click', 'fill', 'check']),
value: z.string().optional(),
});
@@ -147,6 +149,7 @@ const getByLabelSchema = baseCommandSchema.extend({
const getByPlaceholderSchema = baseCommandSchema.extend({
action: z.literal('getbyplaceholder'),
placeholder: z.string().min(1),
exact: z.boolean().optional(),
subaction: z.enum(['click', 'fill']),
value: z.string().optional(),
});