Cypress plugin for effective API testing. Imagine Postman, but in Cypress.
Install this package:
npm i cypress-plugin-api
// or
yarn add cypress-plugin-api
Import the plugin into your cypress/support/e2e.js
file:
import 'cypress-plugin-api'
// or
require('cypress-plugin-api')
You can now use cy.api()
command. This command works exactly like cy.request()
but in addition to calling your API, it will print our information about the API call in your Cypress runner.
- view responses in UI frame as well as in the timeline
- showing query objects, headers, request body and response
- color coding of methods
- copy response to clipboard (works for last test only)
- snapshots
All the issues can be found on issues page, feel free to open any new ones or contribute with your own code.
Come to my upcoming "Testing API with Cypress" workshop. We’ll be using this plugin and learning different ways of testing API.