Modular API testing framework built on Playwright Test with TypeScript and JSON schema validation.
- Playwright Test Runner (API testing)
- TypeScript
- AJV (JSON schema validation)
- Node.js
API_Automation_Framework/
|-- .github/
| |-- workflows/
| |-- playwright-api.yml
|-- Jenkinsfile
|-- config/
| |-- env.ts
|-- data/
| |-- users.json
|-- docs/
| |-- planning/
|-- schemas/
| |-- user.schema.json
|-- tests/
| |-- users.api.spec.ts
|-- utils/
| |-- apiContext.ts
| |-- logger.ts
| |-- schemaValidator.ts
| |-- testDataGenerator.ts
|-- playwright.config.ts
|-- package.json
|-- README.md
git clone https://github.com/prasad291024/playwright-api-automation-framework.git
cd playwright-api-automation-framework
npm install
npx playwright install
npm test
npm test: run all Playwright API testsnpm run test:dev: run tests withTEST_ENV=devnpm run test:staging: run tests withTEST_ENV=stagingnpm run test:prod: run tests withTEST_ENV=prodnpm run lint: lint TypeScript filesnpm run typecheck: TypeScript typechecknpm run format: format supported filesnpm run format:check: verify formatting
config/env.ts is the single source of truth.
- Supported environments:
dev,staging,prod - Example:
TEST_ENV=staging npm test
- The default
devbase URL is JSONPlaceholder (https://jsonplaceholder.typicode.com). - JSONPlaceholder accepts most POST payloads and returns
201even for invalid data. Tests are written accordingly.
The GitHub Actions workflow is split into staged jobs:
setuplinttypechecktest
Each run installs dependencies, validates code quality, executes Playwright API tests, and uploads the HTML report as an artifact.
The repository also includes a Jenkinsfile for Jenkins-based CI on a Windows agent.
The Jenkins pipeline runs:
CheckoutInstallLintTypecheckTestPublish Report
Jenkins is configured to send Slack notifications for build success and failure.
Slack messages include:
- job name
- build number
- branch
- failing stage on failure
- Jenkins build URL
- Playwright report URL
- Cross-platform npm test scripts using
cross-env - TypeScript, ESLint, and Prettier tooling baseline
- Unified environment configuration in
config/env.ts - CI quality gates in GitHub Actions (
lintandtypecheck) - Jenkins pipeline support with HTML report publishing
- Slack notification support for Jenkins builds
- Cleanup of empty placeholder files
MIT License
Prasad