QA
Junior~10 minAPI testingQuery paramsArray assertions404 handling

API: product search, sorting and a 404

App: TrendKart, a practice fashion marketplace (Myntra-style). Login: Guest checkout works; members: arya@trendkart.test / Trendy@123 or register. REST API: tests call it as /api/... through the request fixture or page.request; GET /api lists every endpoint ↗.

Next scenario →

Interview scenario

"The search API backs the whole listing page. Test GET /api/products: 'shirt' returns 5 products whose names all contain Shirt, sort=price_asc comes back ascending, a product can be fetched by id, and an unknown id is a 404."

Acceptance criteria

  1. GET /api/products?q=shirt: total 5 and every item name contains 'shirt' (case-insensitive).
  2. GET /api/products?q=shirt&sort=price_asc: prices ascend.
  3. GET /api/products/104: name Men Printed Round Neck T-shirt, price 399, sizes include M.
  4. GET /api/products/999: status 404, error.code not_found.
tests/example.spec.tsPlaywright · TypeScript

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.

Save your lab code to a GitHub repo in your name, automatically after every run.Sign in with GitHub
/sandbox/trendkartOpen ↗

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.