Browser mode (experimental)
Rstest provides Browser Mode, allowing you to run tests in a real browser instead of simulated environments like jsdom or happy-dom.
What is browser Mode?
Browser Mode uses Playwright to execute your test code in real browsers (Chromium, Firefox, or WebKit). This means your tests run with the exact same browser APIs and behaviors as in production.
When to use browser mode
Use this decision tree to determine if you need Browser Mode:
Even if your tests work fine in jsdom, we still recommend using Browser Mode. See the comparison table below for specific advantages.
Browser mode vs jsdom/happy-dom
Browser Mode and jsdom/happy-dom represent different trade-offs: Browser Mode provides full browser compatibility and visual debugging but consumes more resources; jsdom/happy-dom runs faster and lighter but can only simulate a subset of browser APIs.
Next steps
- Getting Started - Configure and run your first browser test
- Framework Guides - Complete configuration and component testing examples for each framework
- User Interactions - Simulate user clicks, typing, and other actions