Write a custom test fixture
Medium70 pts
- test.extend
- Custom Fixture
- use() callback
Practice app · Practice Catalog
A product catalog with ids, names, classes, links, data-testids and duplicate buttons for locator practice.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Create a custom test fixture using test.extend that encapsulates pre-test setup and cleanup.
Your Task
- 1Extend Playwright's base test with a custom test fixture named
catalogPage. - 2Inside the
catalogPagefixture implementation, navigate to the product catalog at TEST_URL and provide the page to the test. - 3Write a test that injects and consumes the
{ catalogPage }fixture. - 4Assert that the catalog search input (#search-input) is visible.
Validation Checks
- Custom fixture catalogPage is defined using test.extend
- Fixture navigates to TEST_URL and yields page using use(page)
- Test consumes { catalogPage } fixture
- Catalog search input (#search-input) is verified visible
- At least 1 assertion passes
Playwright · SDET Practice Track · Fixtures