Exercise 01 — Convert beforeEach setup to fixtures
Goal
Take a test that creates a list in beforeEach (or inline) and rewrite it to use the lightest fixture from tests/helpers/list-fixtures.ts.
Steps
- Read
tests/logged-in/manage-lists-before-each.spec.tsandmanage-lists-fixtures.spec.ts. - Copy one create/edit assertion into a new scratch file under
tests/logged-in/(or edit locally without committing). - Replace manual
createList/ navigation withemptyListPage,listWithMoviesPage, orlistPage. - Keep web-first assertions; drop any redundant setup.
Done when
- The test imports
testfromlist-fixtures(../helpers/list-fixturesfromtests/logged-in/). - Setup is only the fixture you need.
npx playwright test <your-file> --project="logged-in chrome"passes.