Runtime API Overview
This page lists all the testing APIs for Rstest.
- For general testing APIs, see Test API
- For Browser Mode specific APIs, see Browser Mode
Test API
- expect
- expect.element (Browser Mode)
- expect.not
- expect.soft
- expect.poll
- expect.unreachable
- expect.assertions
- expect.hasAssertions
- expect.addEqualityTesters
- expect.addSnapshotSerializer
- expect.getState / expect.setState
- Matchers
- Common matchers
- Mock matchers
- Snapshot matchers
- Promise matchers
- Asymmetric matchers
- Custom matchers
Browser Mode
- page
- BrowserPage
- Query API
- locator
- getByRole
- getByText
- getByLabel
- getByPlaceholder
- getByAltText
- getByTitle
- getByTestId
- Configuration API
- setTestIdAttribute
- Composition API
- filter
- and / or
- nth / first / last
- Interaction API
- click
- dblclick
- hover
- press
- fill
- clear
- focus
- blur
- check
- uncheck
- scrollIntoViewIfNeeded
- waitFor
- dispatchEvent
- selectOption
- setInputFiles
- Usage constraints
- Using with expect.element
- Type signature
- Auto-retry and timeout
- Timeout priority
- Failure output
- Use cases
- Input constraints
- Element assertions
- not
- toBeVisible
- toBeHidden
- toBeEnabled
- toBeDisabled
- toBeChecked
- toBeUnchecked
- toBeAttached
- toBeDetached
- toBeEditable
- toBeFocused
- toBeEmpty
- toBeInViewport
- toHaveText
- toContainText
- toHaveValue
- toHaveId
- toHaveClass
- toHaveAttribute
- toHaveCount
- toHaveCSS
- toHaveJSProperty
- Related API
Rstest Utility
- getMockName
- mockName
- mockClear
- mockReset
- mockRestore
- Symbol.dispose
- getMockImplementation
- mockImplementation
- mockImplementationOnce
- withImplementation
- mockReturnThis
- mockReturnValue
- mockReturnValueOnce
- mockResolvedValue
- mockResolvedValueOnce
- mockRejectedValue
- mockRejectedValueOnce
- mock
- mock.calls
- mock.instances
- mock.contexts
- mock.invocationCallOrder
- mock.lastCall
- mock.results
- mock.settledResults
- rs.useFakeTimers
- rs.useRealTimers
- rs.isFakeTimers
- rs.setSystemTime
- rs.getRealSystemTime
- rs.runAllTicks
- rs.runAllTimers
- rs.runAllTimersAsync
- rs.runOnlyPendingTimers
- rs.runOnlyPendingTimersAsync
- rs.advanceTimersByTime
- rs.advanceTimersByTimeAsync
- rs.advanceTimersToNextTimer
- rs.advanceTimersToNextTimerAsync
- rs.advanceTimersToNextFrame
- rs.getTimerCount
- rs.clearAllTimers