B
B
BB 82019-02-28 19:04:04
Software testing
BB 8, 2019-02-28 19:04:04

How to use Cypress to track the request to the server??

There is a SPA on React, there are components that send data to the server every 1 second under a certain condition, how to track these requests with Cypress ??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2019-03-09
@fruity4pie

For example, like this:

it('Request', () => {
    cy.server()
    cy.route("POST", '/oauth/token').as('getToken')

    cy.get(['data-cy="button-get-token"]').click()

    cy.wait('@getToken').its('status').should('eq', 200)
  })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question