|
| 1 | +<!-- |
| 2 | + #/** |
| 3 | + # * @author Rajat Verma |
| 4 | + # * Email: rajatvermaa95@gmail.com |
| 5 | + # * GitHub Profile: https://github.com/rajatt95 |
| 6 | + # * GitHub Page: https://rajatt95.github.io/ |
| 7 | + # * LinkedIn: https://www.linkedin.com/in/rajatt95/ |
| 8 | + # * Topmate: https://topmate.io/rajatt95 |
| 9 | + # * Telegram: https://t.me/rajatt95 |
| 10 | + # * Instagram: https://www.instagram.com/rajattvermaa95/ |
| 11 | + # * YouTube: https://www.youtube.com/@rajatt95 |
| 12 | + # * WhatsApp Community: https://chat.whatsapp.com/DVRP0ViD0YwELUKF2XMJHy |
| 13 | + # * WhatsApp Channel: https://whatsapp.com/channel/0029Va9XXMhJ93waOU5Xer3r |
| 14 | + # */ |
| 15 | + #/***************************************************/ |
| 16 | +--> |
| 17 | +--- |
| 18 | +# 💻 Test Automation Framework | API |
| 19 | + |
| 20 | +[](https://playwright.dev/) |
| 21 | +[](https://www.typescriptlang.org/) |
| 22 | + |
| 23 | + |
| 24 | +[](https://code.visualstudio.com/) |
| 25 | +[](https://www.npmjs.com/package/playwright-html-reporter) |
| 26 | +[](https://github.com/features/actions) |
| 27 | + |
| 28 | +## 📑 Table of Contents |
| 29 | +<!-- # - [Video Tutorial](#video-tutorial) --> |
| 30 | +- [Introduction](#introduction) |
| 31 | +- [Prerequisites](#prerequisites) |
| 32 | +- [Getting Started](#getting-started) |
| 33 | +- [Running Tests](#running-tests) |
| 34 | +- [Project Structure](#project-structure) |
| 35 | +- [Configuration](#configuration) |
| 36 | +- [Continuous Integration](#continuous-integration) |
| 37 | +- [Reporting](#reporting) |
| 38 | +- [Other Projects](#other-projects) |
| 39 | +- [Technical Documents](#technical-documents) |
| 40 | +- [Contacts](#contacts) |
| 41 | + |
| 42 | +## 📖 Introduction |
| 43 | +This repository contains a Test Automation Framework built using Playwright and Typescript for automated testing of REST APIs. |
| 44 | + |
| 45 | +<!-- ## 🎥 Video Tutorial |
| 46 | +
|
| 47 | +<a href="https://www.youtube.com/watch?v=g0nG6aPbpl4&list=PLrBBHmoBFxBUu9G7haETpa0B03H9GnfKX"> <img src="https://img.youtube.com/vi/g0nG6aPbpl4/0.jpg" alt="Test Automation Framework | WEB | Cypress + JS" width="200"> </a> |
| 48 | +
|
| 49 | +Click on the image above to watch the tutorials. --> |
| 50 | + |
| 51 | +## 🛠️ Prerequisites |
| 52 | + |
| 53 | +- [](https://nodejs.org/) (v18.16.1 or higher recommended) |
| 54 | +- [](https://www.npmjs.com/) (v9.5.1 or higher recommended) |
| 55 | + |
| 56 | +## ▶️ Getting Started |
| 57 | + |
| 58 | +1. Clone the repository: |
| 59 | + |
| 60 | + ```bash |
| 61 | + git clone https://github.com/rajatt95/TestAutomationFramework_YT_Rajat_API_Playwright_TS.git |
| 62 | + ``` |
| 63 | + |
| 64 | +2. Navigate to the project directory: |
| 65 | + |
| 66 | + ```bash |
| 67 | + cd TestAutomationFramework_YT_Rajat_API_Playwright_TS |
| 68 | + ``` |
| 69 | + |
| 70 | +3. Install dependencies: |
| 71 | + |
| 72 | + ```bash |
| 73 | + npm install |
| 74 | + ``` |
| 75 | + |
| 76 | +## 🚀 Running Tests |
| 77 | + |
| 78 | + ```bash |
| 79 | + npm run playwright:tests |
| 80 | + ``` |
| 81 | + |
| 82 | +## 📁 Project Structure |
| 83 | + |
| 84 | +The tests follow a modular and maintainable structure: |
| 85 | + |
| 86 | +``` |
| 87 | +|-- .github |
| 88 | +| |-- workflows |
| 89 | +| |-- 01_api_tests.yml |
| 90 | +| |-- 02_api_tests_select_env.yml |
| 91 | +|-- test-data |
| 92 | +| |-- login |
| 93 | +| |-- login-successful.json |
| 94 | +| |-- login-unsuccessful.json |
| 95 | +| |-- register |
| 96 | +| |-- register-successful.json |
| 97 | +| |-- register-unsuccessful.json |
| 98 | +| |-- users |
| 99 | +| |-- user_create.json |
| 100 | +| |-- user_update_patch.json |
| 101 | +| |-- user_update.json |
| 102 | +|-- tests-reqres |
| 103 | +| |-- login.spec.ts |
| 104 | +| |-- register.spec.ts |
| 105 | +| |-- users.spec.ts |
| 106 | +|-- utils |
| 107 | +| |-- EndpointUtils.ts |
| 108 | +| |-- RequestBodyUtils.ts |
| 109 | +| |-- RequestUtils.ts |
| 110 | +| |-- ResponseUtils.ts |
| 111 | +| |-- TokenUtils.ts |
| 112 | +| |-- VerificationUtils.ts |
| 113 | +|-- .gitignore |
| 114 | +|-- package.json |
| 115 | +|-- playwright.config.ts |
| 116 | +``` |
| 117 | + |
| 118 | +- `playwright-report`: Contains the HTML report for tests (Logs are attached). |
| 119 | +- `test-data`: Contains external files (example: user create/update data) that can be used to mock data during tests. |
| 120 | +- `tests-reqres`: Contains the actual test files. You can organize your tests into subdirectories as needed. |
| 121 | +- `utils`: Contains the Utilities that provides methods for asserting different conditions on web elements, handling requests and responses. |
| 122 | + |
| 123 | +## ⚙️ Configuration |
| 124 | + |
| 125 | +- Modify `playwright.config.ts` for playwright configuration settings such as |
| 126 | + - `baseURL` |
| 127 | + - `testDir` |
| 128 | + - `reporter` |
| 129 | + |
| 130 | +## 🔄 Continuous Integration |
| 131 | + |
| 132 | +This project is configured for CI using Github Actions. Check the configurations in `.github/workflows/*.yml`. |
| 133 | + |
| 134 | +- `01_api_tests.yml`: This workflow executes tests in pre-defined environment PROD. |
| 135 | +- `02_api_tests_select_env.yml`: This workflow will first ask User to select the environment (DEV / Pre-PROD / PROD) for tests execution. |
| 136 | + |
| 137 | +## 📊 Reporting |
| 138 | + |
| 139 | +Playwright HTML report (Logs are attached) is stored in the `playwright-report` directory. |
| 140 | + |
| 141 | +## 🔭 Other Projects |
| 142 | + |
| 143 | +- [](https://github.com/stars/rajatt95/lists/programming-language-java) - |
| 144 | + [](https://github.com/stars/rajatt95/lists/selenium-automation-frameworks) |
| 145 | + [](https://github.com/stars/rajatt95/lists/appium-automation-frameworks) |
| 146 | + [](https://github.com/stars/rajatt95/lists/restassured-automation-framework) |
| 147 | + |
| 148 | +- [](https://github.com/stars/rajatt95/lists/programming-language-javascript) - |
| 149 | +[](https://github.com/stars/rajatt95/lists/cypress-automation-frameworks) |
| 150 | +[](https://github.com/stars/rajatt95/lists/playwright-automation-frameworks) |
| 151 | + |
| 152 | +- [](https://github.com/stars/rajatt95/lists/programming-language-python) - |
| 153 | + [](https://github.com/stars/rajatt95/lists/requests-automation-framework) |
| 154 | + |
| 155 | +## 📄 Technical Documents |
| 156 | + |
| 157 | +- [](https://drive.google.com/drive/folders/1tne9pZjgWvfrS0l9tVHs6k1jnQHpTLoA?usp=sharing) |
| 158 | +- [](https://github.com/rajatt95/Documents) |
| 159 | + |
| 160 | +## 📧 Contacts |
| 161 | + |
| 162 | +- [](mailto:rajatvermaa95@gmail.com) |
| 163 | +- [](https://github.com/rajatt95) |
| 164 | +- [](https://rajatt95.github.io/) |
| 165 | +- [](https://www.linkedin.com/in/rajatt95) |
| 166 | +- [](https://topmate.io/rajatt95) |
| 167 | +- [](https://t.me/rajatt95) |
| 168 | +- [](https://www.instagram.com/rajattvermaa95/) |
| 169 | +- [](https://www.youtube.com/@rajatt95) |
| 170 | +- [](https://chat.whatsapp.com/LP20xMGvxnEL88GoB58bo1) |
| 171 | +- [](https://whatsapp.com/channel/0029Va9XXMhJ93waOU5Xer3r) |
| 172 | + |
| 173 | +Feel free to reach out if you have any questions, or suggestions, or just want to chat! |
| 174 | + |
| 175 | +Thanks for visiting my GitHub profile! 😊 |
| 176 | + |
| 177 | +<p align="left"> <img src="https://komarev.com/ghpvc/?username=rajatt95&label=Profile%20views&color=0e75b6&style=flat" alt="rajatt95" /> </p> |
0 commit comments