Browser mode
@rstest/browser provides the Browser Mode runtime APIs with a Playwright-style Locator workflow.
Exported API
page:BrowserPageentry for element queries, DOM wrapping,keyboardinput, andviewportresizingLocator: Class for chained element queries and interactionsBrowserPage: Type definition forpagesetTestIdAttribute: Configures the attribute name used bygetByTestId()
@rstest/browser also exports option and helper types such as LocatorClickOptions, LocatorGetByRoleOptions, and BrowserKeyboard.
Assertion API
Importing @rstest/browser in a Browser Mode test extends @rstest/core's expect with:
expect.element(target): Auto-retrying DOM assertions on aLocatoror DOMElementtoMatchScreenshot(): Visual screenshot comparison on aLocatororpage
Example: query, interaction, and assertion
browser-example.test.ts