Web testing
Point agent-qa at a web app, choose a browser, and tune timeouts, logs, accessibility checks and recordings.
agent-qa tests web apps through Playwright, in a browser it installs and manages itself. Your everyday browsers are untouched.
Add a target
A target names the app and where it runs:
registry:
targets:
shop-local:
platform: web
url: http://127.0.0.1:3000
environment: localA test picks it with target: shop-local. The target's url is where each test starts. Add one target per environment you test, such as local, staging and preview. environment is a label only: agent-qa runs every target the same way, so point tests at production only with accounts and data you can afford to change.
Install a browser
npx agent-qa init downloads Chromium when it sets up a web project, and a re-run offers to install it again when this machine has none. Install it yourself for a project set up with --no-browsers, or on a CI runner:
npx agent-qa install-browsers --chromiumUse --firefox, --webkit or --all for the others, and --with-deps on Linux to install the system libraries too.
Browser settings
use:
browser:
name: chromium
headless: true
viewport:
width: 1280
height: 720name is chromium, firefox or webkit. These settings live under use, so a suite or a single test can override them. To watch a run, use --no-headless:
npx agent-qa run tests/checkout.yaml --no-headlessAGENT_QA_HEADLESS=false does the same through the environment.
Remote browsers
Tests run in a browser agent-qa launches on this machine unless your files pick a remote: a Playwright server, a CDP endpoint, or a cloud browser service through a plugin.
registry:
remotes:
- name: grid
protocol: playwright
url: wss://grid.example.com/playwright
query:
token: "{{secret:GRID_TOKEN}}"
use:
browser:
name: chromium
headless: true
remote: gridSet use.browser.remote in the config for every test, or in a suite or test to move only those. See Remote browsers and devices, and Plugins for BrowserStack, Hyperbrowser, Kernel and Steel.
Timeouts
use:
timeout:
step: 20m
test: 90m
navigation: 2mA step that runs past step fails. A test that runs past test ends with the timeout verdict. navigation bounds page loads. The values above are what init writes.
Console and network logs
agent-qa records the browser console and network traffic for every step:
use:
logCapture:
console: true
network: trueRead them in the dashboard's Console and Network tabs, or with agent-qa runs evidence <runId> --test 0 --step 2 --kind network --json.
Accessibility checks
agent-qa runs axe-core accessibility checks on web pages:
services:
accessibility:
enabled: true
standard: wcag2aa
runAfter: test-end
failOnViolation: false| Key | Values |
|---|---|
standard | wcag2a, wcag2aa or wcag2aaa |
runAfter | test-end checks the last page of each test; every-step checks after every step. |
failOnViolation | true fails the step on critical or serious violations. |
disableRules | axe rule IDs to skip. |
exclude | CSS selectors to leave out. |
Results appear in the dashboard's A11y tab and through --kind a11y evidence.
Session videos
Every run records a video of the browser session by default. Turn it off for one run with --no-record, for one test with meta.record: false, or for the project:
services:
recording:
enabled: true
keepFailuresOnly: truekeepFailuresOnly drops the videos of tests that passed.
Tests behind a login
Sign in once by hand and let tests reuse the session: Saved logins. For logins that need fresh data on every run, use a hook.
Run JavaScript in the page
A step can run a snippet in the page and use its result:
steps:
- Verify the cart badge shows {{runJS:"document.querySelectorAll('.cart-item').length"}} items.