FlashcardNot attempted
Anatomy of a Playwright test
Recall it before you reveal
Write a minimal Playwright test for logging in, following Arrange-Act-Assert.
Space to reveal
Show answer & explanation
import { test, expect } from '@playwright/test';
test('user can log in', async ({ page }) => { // Arrange await page.goto('/login'); // Act await page.getByLabel('Email').fill('ann@example.test'); await page.getByLabel('Password').fill(process.env.E2E_PASSWORD!); await page.getByRole('button', { name: 'Log in' }).click(); // Assert await expect(page).toHaveURL(/dashboard/); await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();});Log in once in a setup project and reuse storageState to keep suites fast.