Skip to content

dhirajraut1/postman-to-playwright

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postman to Playwright

postman-to-playwright2

⚙️ Work in Progress: This project is still under active development. Contributions, feedback, and ideas are highly encouraged!

A simple tool that automatically converts Postman collections into Playwright API tests. It extracts variables, headers, and request data - generating ready-to-run Playwright test files and environment variables for seamless API testing setup.


🚀 Features

  • 🔄 Convert Postman Collections directly into Playwright API tests.
  • 🌍 Extract Environment Variables - automatically adds Postman variables into a .env file.
  • 🧾 Preserve Headers & Payloads from your Postman requests.
  • 🧠 Auto-generate Tests using Playwright’s built-in test runner and assertions.
  • 🧰 Custom Helpers for assertions and API requests (planned).

Installation

You can try out at Postman to Playwright without any local installations. Might be slow since it is hosted on free-tier.

npm install

Usage

  1. Run the following command to start the application:
npm start
  1. Open http://localhost:3000 to view the page
  2. Upload a Postman Collection JSON file
  3. Click on Convert Collection
  4. Wait for conversion and click on Download ZIP
  5. Extract the ZIP and follow the instructions in the README file
image

🧪 Example Output

Input: Postman request:

{
  "name": "Get All Products",
  "request": {
    "method": "GET",
    "header": [],
    "url": {
      "raw": "{{baseUrl}}/api/products/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "products",
        ""
      ]
    }
  },
  "response": []
}

Generated Playwright Test:

import { test, expect, request } from '@playwright/test';
import { post, get, put, del } from "@helpers/requestHelper";

test('Get All Products', async ({ request }) => {
  const headers = {};
  const data = {};

  const start = Date.now();
  const response = await post(request, `${baseUrl}/api/products/`, data, headers);
  const responseTime = Date.now() - start;
  expect(response.ok()).toBeTruthy();
  expect(responseTime).toBeLessThan(2000);

  // No Postman tests found
});

🤝 Contributing

Contributions are welcome! Here’s how you can help:

  1. Clone the repository
  2. Create a new branch (feature/my-feature)
  3. Commit your changes
  4. Open a pull request 🎉

If you find a bug or want to suggest a feature, open an issue.


🧭 Future Vision

This tool aims to make transitioning from Postman to Playwright frictionless — especially for QA engineers and developers building automated API testing pipelines.


🧑‍💻 Author

Dhiraj Raut 💼 LinkedIn

About

A tool to convert the Postman collection to Playwright API tests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published