For AI agents: the complete documentation index is available at https://rstest.rs/llms.txt, the full documentation bundle is available at https://rstest.rs/llms-full.txt, and this page is available as Markdown at https://rstest.rs/api/runtime-api/browser-mode/index.md.
close
  • English
  • Browser mode

    @rstest/browser provides the Browser Mode runtime APIs with a Playwright-style Locator workflow.

    Exported API

    @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:

    Example: query, interaction, and assertion

    browser-example.test.ts
    import { page } from '@rstest/browser';
    import { expect, test } from '@rstest/core';
    
    test('submits form', async () => {
      await page.getByLabel('Email').fill('[email protected]');
      await page.getByRole('button', { name: 'Submit' }).click();
      await expect.element(page.getByText('Done')).toBeVisible();
    });

    Detailed reference