Skip to content

kiranrajuv-qa/cypress-api-allure-typescript-circleci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ccee5ab · Nov 8, 2022

History

4 Commits
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Sep 7, 2022
Oct 4, 2022
Sep 7, 2022
Sep 7, 2022
Nov 8, 2022
Sep 7, 2022
Sep 7, 2022

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published