All pages
Close the loop · Lesson 1.2 · 12 min
Verify in the browser
Have the agent open the page, read the console and check what a user would see.
After this lesson you have the agent check its own front-end work the way a user would see it: it opens the page, reads the console and network log, asserts on what's on screen, and keeps a screenshot baseline that catches the change nobody meant to make.
Time: 12 minutes · Works on: macOS app. The cloud workspace has its own browser tools on a different engine.
Compiling is not working
For back-end code, a passing test suite is strong evidence. For anything a person looks at, it's weak. A component can type-check, render without throwing, pass its unit tests, and still show a blank card because an API call returned 401. The agent won't know unless it looks.
So make looking part of the job. A front-end task isn't done until the agent has loaded the page in a browser and checked three things:
- The console is clean. No new errors, no unhandled promise rejections. Warnings that were there before the change are fine. New ones need a reason.
- The network is clean. No 4xx or 5xx responses, no failed requests, for the flow you changed.
- The page shows what it should. The text, the element, the state you asked for, checked by an assertion rather than described from memory.
Then it shows you a screenshot. The screenshot is for you. The assertions are for the agent.
Assertions over eyeballing
A model looking at a screenshot will usually tell you it looks fine. That's the same problem as the agent grading its own work, with pixels. A check that passes or fails on its own is better:
- "The heading reads Pricing."
- "There are exactly three plan cards."
- "After clicking Subscribe, the URL ends in
/checkout." - "The Save button is disabled until the email field is filled."
Each of these is one call and returns a plain pass or fail with the actual value when it fails. Put them in the brief as done-when lines, the same way the previous lesson put a failing test there.
Baselines catch what you didn't ask about
Assertions check what you thought of. A visual baseline checks everything else. Save a screenshot of a page in a known-good state, then compare against it after each change. A shifted margin, a missing icon or a font that stopped loading shows up as a pixel difference, even though no assertion mentioned it.
Use baselines on a few pages that matter and change rarely. On a page under active redesign, every compare fails and the baseline becomes noise.
A worked example
You asked the agent to add a "Copy link" button to each row of a share dialog. Your brief ends:
Done when, at http://localhost:3000/share:
- each row has a button with the text "Copy link"
- clicking the first one shows the text "Copied"
- the browser console has no errors and no request failed
Show me a screenshot of the dialog when you're finished.
The agent makes the change, then opens the page in the built-in browser,
counts the buttons, clicks the first, and waits for "Copied". That check
fails: the clipboard call threw. It reads the console, finds NotAllowedError
from the clipboard API, fixes the handler, and runs the checks again. Now
they pass, the console is clean, and the screenshot shows the dialog. The bug
was caught and fixed without you opening the page.
Do it in TRMNLY
- Put the app next to its terminal. Start your dev server in a pane,
for example
npm run dev. Show the right sidebar with⇧⌘\, click Web, and open the server's URL in the address bar. The agent drives this same tab, so you can watch what it does. - Point at what you mean. Click the crosshair beside the address bar, Design mode — click an element to hand it to the agent, and click the element. The agent gets its selector, styles, HTML and a cropped screenshot, so "the button" in your brief is unambiguous. The page's own click handlers don't fire while you pick.
- Have the agent read the console.
browser_consolereturns the tab's capturedconsole.*messages, uncaught errors and unhandled rejections. Ask it to filter to errors, and to drain the buffer before the check (clear: true) so it only sees what the change produced. You can read the same log yourself in the DevTools panel, Toggle DevTools (Console / Network / Elements). - Have it read the network.
browser_networkreturns eachfetchand XHR call with method, URL, status and duration. Withonly_errors: trueit keeps only failed, 4xx and 5xx requests, which is the check you want. - Assert, don't describe. Ask the agent to use
browser_expect. It retries until the condition holds or a timeout passes, so a check doesn't fail just because the page was still loading. It checks whether an element is visible or hidden, its text, an attribute, the URL, a count of matching elements, and whether a control is enabled or checked. For one-off text checks,browser_assert_textandbrowser_assert_urlfail loudly with the actual value. - Take the screenshot.
browser_screenshotcaptures the viewport, one element by selector, or the full page. The image goes to a vision-capable model with the result, and the file is saved under~/Library/Application Support/TRMNLY/agent/screenshots/with its path returned, so you can open it. Keep the browser sidebar open while it runs: a collapsed sidebar can't be captured in a WebKit tab. - Save a baseline. Ask the agent to call
browser_visual_assertwith a name andmode: "create"on a page you've checked by hand. That saves.trmnly/snapshots/<name>.pngin the project. Later runs use the defaultassertmode and fail when the page differs beyond the tolerance. Pass a selector to compare one element instead of the whole viewport. Commit the snapshots folder if you want the baseline shared. - Check other conditions.
browser_viewportemulates a screen size so media queries recompute, andbrowser_emulatesets dark mode, reduced motion, timezone, locale or offline before the page loads. In a WebKit tab the viewport is approximated with zoom and a script, and screenshots show the sidebar's real size. Choose Chrome — TRMNLY profile from the engine chip when the layout viewport must really be the size you asked for. - Make the flow repeatable. Ask the agent to record the check as a saved
browser action with
browser_action_record_startandbrowser_action_record_stop. It appears in More ▾ → Flows under Browser actions and replays with no model involved. To keep it as a permanent test, ask forbrowser_codegen, which turns the recording into a Playwright spec you can commit.
Check yourself
- The agent reported the console and network results for your page without you asking.
- At least one done-when line was checked with
browser_expectorbrowser_assert_text, and you saw it fail once before it passed. - A baseline exists under
.trmnly/snapshots/, and a deliberate CSS change makes its compare fail. - You can explain why a screenshot alone isn't proof the page works.
Go further
- The built-in browser — tabs, engines, design mode and DevTools
- Browser — every
browser_*tool, sessions, mocks and recordings - Workflows and tab monitors — replay a recorded browser action from Flows
- Tests are the contract — the done-when line, for code without a page