This error occurred during a before each hook we are skipping the remaining tests in the current suite: POST method

Viewed 1353

Can you please help me to find out the proper solution for this? This test case is about beforeEach - which is for setup the data and after setup the data I test the other endPoint.

I have faced problems like the below:

My codes in spec.js

enter image description here

 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");
        //})
      });
    });
  });


And I have fixtures->token.json where I stored Token and URL

0 Answers
Related