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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2026-06-06

### Changes
- [Tester] Checkboxes and other toggle controls (switches, selectable rows/items) are no longer flipped back off by accident. The Tester now sets a checkbox with the idempotent `I.checkOption` / `I.uncheckOption` commands instead of `I.click`, so selecting an already-selected checkbox keeps it selected. It also reads the page state after each click and stops re-clicking a control once it already shows the wanted result (checked, selected, or a count/label confirming success). Previously a second click on a selected checkbox could toggle it off — for example dropping a "Select 32 tests" selection back to "Select 0 tests" and saving an empty result.
- [Tester] Before filling a form that saves data (create/update), the Tester now reads each field's requirements — required, type/format, length, and placeholder/hint text — and enters values that satisfy them, instead of submitting and discovering validation errors. Search, filter, and sort forms that only change the view are skipped.

## 2026-06-04

### Changes
Expand Down
21 changes: 21 additions & 0 deletions src/ai/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ export const fileUploadRule = dedent`
</file_upload>
`;

export const formRequirementsRule = dedent`
<form_requirements>
Before filling a form that persists data (create/update), read each control's requirements (required, type/format, length, placeholder/aria-describedby hints) from <page_aria> and page HTML — call context() if not visible — and enter values that satisfy them. Search/filter/sort forms that only change the view do not need this.
</form_requirements>
`;

// in rage mode we do not protect from irreversible actions
export const protectionRule = dedent`
<important>
Expand Down Expand Up @@ -270,6 +276,8 @@ export const actionRule = dedent`
If locator doesn't work, try CSS or XPath locators.
If nothing works, use I.clickXY(x, y) as last resort.

For checkboxes, prefer I.checkOption/I.uncheckOption over I.click.


### I.fillField

Expand Down Expand Up @@ -356,6 +364,19 @@ export const actionRule = dedent`
I.selectOption('form select[name=account]', 'Premium');
</example>

### I.checkOption / I.uncheckOption

Set a checkbox/radio to a definite state — idempotent, never toggles. Use for checkboxes instead of I.click. Run via form(), not click().

I.checkOption(<locator>, <context>)
I.uncheckOption(<locator>, <context>)

<example>
I.checkOption('Subscribe');
I.checkOption({ role: 'checkbox', text: 'Agree' });
I.uncheckOption('Subscribe', '.preferences');
</example>

### I.attachFile

Attaches a file to a file input element.
Expand Down
4 changes: 3 additions & 1 deletion src/ai/tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Navigator } from './navigator.ts';
import type { Pilot } from './pilot.ts';
import { Provider } from './provider.ts';
import { Researcher } from './researcher.ts';
import { actionRule, focusedElementRule, locatorRule, multipleTabsRule, protectionRule, sectionContextRule } from './rules.ts';
import { actionRule, focusedElementRule, formRequirementsRule, locatorRule, multipleTabsRule, protectionRule, sectionContextRule } from './rules.ts';
import { TaskAgent } from './task-agent.ts';
import { createCodeceptJSTools, createSpecialContextTools } from './tools.ts';

Expand Down Expand Up @@ -773,6 +773,8 @@ export class Tester extends TaskAgent implements Agent {

${sectionContextRule}

${formRequirementsRule}

${this.provider.getSystemPromptForAgent('tester', this.explorer.getStateManager().getCurrentState()?.url) || ''}
`;
}
Expand Down
2 changes: 2 additions & 0 deletions src/ai/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,15 @@ export function createCodeceptJSTools(explorer: Explorer, task: Task) {

Use cases:
- Typing into input fields (I.fillField, I.type)
- Setting checkboxes/radios to a definite state (I.checkOption, I.uncheckOption)
- Working with iframes (switch context with I.switchTo)
- Performing multiple form actions in a single batch
- Complex interactions requiring sequential commands

Example - filling a form with context (PREFERRED):
I.fillField('Username', 'John', '.login-form')
I.selectOption('Country', 'USA', '.address-section')
I.checkOption('Agree', '.terms-section')
I.attachFile('input[type="file"]', 'path/to/file', '.upload-section')

Example - filling a form with ARIA locators:
Expand Down
Loading