Backend testing in Cypress

We can easily use Cypress to send the api requests and check responses.

                   

describe('Softpost Test', function () {
    

  it('Use fixture data', function (){
     
      cy.request('https://jsonplaceholder.cypress.io/users')
      .then((response) => {
        cy.writeFile('cypress/fixtures/userdata.json', response.body)
      })
      
      cy.fixture('userdata').should((users) => {
      expect(users[0].name).to.eq("Leanne Graham")
      })
  });
});
              
                
                    
Complex problems, Simple Solutions