QA
Mid~25 minReal siteUI + APIpage.requestSession reuse

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.

Build the framework →

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

  1. Log in as Admin / admin123 through the UI and open PIM → Employee List (/web/index.php/pim/viewEmployeeList).
  2. 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.
  3. 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).
  4. 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.
tests/example.spec.tsPlaywright · TypeScript

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.

Real-site labs run on GitHub Actions in a repo created in your name. Sign in to run.Sign in with GitHub

OrangeHRM demo

Real site · runs on GitHub ActionsOpen the site ↗

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

    Your files go to labs/orangehrm-ui-api-employees/ in your repo.

  2. 2. Run

    The Lab run workflow installs Playwright and runs your spec against the real site.

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