---
title: "Run browser tests against the production · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/test-the-built-app
updated: 2026-10-20
licence: "All rights reserved"
---

# Run browser tests against the production build

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [End-to-end and browser tests](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests)
- Rule: Run end-to-end tests against the same build you deploy, with production settings, not against a development server.
- How: Build the app once, start it like production, and point the browser tests at it. Development servers skip minification, caching headers and security policies, so they hide bugs. Let the runner start the app and wait until it answers, such as with Playwright's `webServer` option or a pytest session fixture. Also call the built app over HTTP without a browser. For a website, fetch every page and check titles, canonical links, structured data, security headers, status codes and redirects.
- Check: The test job runs the production build and start commands, never a development server such as `vite dev` or `npm run dev`. A bug that only appears in the built app fails the browser suite.

Example:

```js
// playwright.config.js
export default {
  webServer: { command: 'npm run build && npm start', url: 'http://localhost:3000' },
  use: { baseURL: 'http://localhost:3000' },
};
```

```python
# pytest: start the production build once, then test it over HTTP
@pytest.fixture(scope="session")
def base_url():
    server = subprocess.Popen(["gunicorn", "shop.wsgi", "--bind", "127.0.0.1:8000"])
    wait_until_answers("http://127.0.0.1:8000/healthz")
    yield "http://127.0.0.1:8000"
    server.terminate()
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/test-the-built-app`.

- Previous: [Wait for the page to be ready instead of sleeping](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/no-sleeps)
- Next: [Test in more than one browser and size](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/browsers-and-sizes)
- [End-to-end and browser tests](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests)
