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:
@@ -364,6 +364,23 @@ describe('parseCommand', () => {
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should parse getbyrole with exact', () => {
|
||||
const result = parseCommand(
|
||||
cmd({
|
||||
id: '1',
|
||||
action: 'getbyrole',
|
||||
role: 'button',
|
||||
name: 'Continue',
|
||||
subaction: 'click',
|
||||
exact: true,
|
||||
})
|
||||
);
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.command.exact).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('should parse getbytext', () => {
|
||||
const result = parseCommand(
|
||||
cmd({
|
||||
@@ -388,6 +405,40 @@ describe('parseCommand', () => {
|
||||
);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should parse getbylabel with exact', () => {
|
||||
const result = parseCommand(
|
||||
cmd({
|
||||
id: '1',
|
||||
action: 'getbylabel',
|
||||
label: 'Email',
|
||||
subaction: 'fill',
|
||||
value: 'test@test.com',
|
||||
exact: true,
|
||||
})
|
||||
);
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.command.exact).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('should parse getbyplaceholder with exact', () => {
|
||||
const result = parseCommand(
|
||||
cmd({
|
||||
id: '1',
|
||||
action: 'getbyplaceholder',
|
||||
placeholder: 'Search',
|
||||
subaction: 'fill',
|
||||
value: 'test',
|
||||
exact: true,
|
||||
})
|
||||
);
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.command.exact).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('tabs', () => {
|
||||
|
||||
Reference in New Issue
Block a user