E2E with Playwright
It opens a real browser, runs the user journey and checks the result on desktop and mobile.
Steps
Install Playwright: npm init playwright@latest.
Write the test with role locators.
Run npx playwright test.
Check the report when it fails.
import { test, expect } from '@playwright/test'
test('add a book', async ({ page }) => {
await page.goto('/')
await page.getByRole('textbox', { name: 'Book title' }).fill('My book')
await page.getByRole('button', { name: 'Add' }).click()
await expect(page.getByText('My book')).toBeVisible()
})Write a Playwright test for the journey: [..] on desktop and at a width of 390 pixels.
