Skip to content

automate asserting network payload data #21051

Discussion options

You must be logged in to vote

Yes, you can assert the request object before it is sent. You'll use a callback function and make request body.

// match requests method and url
cy.intercept('POST', '/users', (req) => {
  // make assertions on keys or contents
  expect(req.body).to.include.key('qryEmployeeForm')
  // make an assertion on the payload contents
  expect(req.body.qryEmployeeForm.orderBy).to.eq('NAME')
})

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Kname80
Comment options

You must be logged in to vote
1 reply
@jjhelguero
Comment options

Comment options

You must be logged in to vote
5 replies
@Kname80
Comment options

@Kname80
Comment options

@Kname80
Comment options

@jjhelguero
Comment options

@Kname80
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants