Skip to content

QuantumRay-code/Playwright-OrangeHRM-Framework

Repository files navigation

OrangeHRM Test Automation Framework

Playwright + JavaScript automation framework for OrangeHRM Community Edition, built with the Page Object Model. Covers Authentication, Dashboard, PIM (employee records), and Admin (user management) with 40+ automated tests running across Chromium, Firefox, and WebKit, integrated into a GitHub Actions CI pipeline.

Highlights:

  • Reusable Page Object layer with zero duplicated selectors across 4 modules
  • Dynamic test data generation to avoid record collisions on a live, shared public server
  • Externalized JSON test data, separated from test logic
  • CI/CD via GitHub Actions — full suite runs automatically on every push/PR, with HTML reports uploaded as artifacts

Tech Stack

Category Tool
Automation Framework Playwright
Language JavaScript
Runtime Node.js
Architecture Page Object Model (POM)
Reporting Playwright HTML Report
CI/CD GitHub Actions
Configuration dotenv

System Under Test

OrangeHRM Community Edition — public demo instance: https://opensource-demo.orangehrmlive.com


Modules Covered

Module Status
Authentication (Login, Logout, Invalid Login, Empty Fields, Forgot Password) ✅ Complete
Dashboard (Widgets, Quick Launch, Navigation Menu) ✅ Complete
PIM (Add / Search / Delete Employee) ✅ Complete
Admin (Add / Search / Delete User) ✅ Complete

Project Structure

project-root/
│
├── pages/              # Page Object classes (locators + actions)
├── tests/              # Test suites, organized by module
│   ├── authentication/
│   ├── dashboard/
│   ├── pim/
│   └── admin/
├── helpers/             # Reusable workflows (e.g. loginAsAdmin)
├── utils/                # Generic utilities (dynamic data generation)
├── test-data/            # External JSON test data
├── config/               # Environment configuration (.env loader)
├── reports/              # Generated Playwright HTML reports
├── .github/workflows/    # GitHub Actions CI pipeline
├── playwright.config.js
└── package.json

How to Run

1. Clone the repository

git clone https://github.com/QuantumRay-code/Playwright-OrangeHRM-Framework.git
cd <project-folder>

2. Install dependencies

npm install
npx playwright install

3. Configure environment variables

Create a .env file in the project root:

BASE_URL=https://opensource-demo.orangehrmlive.com/web/index.php/auth/login
ADMIN_USERNAME=Admin
ADMIN_PASSWORD=admin123

4. Run the tests

npx playwright test

Run a specific module:

npx playwright test tests/authentication

Run only smoke tests:

npx playwright test --grep @smoke

5. View the HTML report

npx playwright show-report reports/html-report

Test Data Strategy

  • Static/reusable data (e.g. invalid login credentials, default user role/status) lives in test-data/*.json, separate from test logic.
  • Dynamic/unique data (e.g. employee names, usernames) is generated at runtime via utils/dataGenerator.js, using timestamps to guarantee uniqueness. This is necessary because the framework runs against a shared public demo environment where hardcoded names could collide with other users' data.

CI/CD

GitHub Actions automatically runs the full test suite on every push and pull request to main. The workflow:

  1. Installs dependencies and Playwright browsers
  2. Builds a .env file from GitHub Secrets (BASE_URL, ADMIN_USERNAME, ADMIN_PASSWORD)
  3. Runs the full test suite across Chromium, Firefox, and WebKit
  4. Uploads the HTML report as a workflow artifact

See .github/workflows/playwright.yml.


Known Limitations

Shared public demo environment. This framework tests against OrangeHRM's publicly shared demo instance, which is used simultaneously by many other people. This introduces two realistic constraints, both of which the framework is deliberately engineered to tolerate:

  • Variable response times. Write-heavy operations (creating employees, creating users) occasionally take significantly longer than normal due to server load from concurrent public usage. The framework accommodates this with generous, operation-specific timeouts and a single automatic retry (retries: 1 locally, 2 in CI) rather than treating every slow response as a failure.
  • Data volatility. Records created by this framework (or by other users) can be modified or removed by others at any time. Employee/user names are generated dynamically with timestamps to minimize collisions.

Leave module — excluded. The Leave module (Apply/View/Cancel/Approve) was descoped after testing revealed that sample leave records were inconsistently modified or removed by other concurrent users of the shared demo, making reliable, repeatable assertions impractical in this environment. This is a known limitation of automating against a live, publicly shared instance rather than a dedicated test environment, and would not apply against a private/staging deployment of OrangeHRM.

Test data evolution. Early development used hardcoded test values; these were later refactored into external JSON files (see project commit history) to align with the test data strategy described above.


Future Enhancements

  • OrangeHRM Leave module automation (if run against a dedicated, non-shared environment)
  • API-assisted test setup
  • Accessibility testing
  • Visual regression testing
  • Allure reporting

About

A professional UI test automation framework built with Playwright, JavaScript, and Node.js for OrangeHRM Community Edition, featuring Page Object Model, cross-browser testing, GitHub Actions CI, and automated reporting.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages