Coding agents

Getting coding agents to verify browser behavior

Capy team

AI coding agents testing a UI change should finish in a browser: open the changed page, use it, and show you a screenshot. That catches what no test asserted, like a hidden button. In Capy, every cloud machine has a Linux desktop with Google Chrome, so the agent starts your app, clicks through the change and attaches screenshots or a video to the pull request. On Pro and above, the thread can also attach a cloud iPhone and open your site in Safari.

What a browser check catches that tests miss

A test passes when its assertions hold, and the page can still be wrong:

  • A CSS change hides the submit button below 400 pixels of width.
  • The function returns the right total, and the template rounds it again on the way to the page.
  • A request works from the test client and fails in the browser on a missing CORS header.
  • The console logs a hydration error that no test reads.

An agent that opens the page finds these before a reviewer does. Its screenshot takes the reviewer seconds to read.

What the agent needs to run your app

An agent can only look at what it can start. Its machine needs three things:

  1. One command that starts the app, as a startup entry with its port, or as a named command if you only want it on demand, in the project's Dev environment or a committed .capy/setup.json.
  2. Data worth looking at, from a seed script or a staging API. An empty table hides most layout bugs.
  3. A test account whose credentials live in environment variables, never pasted into a chat: a Shared variable for the whole project, a Personal one for your threads only, or a Thread variable sent from the composer for one run. The model sees their names, not their values.

Then add the browser pass as a standing rule in the repository's AGENTS.md, or in your Drive's AGENTS.md for every project, instead of a request you repeat: "Before you open a pull request for a UI change, start the app, open each changed page and attach a screenshot."

A worked example: a report total

Expense report R-42 shows a total of €1,290.00, but its receipts add up to €1,284.50. A user asks a Capy thread to fix the total and to look at the page in a browser before opening the pull request.

  1. The agent finds the cause. The report adds a £40.00 receipt to the euro amounts and converts the sum afterwards, so it rounds twice. The fix converts each receipt at its own date's rate before adding, and a new test covers a report in two currencies.
  2. The suite passes. The agent starts the app on port 3000 and opens /reports/R-42 in Chrome.
  3. The total reads €1,284.50, and the London receipt shows £40.00 as €46.00. The agent takes a screenshot.
  4. It opens the pull request and posts the screenshot in the thread, as in the image above.

The reviewer sees the fixed page before opening the diff. The screenshot covers R-42, and the test covers every report after it.

Where Capy fits

Capy is a platform that orchestrates agent swarms, and every agent in it can open a browser:

  • Each cloud machine has a desktop with Google Chrome. The agent's browser tool reads the page, its console and its network requests, and takes screenshots. Desktop in the thread's + menu streams that screen, so you can watch the agent click through the change, and Browser (Cmd/Ctrl+Shift+L) opens the in-app browser.
  • The agent attaches screenshots or a video of the run to the pull request.
  • A preview publishes the app running on the machine at its own URL, so you can open the same page yourself.
  • Cloud phones, on Capy Pro, Max and Enterprise, add a cloud iPhone, iPad or Android phone to the thread and bill Capy credits while awake, at the cloud phone rates. On an iPhone the agent can open your site in Safari, switch to dark mode, rotate the screen and take screenshots. It can also build your mobile app on Revyl's build runners, install it and tap through it.

And where it doesn't:

  • Cloud machines have Chrome on Linux, and cloud phones have mobile browsers. For desktop Safari, run the thread on your Mac through the desktop app with Computer use on macOS turned on in Settings → Experiments, so the agent can use the Mac's own Safari, or have it run a WebKit test suite there.
  • A screenshot covers the pages the agent opened. Your test suite still covers the rest, and a person still reviews the diff.
  • A login that needs MFA or a CAPTCHA needs you on the desktop for that step. The thread asks and waits.
  • The agent can only open what your environment can start.

Follow-up questions

Should the agent write end-to-end tests too?

If the repository has a browser test suite, yes. Ask for a test of the flow you changed. A screenshot helps one review, and a test runs on every pull request after it.

Can I watch the agent use the browser?

Yes. While the machine is awake, open Desktop from the thread's + menu. You see the screen the agent uses, and you can click and type on it.

Can it check pages behind a login?

Yes. Store a test account as variables and name them in your instruction. If the login sends a code to your phone, the thread asks you to finish that step on the desktop.

Does it work in Safari and on mobile?

Yes, on a cloud phone, on Capy Pro, Max or Enterprise. The thread attaches an iPhone, iPad or Pixel 7, opens your site in the phone's browser, and reads and taps the screen the way a user would. For a native app, Capy builds it on Revyl's build runners, installs it on the phone and walks through it.