This project implements an automated API test scenario using Playwright and BDD. It validates a user and order workflow against two mock services running in Docker containers on a Linux environment.
- Retrieve an existing user (id = 1)
- Retrieve active orders for the user
- Create a new order for the user
- Validate HTTP responses and response contracts
- Node.js
- TypeScript
- Express (mock services)
- Playwright (API testing)
- BDD-style tests using Playwright (Given/When/Then semantics)
- Docker & Docker Compose
- services/
- user-service/ # Mock user API
- order-service/ # Mock order API
- tests/
- user-orders.spec.ts # API test (BDD-style)
- validators/ # Interface-based validators
- playwright.config.ts
Run from the project root:
docker compose upLeave the containers running.
In another terminal, from the project root:
npm testUser Service: http://localhost:3001
Order Service: http://localhost:3002
This project demonstrates BDD-style step definitions using Given/When/Then to clearly express test intent. The BDD approach is implemented using Given/When/Then semantics within Playwright tests. The focus is on test structure, assertions and contract validation rather than feature file execution.