Refactor a test to the Page Object Model
Hard120 pts~45 min
- Page Object Model
- Separation of concerns
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
Move all locators and interactions of the sign-in flow into page objects so the test reads as intent only.
Your task
- 1Create a LoginPage class owning #username, #password, #login-button and #login-error, with open() and loginAs(email, password).
- 2Create a DashboardPage class exposing the text of #welcome-message and #user-role.
- 3In the test: open the login page, loginAs("qa@target.dev", "Test@123") and assert the welcome text is “Welcome back, QA Tester”.
- 4Keep assertions in the test and locators in the page objects.
Acceptance criteria
- At least one *Page class exists
- The dashboard is shown with the welcome message
- At least 1 assertion passes
Fixtures
- username
- qa@target.dev
- password
- Test@123
Selenium WebDriver 4 · QA Automation · Page Object Model & architecture