29
loading...
This website collects cookies to deliver better user experience
node (version > 12)
npm
react (version 17.*)
No coding experience is necessary but some basic knowledge of reading and writing JSON files is required.
git clone https://github.com/rishadomar/tapi.git
cd tapi
npm install
rm -rf cypress/* # Clean up sample projects. Tapi will generate Test scripts for you.
rm -f public/all-apis.json public/settings.json cypress/integration/* # A regular clean to run before switching data sources
npm run extractAllApis example # "example" is a the sample folder of data. You can specify the folder that contains your API specs.
npm run generateCypressTests example
npm start # Run the GUI. Test your APIs manually
npm run cypress:open # Run a GUI and execute your tests hands-free!
$(npm bin)/cypress run # Run on the console with no GUI. Typically, this is added to your CI/CD.
cd PATH_TO_YOUR_DATA_FOLDER
Create settings.json
{
"BASE_URL": "https://...",
"ANY_OTHER_VARIABLE_KEY": "SOME VALUE"
}
Add folders with API files in each folder
Example of an API file:
{
"api": "${BASE_URL}/user/invoices/${PREVIOUS_RESULT.1-registerUser._id?key=${KEY_FROM_SETTINGS}&offset=0&limit=20",
"method": "GET",
"headers": { "Accept": "application/json" },
"description": "Get the first 20 invoices of specified user",
"expectedResponse": {
"user": {
"userId": "*",
"userName": "Joe Bloggs"
},
"invoices": [
{
"date": "*",
"amount": "123.98"
},
{
"date": "*",
"amount": "565.88"
}
]
}
}
{
"projectId": "<CYPRESS_PROJECT_ID_HERE>",
"component": {
"testFiles": "**/*.test.{js,ts,jsx,tsx}",
"componentFolder": "src"
}
}
$(npm bin)/cypress run --record --key <CYPRESS_KEY_HERE>
Or run a specific spec by adding:
--spec "cypress/integration/Chat_spec.js"
To view in dashboard: https://dashboard.cypress.io/projects/<CYPRESS_PROJECT_ID_HERE>/runs