Build an authenticated account fixture
Medium70 pts
- Authentication Fixture
- test.extend
- Session Setup
- Clean Teardown
Practice app · Acme Ops
A sign-in page with field validation and an authenticated dashboard.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Build a reusable authenticatedPage fixture that signs into the Acme Ops application and yields an active dashboard session to your tests.
Your Task
- 1Extend Playwright's base test with a custom fixture named
authenticatedPage. - 2In the fixture setup, navigate to the sign-in page at TEST_URL.
- 3Enter 'qa@target.dev' into the email field (#username or name='username') and 'Test@123' into the password field (#password).
- 4Click the sign-in button (#login-button) and wait for the dashboard container (#dashboard) to become visible.
- 5Provide the authenticated page to the test.
- 6In your test, consume
{ authenticatedPage }and assert that the welcome banner (#welcome-message) displays 'Welcome back, QA Tester'.
Validation Checks
- Custom fixture authenticatedPage is defined with test.extend
- Fixture signs in using qa@target.dev and Test@123
- Dashboard container (#dashboard) is confirmed visible during fixture setup
- Fixture yields authenticated page via use(page)
- Welcome banner (#welcome-message) displays 'Welcome back, QA Tester'
- At least 1 assertion passes
Fixtures
- username
- qa@target.dev
- password
- Test@123
Playwright · Playwright Practice Track · Fixtures