- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Does cypress support api automation testing also?
Yes Cypress supports API automating testing also. XHR is known as the XML HTTP Request. It is an API which is used as an object. Its methods pass data between a server and browser. An XHR object can obtain data from a server in the form of a Response.
Cypress can not only be used for UI automation, but can also be used to supervise the network traffic by directly acquiring the XHR objects. It is capable of mocking or stubbing a Response. An XHR information is obatined in the Network tab in the browser.
XHR Header
Response
To trigger an XHR request, the command cy.request() is used. The method cy.intercept() redirects the Responses to the matching requests.
Implementation XHR request
cy.request('https://jsonplaceholder.cypress.io/comments').as('cn') //request aliasing with @cn cy.get('@cn').should((response) => { expect(response.body).to.have.length(500) expect(response).to.have.property('headers') })
- Related Articles
- Cypress Test Automation
- Cypress Architecture (Test Automation)
- Cypress Installation (Test Automation)
- Does Selenium support headless browser testing?
- Cypress Test Runner (Test Automation)
- Cypress Dashboard for Test Automation
- What is Cypress for Test Automation?
- Best Automation Testing Tools
- 20 Best Automation Testing Tools
- How Automation Testing Changed the Perspective?
- Top Automation Testing Interview Questions & Answers
- Framework used in software Automation Testing
- Automation Testing Framework for Agile/Scrum Methodology
- Scripting standards for Automation Testing in RPA
- API Testing Tutorial for Beginners

Advertisements