Vitest Browser Mode
Learn everything you need to know to get up to speed with Vitest Browser Mode, to run your tests in a very realistic, fast and (optionally) visual way!
Vitest Browser Introduction
Vitest Browser Mode Setup
Vitest Browser Mode Fundamentals
Vitest Browser Mode Locators
Vitest Browser Mode Assertions
Vitest Browser Mode Interactivity
Vitest Browser Mode Advanced
So far in this course we have shown how to render components in Vitest Browser Mode and how to query to select specific elements.
Now let's add some interaction!
In this lesson we're going to go over the main interactive methods (like .click()).
These work in a similar way to Playwright's API, but quite differently to React Testing Library, which encourages you to use patterns like userEvent.click(element). In Vitest Browser Mode, the most common way to interact (with things like clicking) is to call .click() on the Locator itself.
await screen
.getByRole('button')
.click();
Lesson covers:
clear(), click(), dblClick(), dropTo(), fill(), hover(), selectOptions(), unhover()