Skip to content

hoggu-sudo/playwright-ts-api-framework

Repository files navigation

Playwright TypeScript API Automation Framework

CI

Playwright TypeScript API Automation Framework

A production-style API automation framework built using Playwright + TypeScript, designed to demonstrate scalable test architecture, reusable API abstractions, validation layers, payload builders, and end-to-end workflow validation.


📌 Project Goal

This project was built to simulate a real-world API automation framework rather than a collection of isolated test scripts.

It focuses on:

  • reusable API client design
  • clean separation of concerns
  • maintainable test architecture
  • business-layer abstractions
  • structured validation and logging
  • CRUD and lifecycle workflow testing

🚀 Tech Stack

  • Playwright
  • TypeScript
  • Node.js
  • GitHub Actions (CI-ready)
  • DummyJSON API (test API source)

🏗️ Framework Architecture

This framework follows a layered design:

1. Base Client Layer

Handles reusable HTTP methods:

  • GET
  • POST
  • PUT
  • DELETE

2. Business Client Layer

Encapsulates domain-specific API actions:

  • create user
  • get user
  • update user
  • delete user

3. Payload Builder Layer

Generates reusable and customizable request payloads.

4. Validator Layer

Centralizes response assertions and keeps test files clean.

5. Fixture Layer

Provides reusable setup/teardown for test execution.

6. Test Layer

Contains business-oriented API scenarios and flow validations.


📂 Project Structure

playwright-ts-api-framework/
│
├── .github/
│   └── workflows/
│       └── playwright.yml
│
├── src/
│   ├── api/
│   │   ├── clients/
│   │   │   ├── baseClient.ts
│   │   │   └── userClient.ts
│   │   │
│   │   ├── models/
│   │   │   └── user.types.ts
│   │   │
│   │   └── validators/
│   │       └── userValidator.ts
│   │
│   ├── builders/
│   │   └── userPayloadBuilder.ts
│   │
│   ├── config/
│   │   └── env.ts
│   │
│   ├── fixtures/
│   │   └── apiFixtures.ts
│   │
│   └── utils/
│       └── logger.ts
│
├── tests/
│   └── api/
│       └── users/
│           ├── createUser.spec.ts
│           ├── getUser.spec.ts
│           ├── updateUser.spec.ts
│           ├── deleteUser.spec.ts
│           └── userFlow.spec.ts
│
├── playwright.config.ts
├── tsconfig.json
├── package.json
└── README.md

✅ Features Implemented

  • Modular API framework using Playwright + TypeScript
  • Reusable BaseClient for HTTP request abstraction
  • Business-layer UserClient
  • Payload builder pattern for test data generation
  • Validator layer for reusable response assertions
  • Logging for request and response visibility
  • CRUD test coverage
  • End-to-end user lifecycle flow validation
  • Fixture-based reusable setup
  • CI-ready project structure

🧪 Test Scenarios Covered

User API Scenarios

  • Create User
  • Get User
  • Update User
  • Delete User

End-to-End Flow

  • Create → Fetch → Update → Delete user lifecycle validation

▶️ How to Run the Tests

Install dependencies

npm install

Install Playwright

npx playwright install

Run all tests

npx playwright test

Run only API tests

npx playwright test tests/api

Open HTML report

npx playwright show-report

📊 Sample Design Principles Followed

This project was intentionally designed to reflect real-world test engineering practices, including:

  • abstraction over duplication
  • separation of test logic from validation logic
  • reusable setup and teardown
  • cleaner and maintainable code organization
  • scalable structure for future UI / E2E expansion

🔮 Planned Enhancements

Future improvements planned for this framework:

  • Data-driven testing using JSON / CSV / Excel
  • Environment-specific configuration
  • Schema validation layer
  • Authentication flow support
  • UI automation layer using Playwright
  • API + UI end-to-end integration scenarios

👨‍💻 Author

Hemasundar Oggu
SDET | Playwright + TypeScript | API & Distributed Systems


⭐ Why this project matters

This repository is part of a larger effort to build product-company-ready engineering proof, focusing on scalable automation architecture rather than only test case execution.

About

Production-style API automation framework using Playwright + TypeScript with CRUD and flow validationProduction-style API automation framework using Playwright + TypeScript with CRUD and flow validation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors