Skip to content

srinathsqa/orangehrm-selenium-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OrangeHRM Selenium Automation Framework

Run Selenium Tests

Java Selenium TestNG Maven GitHub Actions Chrome POM Data Driven License

A Page Object Model (POM) test automation framework for the OrangeHRM demo site, built with Selenium WebDriver, Java, and TestNG.

What it tests

  • 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

Tech stack

  • Java 21
  • Selenium WebDriver 4.21
  • TestNG 7.9
  • Maven

Framework design

  • 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 ITestListener captures 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)

Running locally

mvn clean test

This runs testng.xml, which executes all tests in tests.TestRun.

Two bugs fixed during development (and why)

  1. 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.

  2. 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 using contains(@class, '...') instead.

Project structure

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)

Releases

Packages

Contributors

Languages