using cypress i’m intercepting an API call and want to get how much the response time it took
cy.intercept("PATCH", "https://api.website.com/b2b2/**").as("myAPP")
cy.wait("@myAPP").then(({ request, response }) => {
expect(response.duration).to.be.lessThan(2000)// => expected undefined to be a number or a date
expect(response.statusCode).to.equal(200)
})
2
Answers
In JavaScript, you can measure how fast an API call is by using
performance
API.For example:
there are many ways but You may try with
Postman, a popular API testing tool, provides an easy way to measure response time.
Open Postman.
Send the API request.
After the request is completed, Postman displays the response time in the bottom-right corner under the "Response" section.