- Introduction
- Prerequisites
- Getting Started
- Running Tests
- Project Structure
- Configuration
- Continuous Integration
- Reporting
- Other Projects
- Technical Documents
- Contacts
This repository contains a Test Automation Framework built using Cypress and Javascript for automated testing of REST APIs.
-
Clone the repository:
git clone https://github.com/rajatt95/TestAutomationFramework_YT_Rajat_API_Cypress_JS.git
-
Navigate to the project directory:
cd TestAutomationFramework_YT_Rajat_API_Cypress_JS -
Install dependencies:
npm install
npm run cy:testsThe tests follow a modular and maintainable structure:
|-- .github
| |-- workflows
| |-- 01_api_tests.yml
| |-- 02_api_tests_select_env.yml
|-- cypress
| |-- e2e
| |-- tests-reqres
| |-- login.cy.js
| |-- register.cy.js
| |-- users.cy.js
| |-- fixtures
| |-- request-body
| |-- users
| |-- user_create.json
| |-- user_update_patch.json
| |-- user_update_put.json
| |-- schema
| |-- users
| |-- user_create.json
| |-- user_update_patch.json
| |-- user_update_put.json
| |-- reports
| |-- support
| |-- utils
| |-- EndpointUtils.js
| |-- RequestBodyUtils.js
| |-- RequestUtils.js
| |-- ResponseUtils.js
| |-- SchemaUtils.js
| |-- VerificationUtils.js
| |-- commands.js
| |-- e2e.js
|-- .gitignore
|-- cypress.config.js
|-- package.json
cypress/e2e: Contains the actual test files. You can organize your tests into subdirectories as needed.cypress/fixtures: Contains external files (example: user create/update data) that can be used to mock data during tests.cypress/reports: Contains the report for tests (Logs are attached).cypress/support: Contains custom commands and global configuration.cypress/support/utils: Contains the Utilities that provides methods for asserting different conditions on web elements, handling requests and responses.
- Modify
cypress.config.jsonfor Cypress configuration settings. - Customize
commands.jsand other files incypress/supportfor reusable commands.
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.
Mochawesome report (Logs are attached) is stored in the cypress/reports directory.
Feel free to reach out if you have any questions, or suggestions, or just want to chat!
Thanks for visiting my GitHub profile! 😊