JSPM

postman-to-cypress

1.0.3-Canary.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q27787F
  • License MIT

This package will be able to consume postman collection

Package Exports

  • postman-to-cypress
  • postman-to-cypress/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postman-to-cypress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Header Image Build CI Status Build CI Release CodeQL

Postman to Cypress Converter

This tool converts Postman collections and environments into Cypress test files. It reads a Postman collection and environment JSON file, processes the items and variables, and generates Cypress test files in a specified output directory.

Features

  • Converts Postman collections to Cypress tests
  • Saves the converted environment variables to a cypress.env.json file.
  • Resolves environment variables in requests
  • Supports custom output directories and file naming conventions.

Usage

Prepping your collection and environment files

DON'Ts

[!CAUTION]

  • Nesting of collections into multiple directory as shown below
  • Naming request as endpoint complete path or uri
  • Refrain from complex request chaining
folder
├── folder
│   ├── collection
│   └── collection
└── folder
    ├── collection
    ├── collection
    └── folder
        ├── collection
        ├── collection
        ├── collection
        └── folder
            ├── collection
            ├── collection
            └── collection

DOs

[!TIP]

  • Nest collection in the single directory/folder as shown below
  • Name request/collection as intended functionality wish
folder (testsuite name: "Suite for Sales Endpoint")
├── collection (testcase name: "Get Address")
├── collection
└── collection

Converting Postman Collection/Environment to Cypress Test/Cypress.env.json

Installation

npm i -g postman-to-cypress

👉 Help

pcy -h

👉 To Convert Collection/Collection Variables

pcy convert -c /user/collection -cy

👉 To Convert Collection/Collection Variables and Providing a Directory

pcy convert -c /user/collection -cy --output [directory]

👉 To Convert Collection with Default Output Directory (Cypress/Integration)

pcy convert -c /user/collection -e /user/environment -cy

👉 To Convert Collection and Providing a Directory

pcy convert -c /user/collection -e /user/environment -cy --output [directory]

👉 To Generate Cypress.env.json from Environment File

pcy generate-env -e /user/environment --output [directory]

For more information on how to use Cypress.env() for API testing see

Contribution guidelines for this project

Requirements

  • Node.js (>= 20.x)
  • npm (>= 10.x)

License

postman-to-cypress is MIT Licensed