Convert Cucumber feature files to Playwright test scripts.
To install this package, run:
npm install cucumber-to-playwright --save-dev
If you want to use the library globally, you can install it using:
npm install -g cucumber-to-playwright
You can use cucumber-to-playwright
directly from the command line with the fts
command:
fts <inputFilePath> <outputFilePath>
# OR
cucumber-to-playwright <inputFilePath> <outputFilePath>
<inputFilePath>
: Path to the input Cucumber.feature
file.<outputFilePath>
: Path to the output Playwright test file.
For example:
fts ./features/myFeature.feature ./tests/myFeature.spec.js
This will read the feature file at ./features/myFeature.feature
and convert it to a Playwright test at ./tests/myFeature.spec.js
.
Add a script in your project's package.json
:
{
"scripts": {
"test:convert": "fts"
}
}
Then, you can run the conversion using:
npm run test:convert -- ./features/myFeature.feature ./tests/myFeature.spec.js
If you want to test or use this library locally without publishing it to npm:
-
Clone the repository or place the code in a local folder.
-
Run the following command inside the library directory:
npm link
-
In your target project, link the package:
npm link cucumber-to-playwright
Now, you can use the fts
command in your project as if it was installed from npm.
Feel free to submit issues or pull requests if you find bugs or have suggestions for improvement.
This project is licensed under the MIT License.
Josh Lavely josh@lavely.io