Record a test
Start the studio on your machine, name a test on the web, then click through the flow in a real browser.
Before you start
- The verifAIed CLI is installed and logged in. See Set up.
- Your repository has
@playwright/test1.60 or later installed, along withnodeandnpx. - Your repository has a
.verifaied/config.tomlthat says where your app runs. Commit it. - Your app is running at that address.
# .verifaied/config.toml [browser-tests.env.local] base_url = "http://localhost:3000"
base_url is the origin of your app, with no path on the end. Environments, variables and secrets covers the rest of this file.
1. Start the studio
Run this in your repository and leave it running:
verifaied test studio
The studio connects your machine to verifAIed. Recording drives a real browser, so it happens on your machine, where your app is. While the studio is connected, the Browser Tests page shows Recorder connected with the branch it is on.
Press Ctrl-C to stop the studio. A recording in progress is saved first.
2. Create the test
On the branch's Browser Tests page, click New test and fill in the form.
- Feature: the folder the test lives in. Pick one that exists or make a new one. Folders can nest.
- Name: what the flow does. A name cannot contain a slash.
- Start path: where the flow begins, as a path like
/settingsor a full URL. A path is resolved againstbase_url. Leave it empty to start at your app's home page. - Description: optional. What the flow is for.
- Replay first (optional): tests to replay before this one starts, such as a login. See Pre-steps.
Nothing is created until a recording starts, so you can leave the form without leaving anything behind.
3. Record the flow
Click Record. A real browser opens on your machine, on your app. Use the app as a person would. Each click and each field you fill becomes a step in the flow, and the steps appear live on the web page as you go.
To say what you expect at a point in the flow, add a check with the studio's tools on the web page. See Studio tools.
The recording browser is a normal window. Resize it to record the flow at the width you care about.
4. End the recording
- Finish recording saves the test, closes the browser and replays the test once to confirm it passes. That replay makes the first video. Closing the browser window by hand does the same.
- Keep as draft closes the browser and saves nothing. The test stays in the list as a draft, so you can record it later.
- Discard test closes the browser and removes the test. It is offered on a first recording.
- Cancel recording takes the place of the other two when you re-record a test that is already saved. The browser closes and the saved test stays exactly as it was.
Finish recording is unavailable while a check in the flow is failing against the page. Edit the check until it passes, or delete it.
Where the test is saved
The test is written to .verifaied/tests/<folder>/<name>.spec.ts in your repository. It is a plain Playwright file. Read it, edit it and commit it with the change it proves.
Record from the terminal instead
Without a studio running, you can record one test with one command. The test is named <folder>/<name>:
verifaied test record "Settings/API tokens" --url /settings
Add --pre to replay another test first. With a pre-step, --url is optional and the recording begins where the pre-step leaves the browser:
verifaied test record "Settings/API tokens" --pre "Auth/Log in"
When no studio is connected, the New test page writes this command for you as you fill in the form.
Good to know
- A draft never counts against your branch. Only a saved test does.
- The studio records one test at a time. A second Record waits for the first to finish.
- When your app moves by itself, such as a redirect after a login, no step is recorded for it. The next step waits for the page instead.
- If you set a
resetcommand, it runs before every recording. See Reset state.