- Introduction
- Tech Details
- Prerequisites
- Setup Instructions
- Running Tests
- API Testing with Playwright
Welcome to the Playwright AutomationTest UI Framework! This repository provides a robust framework for automating end-to-end tests for web applications using Playwright. It also includes support for API testing, making it a comprehensive solution for your testing needs.
- Playwright: A cross-browser automation library for Node.js. It enables you to write reliable end-to-end tests for web applications and websites. With Playwright, you can automate scenarios across multiple browsers (Chromium, Firefox, WebKit) and platforms (Windows, Linux, macOS).
- Allure: A flexible, lightweight multi-language test report tool that provides a concise representation of test results in a neat web report form. It allows everyone participating in the development process to extract maximum useful information from everyday execution of tests.
- Node.js (>= 20.x)
- pnpm (>= 9.x)
- Docker (for containerized execution)
-
Clone the repository:
git clone git@github.com:dipjyotimetia/PlaywrightTestFramework.git cd automation-test-framework
-
Install dependencies:
pnpm install
To run the tests, use the following command:
npm run test:playwright
This repository now includes support for testing REST APIs using Playwright. You can use the provided helper functions to perform HTTP GET, POST, and PATCH requests, and write your own API tests.
The following helper functions are available in src/core/apiHelpers.ts
:
HttpGet(url: string, headers?: Record<string, string>)
: Perform an HTTP GET request.HttpPost(url: string, data: any, headers?: Record<string, string>)
: Perform an HTTP POST request.HttpPatch(url: string, data: any, headers?: Record<string, string>)
: Perform an HTTP PATCH request.
Sample API tests are available in src/tests/api.test.spec.ts
. These tests demonstrate how to use the helper functions to perform API requests and validate the responses.