UI + API: the employee list agrees with the PIM REST API
Site: https://opensource-demo.orangehrmlive.com, the real OrangeHRM open-source demo at opensource-demo.orangehrmlive.com. Runs on GitHub Actions in your repo. Login: Admin / admin123.
Interview scenario
"OrangeHRM's screens are driven by its own REST API under /web/index.php/api/v2. Prove the two layers agree: log in through the UI, read the Employee List, and check it against GET /api/v2/pim/employees using the browser's session. Then show the API refuses a caller with no session. The demo is shared with the whole internet, so expect the numbers to move a little between two calls."
Acceptance criteria
- Log in as Admin / admin123 through the UI and open PIM → Employee List (/web/index.php/pim/viewEmployeeList).
- Call GET /web/index.php/api/v2/pim/employees?limit=50&offset=0&includeEmployees=onlyCurrent with page.request (it carries the browser's cookies) and assert the response is OK with a non-empty data array whose items have empNumber and firstName.
- Read the "(N) Records Found" text on the list and assert it matches meta.total from the API (allow a drift of a few records: other people add employees while your test runs).
- In a second test, call the same endpoint with the plain request fixture (no session, maxRedirects: 0) and assert it is refused: status 401, or a 302 to the login page.
Runs with real Playwright on GitHub Actions in your own repo: the files are committed, the Lab run workflow starts with BASE_URL=https://opensource-demo.orangehrmlive.com, and the results come back here. Saved in this browser. Ctrl/⌘ + Enter runs.
https://opensource-demo.orangehrmlive.com can't be embedded here, so your code runs with real Playwright and Chromium on a GitHub Actions runner in your repo. Explore the site in a new tab while you write the test. Login: Admin / admin123.
- 1. Commit
Your files go to labs/orangehrm-ui-api-employees/ in your repo.
- 2. Run
The Lab run workflow installs Playwright and runs your spec against the real site.
- 3. Verify
Results, assertion steps and the HTML report come back; the checks grade your code.
Test output
Press Run on GitHub to commit your code and run it against the real site. Results appear here in a few minutes.
Reference solution
Try it yourself first. Then compare with the Playwright solution and the same test in Selenium Java with TestNG.