Browser mode is a frontend-only test mode for Dioxus that allows testing the UI in Chrome against a running dev server. It replaces the Dioxus Rust backend with mocks defined per command, intercepting the Dioxus invoke(...) API at the JavaScript boundary. This eliminates the need for a Dioxus binary, driver, or Rust compilation during tests, enabling fast feedback and the use of standard Chrome DevTools and HMR.
Use Browser Mode when:
- Asserting UI state.
- Verifying that components call correct Dioxus commands with specific arguments.
- Checking how the renderer handles mock responses.
Do NOT use Browser Mode (use Native Mode instead) when:
- You need to call
browser.dioxus.execute() to access the bridge. - You need to manage windows via
browser.dioxus.switchWindow() or browser.dioxus.listWindows(). - You need to use
browser.dioxus.triggerDeeplink(). - You need to assert on real command round-trips to a running Rust backend.