https://cypress.io logo
Best practices for adding API tests to existing UI...
# i-need-help
s
Hello again, I added my first API test to existing E2E UI tests. Is there any github repo or video with API and UI tests in one E2E test? I would like to see best practices and ideas. Thanks.
b
Have you checked out the plugin from @nutritious-restaurant-91514 😀 ? https://github.com/filiphric/cypress-plugin-api
e
Depending on what you are looking for in your API testing. If you are wanting to just check 200s on requests
cy.request
would be the way to go. If you are wanting to check each reponse (valid and invalid) for your endpoints I would recommend the above plugin and then having these API tests to be separated out from the UI tests.
s
This plugin is awesome. Thanks. I am now able to see the API call information in cypress runner, and assert better on endpoints' response But my original question was that - I want to know what are the best practices for adding an API tests to Cypress where there are already existing UI tests - How can I configure to run API tests separately, UI tests separately, and may be both Below is how I am currently doing 🫣
5 Views