¿Pueden ayudarme a encontrar la solución adecuada para esto? Este caso de prueba es sobre beforeEach, que es para configurar los datos y después de configurar los datos, pruebo el otro punto final.
Me he enfrentado a problemas como los siguientes:
Mis códigos en spec.js
beforeEach(() => { cy.fixture("token.json").then((data) => { cy.request({ method: "POST", url: data.url + "/setup", headers: { Authorization: data.token, "content-type": "application/json", }, body: { "test-case": "base", }, failOnStatusCode: false, }).then((res) => { expect(res.status).to.eq(200); }); }); it("get a list of auctions filtered by the options passed in the body", () => { cy.fixture("token.json").then((data) => {}); cy.request({ method: "POST", url: data.url, headers: { Authorization: data.token, "content-type": "application/json", }, body: { auctionType: ["basic_auction"], statuses: ["ongoing"], }, failOnStatusCode: false, }).then((res) => { expect(res.status).to.eq(200); // assert assert.isNotNull(res.body, "is not null"); assert.isNotNull(res.body.createdAt, "is not null"); //}) }); }); });Y tengo fixtures->token.json donde almacené Token y URL