Turn a bug into a test
Ask an agent to check one behavior of Zoomburgh: tapping a company in the watchlist should show its news. The goal is text from Arbor Outfitters’ first headline. The navigator taps Arbor Outfitters, finds the news panel still empty, and reports the goal impossible. ZShot saves the page it ended on to arbor-outfitters.png and the session to news-test.js, a Playwright script. The navigator in this example uses Anthropic with an API key you must provide.
zshot -f arbor-outfitters.png \
--navigate "Tap Arbor Outfitters in the watchlist once, then check that its news headlines appear within five seconds. Do not tap it again." \
--navigator-goal "text:Analysts lift ARRC price target" \
--navigator-renders-when-impossible \
--navigator-captures-playwright news-test.js \
--navigator-type "anthropic://YOUR_API_KEY@" \
https://zshot-cli.com/example_assets/zoomburgh/
The script repeats the navigator’s steps, then waits for the goal:
// step 1: CLICK [row]
await click(page.locator("tbody > tr:nth-of-type(2)"));
// step 2: WAIT
await page.waitForTimeout(5000);
// goal: text:Analysts lift ARRC price target
await page.waitForFunction((text) => (document.body ? document.body.innerText : '').includes(text), "Analysts lift ARRC price target");Replay it against ZShot. It needs the playwright package but no browser of its own:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install playwright
zshot --cdp -- node news-test.jsThe headline never appears, so the replay fails the same way and ZShot exits with the script’s code, 1:
page.waitForFunction: Timeout 30000ms exceeded.Once the news loads on the first tap, the same command exits 0, so the script can stay in a test suite as a regression test.