Skip to content

This project is a comprehensive test automation framework built using Playwright and TypeScript. It supports both API and UI testing with a well-structured architecture.

Notifications You must be signed in to change notification settings

lkumarra/playwright-automation

Repository files navigation

Playwright Automation Framework

This project is a comprehensive test automation framework built using Playwright and TypeScript. It supports both API and UI testing with a well-structured architecture.

Project Structure

├── apis/                   # API endpoints implementation
│   ├── books-api.ts
│   └── index.ts
├── constants/             # Constant values and methods
│   ├── constants.ts
│   └── methods.ts
├── fixtures/             # Test fixtures for API and UI tests
│   ├── api-fixtures.ts
│   └── test-fixtures.ts
├── helpers/             # Helper utilities
│   └── api-client/
│       └── api-client.ts
├── models/              # Data models
│   ├── books-model.ts
│   └── cred-model.ts
├── pages/              # Page Object Models
│   ├── cred-page.ts
│   ├── login-page.ts
│   └── manager-page.ts
└── tests/              # Test suites
    ├── api-tests/
    │   └── books-api.spec.ts
    └── ui-tests/
        ├── login-page.spec.ts
        └── manager-page.spec.ts

Features

  • TypeScript Support: Fully typed codebase for better maintainability
  • API Testing: Dedicated structure for API automation testing
  • UI Testing: Page Object Model implementation for UI testing
  • Parallel Execution: Tests can run in parallel for faster execution
  • HTML Reports: Built-in HTML reporter for better test results visualization
  • Fixtures: Custom fixtures for both API and UI tests
  • Modular Architecture: Well-organized code structure with separation of concerns

Prerequisites

  • Node.js (Latest LTS version recommended)
  • npm or yarn package manager

Installation

  1. Clone the repository
  2. Install dependencies:
npm install

Running Tests

To run all tests:

npx playwright test

To run specific test files:

npx playwright test tests/api-tests/books-api.spec.ts

To run UI tests:

npx playwright test tests/ui-tests/

Configuration

The project uses playwright.config.ts for configuration with the following key settings:

  • Parallel test execution enabled
  • HTML reporter
  • Retry mechanism for CI environment
  • Custom timeout settings

Project Components

API Testing

  • Custom API client implementation
  • Response models and types
  • API endpoints segregation
  • API fixtures for better test organization

UI Testing

  • Page Object Model implementation
  • Reusable page components
  • UI test fixtures
  • Login and manager page tests

Reports

Test reports are generated in HTML format and can be found in:

playwright-report/index.html

Development

  • Use TypeScript for all new code
  • Follow the existing project structure for new tests
  • Utilize the provided helpers and utilities
  • Implement proper page objects for new UI tests
  • Use models for API response handling

License

Private repository - All rights reserved

About

This project is a comprehensive test automation framework built using Playwright and TypeScript. It supports both API and UI testing with a well-structured architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published