This project contains Playwright automation tests for the JSONBin.io API. JSONBin.io provides a simple REST interface to store & retrieve JSON data from the cloud, helping developers focus on app development by taking care of their database infrastructure.
API Documentation: https://jsonbin.io/api-reference
For automation tests architecture we use Page Object Pattern. All necessary files are placed in tests directory, which primarily includes:
testsdirectory with test cases,constantsdirectory with enums and static values used across tests,utilshelpful functions and tools to support test execution,schemaswith objects for asserting response body,
-
Create your local environment file:
cp env/.env.example env/.env.local cp env/.env.example env/.env.prod
-
Configure your variables in
env/.env.localandenv/.env.prod:BASE_URL=https://api.jsonbin.io ACCESS_KEY=....
-
Default: Uses
env/.env.prodif no environment is specified -
Custom: Set
ENVIRONMENTvariable to use specific config:# macOS/Linux export ENVIRONMENT=local # Windows PowerShell $env:ENVIRONMENT='local'
-
Verify you environment variable:
# macOS/Linux echo $ENVIRONMENT # Windows PowerShell echo $env:ENVIRONMENT
Note: Never commit your .env files to version control. Only commit the .env.example template for team collaboration.
To install Playwright and it's browsers
npm install
npx playwright installTo run all tests
npm run testTo run smoke tests:
npm run test:smokeWe use a mix of Husky, ESLint and Prettier within our repository to help enforce consistent coding practices.
# Check for errors
npm run lint
# Fix errors automatically
npm run lint:fix# Check formatting
npm run prettier
# Fix formatting
npm run prettier:fixThe project uses different reporters based on the environment:
local development:listreporter for console outputCI/CD:htmlreporter for detailed HTML reportstrace collection: Automatically captures traces on test failures for debugging
Generated trace files with all test execution steps can be uploaded to Trave Viewer Page for detailed debugging and analysis of test failures.