As a beginner in the world of Cypress, I am eager to dive into API Testing using Cypress.
My current focus is on sending a basic GET
request to the URL provided below:
Specifically, I am attempting to extract the value of responseCode
, but unfortunately every time I attempt to access it, I end up with a blank result.
Here is my logic:
it("Verify All Product response contains correct keys and values", () => {
cy.request("GET","https://automationexercise.com/api/productsList").then((response) => {
expect(response.status).to.eq(200)
expect(response.body).length.to.be.greaterThan(1)
cy.log(response.body.responseCode)
});
});
I have attached a screenshot displaying the outcome of my efforts: https://i.sstatic.net/Psbjf.png Please provide guidance on where I may be going wrong. Thank you.