Extract a component object
Hard120 pts~45 min
- Component objects
- Page Object Model
- Composition
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
Model the dashboard's header (user name, role, log out) as a reusable component object used by the page.
Your task
- 1Create a HeaderComponent (or UserMenu) class scoped to the dashboard header, exposing userName(), role() and logout().
- 2Let DashboardPage return the component, e.g. dashboard.header().
- 3Sign in with qa@target.dev / Test@123 (#username, #password, #login-button). Assert role() is “Administrator”.
- 4Log out through the component and assert the sign-in form (#login-button) is visible again.
Acceptance criteria
- A component class and a page class exist
- The test ends on the sign-in route (#/login)
- At least 2 assertions pass
Fixtures
- username
- qa@target.dev
- password
- Test@123
Selenium WebDriver 4 · QA Automation · Page Object Model & architecture