Comparing version
{ | ||
"name": "postwright", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Convert Postman Collections to Playwright scripts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
 | ||
- [Installation](##installation) | ||
- [Usage](##usage) | ||
- [What does it do presently?](##what-does-it-do-presently) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [What does it do presently?](#what-does-it-do-presently) | ||
@@ -41,5 +41,8 @@ ## Convert your postman collections to playwright scripts. | ||
> [!NOTE] | ||
> The ability to convert without specifying an output for Typescript has not been implemented. | ||
- Create a folder and navigate into it then run any of the following: | ||
- `postwright -c <location-of-saved-postman-collection> -f ts` | ||
- `postwright --convert <location-of-saved-postman-collection> --format ts` | ||
- `postwright convert <location-of-saved-postman-collection> -f ts` | ||
- You can run any of the following from any location in your terminal. | ||
@@ -46,0 +49,0 @@ - `postwright -c <location-of-saved-postman-collection> -o <preferred-location-to-save-the-converted-script> -f ts` |
@@ -7,3 +7,3 @@ const fs = require("fs").promises; | ||
postmanCollectionPath, | ||
outputDir = process.cwd(), | ||
outputDir = path.join(process.cwd(), 'test'), | ||
format = "js"// Default to 'js' (JavaScript) | ||
@@ -20,2 +20,3 @@ ) { | ||
await processCollection(postmanCollection, outputDir, format); | ||
await createPackageJson(outputDir); | ||
@@ -59,2 +60,28 @@ // Create tsconfig.json if TypeScript is chosen | ||
async function createPackageJson(outputDir){ | ||
const packageJsonPath = path.join(outputDir, 'package.json'); | ||
const packageJsonContent = { | ||
"name": "postman-to-playwright", | ||
"version": "1.0.0", | ||
"description": "Converts postman collection to playwright scripts", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npx playwright test" | ||
}, | ||
"devDependencies": { | ||
"playwright": "latest", | ||
"@playwright/test": "latest" | ||
} | ||
} | ||
await fs.writeFile( | ||
packageJsonPath, | ||
JSON.stringify(packageJsonContent, null, 2), | ||
"utf8" | ||
); | ||
console.log("package.json created."); | ||
} | ||
module.exports = { convertPostmanToPlaywright }; |
@@ -28,3 +28,3 @@ const fs = require("fs").promises; | ||
async function saveVariables(outputDir, format) { | ||
async function saveVariables(outputDir) { | ||
if (!outputDir) { | ||
@@ -31,0 +31,0 @@ console.error("Output directory is undefined"); |
122690
0.7%354
6.95%62
5.08%