API: employee CRUD with validation
App: PeopleDesk HR, a practice HR management portal (OrangeHRM-style). Login: Admin / admin123, or any employee as first.last / Welcome@1 (for example vikram.singh). REST API: tests call it as /api/... through the request fixture or page.request; GET /api lists every endpoint ↗.
Interview scenario
"Cover the employee record end to end at the API: create one, read it back through search, update it, delete it, and prove it is gone. Include the validation failure for a missing last name, and check the field-level details the API returns."
Acceptance criteria
- Log in as Admin / admin123 through POST /api/auth/login.
- POST /api/employees without lastName returns 400 with error.details.lastName.
- Create an employee (firstName, lastName, jobTitle SDET, department Quality Engineering): status 201 and an employee.id.
- GET /api/employees?name=<the name> returns total 1; PATCH the job title to Test Lead and assert it; DELETE the record; GET /api/employees/:id is then 404.
Runs in your browser with a Playwright-compatible API: locators, auto-waiting actions, expect, imports between files and test.extend fixtures. Saved in this browser. Ctrl/⌘ + Enter runs.
Test output
Press Run tests to watch your code drive the practice app in the preview.
Reference solution
Try it yourself first. Then compare with the Playwright solution and the same test in Selenium Java with TestNG.