A Page Object Model (POM) test automation framework for the OrangeHRM demo site, built with Selenium WebDriver, Java, and TestNG.
- Invalid login — verifies an error message appears for wrong credentials
- Valid login — verifies the dashboard loads after successful login
- Add employee — adds a new employee through the PIM module
- Search employee — confirms the newly added employee appears in the Employee List
- Java 21
- Selenium WebDriver 4.21
- TestNG 7.9
- Maven
- Page Object Model — each screen (Login, Dashboard, PIM, Add Employee, Employee List) has its own class holding locators and actions
- Explicit waits (
WebDriverWait+ExpectedConditions) instead of hardcoded sleeps, for reliable synchronization - Config-driven — the base URL and login credentials live in
config.properties, not hardcoded in test code - Automatic failure screenshots — a custom
ITestListenercaptures a screenshot the moment any test fails, saved to/screenshots - CI-ready — GitHub Actions runs the full suite headlessly on every push (see
.github/workflows/tests.yml)
mvn clean testThis runs testng.xml, which executes all tests in tests.TestRun.
-
Click intercepted by a loading overlay — the Add Employee page briefly shows a loading spinner while it fetches an auto-generated Employee ID. Clicking Save too early hit the invisible overlay instead of the button. Fixed by waiting for the overlay to disappear (
ExpectedConditions.invisibilityOfElementLocated) before attempting the click. -
Exact-match XPath failing on multi-class elements —
@class='oxd-alert-content-text'only matches if that's the entire class attribute. Since the actual element had multiple classes, the exact match never found it. Fixed usingcontains(@class, '...')instead.
src/main/java/
├── base/BaseClass.java → WebDriver setup/teardown, headless mode for CI
├── pages/ → Page Object classes
└── utils/ConfigReader.java → Reads config.properties
src/test/java/
├── tests/TestRun.java → Test cases
└── listeners/ScreenshotListener.java → Auto-captures screenshots on failure
src/main/resources/config.properties → URL + login credentials
.github/workflows/tests.yml → CI pipeline (GitHub Actions)