API testing framework built with Playwright for testing the Restful Booker API.
api-testing/
├── api/ # API client classes
│ ├── authApi.ts # Authentication API
│ └── bookingApi.ts # Booking CRUD operations
├── config/ # Configuration files
│ ├── endpoints.ts # API endpoints
│ └── constants.ts # Status codes & constants
├── models/ # Data models and interfaces
│ └── booking.model.ts # Booking & Auth models
├── helpers/ # Helper utilities
│ └── testData.ts # Test data factory
├── tests/ # Test files
│ ├── auth.spec.ts # Authentication tests
│ └── booking.spec.ts # Booking CRUD tests
├── playwright.config.ts # Playwright configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
- Install dependencies:
npm install- Install Playwright:
npx playwright installRun all tests:
npm testRun specific test file:
npx playwright test tests/auth.spec.ts
npx playwright test tests/booking.spec.tsRun tests in UI mode:
npm run test:uiView test report:
npm run test:reportThis project includes Allure reporting for detailed test reports.
After running tests, generate and open the Allure report:
# Run tests and open Allure report
npm run test:allureOr run commands separately:
# Generate report from results
npm run allure:generate
# Open the report in browser
npm run allure:open
# Or serve the report (alternative)
npm run allure:serveAfter pushing to GitHub:
- Go to the Actions tab in your repository
- Click on the latest workflow run
- Download artifacts:
allure-report- Complete Allure HTML reportplaywright-report- Standard Playwright reportallure-results- Raw test results
- Create auth token with valid credentials
- Fail with invalid credentials (negative)
- Fail with missing username (negative)
- Check API health (ping)
- Get all bookings
- Create new booking
- Get booking by ID
- Update booking completely (PUT)
- Partially update booking (PATCH)
- Delete booking
- Return 404 for non-existent booking (negative)
- Return 403 for updating without authentication (negative)
- Return 403 for deleting without authentication (negative)
This framework tests the Restful Booker API: https://restful-booker.herokuapp.com/apidoc/index.html
Base URL: https://restful-booker.herokuapp.com
POST /auth- Create authentication tokenGET /booking- Get all bookingsPOST /booking- Create a new bookingGET /booking/:id- Get booking by IDPUT /booking/:id- Update bookingPATCH /booking/:id- Partial update bookingDELETE /booking/:id- Delete bookingGET /ping- Health check