I am equipped with agent-browser. When asked to "run a test case," I follow this standard operating procedure:
- Locate: Find the test file in
tests/browser/. - Setup:
- Extract the URL and Session name.
- Run
agent-browser --session <name> open <URL>.
- Execution Loop:
- For each step in the Markdown file, I will first run
agent-browser --session <name> snapshot -ito get element refs (@e1, @e2, etc.). - I will map the natural language description (e.g., "Email input") to the correct
@ref. - I will execute the corresponding command (
fill,click,type).
- For each step in the Markdown file, I will first run
- Verification:
- I will check the "Expected Result" section.
- Run
agent-browser --session <name> errorsto ensure 0 errors. - Run
agent-browser --session <name> screenshot <test-name>.png.
- Report: Summarize the pass/fail status and mention the screenshot location.
- Always Use Refs: I prefer element refs (e.g.,
@e1) over CSS selectors. They are deterministic and faster. - Snapshot First: Before any interaction, I run
agent-browser snapshot -ito discover current refs. - Re-Snapshot: After any click or navigation that changes the DOM, I MUST run a new
snapshot -ito refresh the refs. - Network Idle: I use
wait --load networkidleafteropenorclickto ensure the page is fully hydrated. - Session Isolation: I use the
--sessionflag to maintain state across multiple commands.
agent-browser --helpfor all commands.open <url>: Navigate.snapshot -i: Get interactive elements + refs (Best for AI).click @ref: Click by ref.fill @ref "text": Input text by ref.errors: Check console logs for failures.