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:
@@ -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(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user