Turn a HAR capture into Vera API tests
A HAR file is what browser devtools save when you record network traffic. Vera turns it into API tests: one test per recorded page, with the meaningful API, XHR and document requests as api-request steps in recorded order. Static assets are skipped and credentials are stripped on the way in.
What comes across
- One test per recorded page (one test if the capture has no pages), with requests as api-request steps in recorded order.
- Each step expects the response status that was recorded.
- Static assets — images, fonts, CSS and JavaScript — and preflight OPTIONS requests are skipped and counted.
- Browser noise headers such as user-agent, referer and accept-encoding are dropped.
What does not
- A HAR holds network requests, not clicks or typing, so it imports as API tests, not a browser journey.
- Authorization, Cookie, X-API-Key and Proxy-Authorization headers are stripped, so a capture of a logged-in session does not replay logged in by itself; the project’s auth role supplies the session at run time.
- Request bodies over 10 KiB are truncated, with a warning.
- A request that was recorded failing (4xx or 5xx) is kept, and its failing status becomes the expectation — check those warnings before relying on the test.
How to set it up
- Record the flow in your browser devtools Network panel and save it as a .har file.
- Open a project's Tests page and choose Import tests, then pick your .har file. The format is detected from each file.
- Give the project an auth role if the capture was of a logged-in session — the captured credentials are not imported.
- Or convert from the repository: npx vera-agent init --import har finds the specs and uploads them through the CI API, which needs Pro or above on Vera's cloud (self-hosted installs include it). The dashboard import works on every plan.
Questions
Can Vera turn a HAR file into tests?
Yes. Each recorded page becomes a test and each meaningful request an api-request step, asserting the status that was recorded.
Are cookies and tokens in the HAR imported?
No. Authorization, Cookie, X-API-Key and Proxy-Authorization headers are stripped, with a warning naming them. The project’s auth role supplies the session when the test runs.
Does a HAR import replay my clicks?
No. A HAR records network traffic only, so it becomes API tests. Record clicks with the Vera recorder instead.