GithubHelp home page GithubHelp logo

kiranrajuv-qa / cypress-api-allure-typescript-circleci Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 773 KB

API Automation using Cypress with Typescript and Allure Reports & Circle CI Integration

Shell 0.01% TypeScript 2.85% Python 0.53% JavaScript 96.61%
allure-report api-automation-testing circleci cypress editorconfig eslint prettier typescript vscode junit-report

cypress-api-allure-typescript-circleci's Introduction

cypress-api-allure-typscript-circleci

Prerequisite

  1. Install Node.js Latest LTS Version from https://nodejs.org/en/download/
  2. Install VS Code from https://code.visualstudio.com/download
  3. Follow the installation steps in https://github.com/MihanEntalpo/allure-single-html-file#installation to merge allure report to single file

First Time Setup

  • Clone the repo
  • Run npm ci command to install all dependencies

Formatting files with Prettier

  • To auto-format the files
    npx prettier --write .
  • To check the file format
    npx prettier --check .

Writing the tests

  • Add API configuration in cypress/fixtures/tests folder which has below params
    • API/Test Name
    • Comma separated roles
    • API Method
    • API URI
    • Headers
    • API Payload as JSON file which is under cypress/fixtures/testData folder
    • Ignore flag
  • Configure the API base URL in cypress/support/constants/<track_name>/baseUrl.ts
  • Configure the roles in cypress/fixtures/configs/roles.json
  • Add RBAC resource mapping in cypress/fixtures/rbac/resource_mappings.json
  • Create test spec file in cypress/e2e folder
    • Import methods from requestHelper.ts which would run and validate generic tests by default
    • Add API specific tests using cy.request()

Running the tests

Utility Functions

  • APP

    • Login to the app and extract JWT token
    • Extract user details from /user/details API
    • Extract customer contracts from /accounts/info API
  • Common

    • Verify duplicates in an array of strings/objects
    • Match API response with JSON schema
    • (Deep) compare JSON objects
    • Verify the list of strings are in ascending/descending order
    • Generate random number
    • Generate random string
  • API Requests (from JSON test template)

    • Prepare Request Headers dynamically
    • Prepare Request Payload dynamically
    • Generate dynamic tests for Missing JWT Token
    • Generate dynamic tests for Invalid JWT token
    • Generate dynamic tests for Missing Authorization Header
    • Generate dynamic tests for Missing puid/cuid/customerId headers
    • Generate dynamic tests for Invalid puid/cuid/customerId header values
    • Generate dynamic tests for RBAC Tests

Allure Reports

  • Clear Report
    npm run report:clear
  • Generate Report
    npm run report:generate
  • Open Report
    npm run report:open

cypress-api-allure-typescript-circleci's People

Contributors

kiranrajuv-qa avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lienngo-nvg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.