rajatt95 / TestAutomationFramework_YT_Rajat_API_Playwright_JS

This project is a Test Automation Framework built using Playwright and Javascript for automated testing of REST APIs.

Home Page:https://www.youtube.com/@rajatt95

Repository from Github https://github.comrajatt95/TestAutomationFramework_YT_Rajat_API_Playwright_JSRepository from Github https://github.comrajatt95/TestAutomationFramework_YT_Rajat_API_Playwright_JS


πŸ’» Test Automation Framework | API

Playwright JavaScript

VS Code Playwright HTML Reporter GitHub Actions

πŸ“‘ Table of Contents

πŸ“– Introduction

This repository contains a Test Automation Framework built using Playwright and Javascript for automated testing of REST APIs.

πŸ› οΈ Prerequisites

  • Node.js (v18.16.1 or higher recommended)
  • npm (v9.5.1 or higher recommended)

▢️ Getting Started

  1. Clone the repository:

    git clone https://github.com/rajatt95/TestAutomationFramework_YT_Rajat_API_Playwright_JS.git
  2. Navigate to the project directory:

    cd TestAutomationFramework_YT_Rajat_API_Playwright_JS
  3. Install dependencies:

    npm install

πŸš€ Running Tests

npm run playwright:tests

πŸ“ Project Structure

The tests follow a modular and maintainable structure:

|-- .github
|     |-- workflows
|          |-- 01_api_tests.yml
|          |-- 02_api_tests_select_env.yml
|-- test-data
|     |-- login
|          |-- login-successful.json
|          |-- login-unsuccessful.json
|     |-- register
|          |-- register-successful.json
|          |-- register-unsuccessful.json
|     |-- users
|          |-- user_create.json
|          |-- user_update_patch.json
|          |-- user_update_put.json
|-- tests-reqres
|     |-- login.spec.js
|     |-- register.spec.js
|     |-- users.spec.js
|-- utils
|     |-- EndpointUtils.js
|     |-- RequestBodyUtils.js
|     |-- RequestUtils.js
|     |-- ResponseUtils.js
|     |-- VerificationUtils.js
|-- .gitignore
|-- package.json
|-- playwright.config.js
  • playwright-report: Contains the HTML report for tests (Logs are attached).
  • test-data: Contains external files (example: user create/update data) that can be used to mock data during tests.
  • tests-reqres: Contains the actual test files. You can organize your tests into subdirectories as needed.
  • utils: Contains the Utilities that provides methods for asserting different conditions on web elements, handling requests and responses.

βš™οΈ Configuration

  • Modify playwright.config.js for playwright configuration settings such as
    • baseURL
    • testDir
    • reporter

πŸ”„ Continuous Integration

This project is configured for CI using Github Actions. Check the configurations in .github/workflows/*.yml.

  • 01_api_tests.yml: This workflow executes tests in pre-defined environment PROD.
  • 02_api_tests_select_env.yml: This workflow will first ask User to select the environment (DEV / Pre-PROD / PROD) for tests execution.

πŸ“Š Reporting

Playwright HTML report (Logs are attached) is stored in the playwright-report directory.

πŸ”­ Other Projects

  • Java - Selenium Appium Rest Assured

  • JavaScript - Cypress Playwright

  • Python - Requests

πŸ“„ Technical Documents

  • Google Drive
  • GitHub Repository

πŸ“§ Contacts

  • Email
  • GitHub Profile
  • GitHub Page
  • LinkedIn
  • Topmate
  • Telegram
  • Instagram
  • YouTube
  • WhatsApp Community
  • WhatsApp Channel

Feel free to reach out if you have any questions, or suggestions, or just want to chat!

Thanks for visiting my GitHub profile! 😊

rajatt95

About

This project is a Test Automation Framework built using Playwright and Javascript for automated testing of REST APIs.

https://www.youtube.com/@rajatt95


Languages

Language:JavaScript 100.0%