我是 Cypress 的初学者,我正在尝试亲身体验 Cypress 的 API 测试。 我正在尝试来自以下 URL 的非常基本的
GET
响应:
https://automationexercise.com/api/productsList
我试图获得
responseCode
,但每当我尝试反对时,我都会得到空白值。
我的逻辑如下:
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)
});
});