When I use cy.intercept()
, the API does not stub.
cy.intercept("GET", `${API}farm/list`, {
body: {
statusCode: 200,
message: "Request successful",
result: seededFarmList,
},
});
I am importing the fixture file like this:
import { seededFarmList } from '../../../../../fixtures/farm';
My API response looks like this:
{
"statusCode": 200,
"message": "Request successful",
"result": [
{ "id": 1 "farmName": "ABCD", },
{ "id": 2 "farmName": "EFGH", }
]
}
Any help would be appreciated.
I managed to get stubbing working with the pattern @eric99 gave,
The page shows the stub information,