postmantojest
v1.1.5
Published
Generate Postman collection to Jest page object functions
Downloads
8
Maintainers
Readme
Postman to JEST (previously jestpagenerator)
Hello, 👋
Postman to JEST is a command-line tool that generates Jest page object files based on data from a JSON Postman collection file.
This tool creates separate .js or .ts files for each folder in your collection, with each folder becoming a single .js or .ts script, and each endpoint within the folders becomes an export function that can be used in your test files.
Support Javascript & TypeScript
- Javascript
- TypeScript
Installation
To use Postman to JEST, you must install it globally using npm:
npm install -g postmantojest
Usage
To generate Jest page object files (and folders), run the following command:
postmantojest path/to/file.json
that will generate .js or .ts files based on your prefered language, inside pages folder
Notes
- This is just a basic converter, and you may need to adjust the code if your endpoints are complex, but at least now we don't have to create the script from scratch ;)
- Remember to create a folder called files in your project's root directory and put all the files inside it if your endpoints contain files, because all files will be hardcode to ./files/yourfilename.extension
- If you need sample JEST boilerplate go here for Javascript, or here for TypeScript
License
This project is licensed under the MIT License - see the LICENSE file for details.