Compose dependent fixtures
Hard120 pts
- Fixture Composition
- Dependency Injection
- test.extend
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
Compose multiple custom fixtures where one fixture automatically depends on and consumes another.
Your Task
- 1Define a credentials fixture (e.g.
userCredentials) that provides credentials with email 'qa@target.dev' and password 'Test@123'. - 2Define a dependent authenticated application fixture (e.g.
authedApp) that declares dependency onuserCredentials. - 3In the
authedAppfixture setup, navigate to TEST_URL, enter the credentials into the email and password fields, submit the form (#login-button or button[type='submit']), and yield. - 4In your test, consume the
{ page, authedApp }fixtures. - 5Assert that the dashboard container (#dashboard) is visible.
Validation Checks
- Defines userCredentials fixture providing email and password
- Defines authedApp fixture depending on userCredentials and performing login
- Test consumes authedApp and page fixtures
- Dashboard container (#dashboard) is verified visible
- At least 1 assertion passes
Fixtures
- username
- qa@target.dev
- password
- Test@123
Playwright · Playwright Practice Track · Fixtures