samedi 1 décembre 2018

Changing route in cypress test for QraphQL endpoint

I have an Angular application using QraphQL. I write a test in cypress, looking like this:

it('should do something', () => {
 cy.server()
 cy.route('POST', '/graphql', 'fixture:data1.json');
 cy.visit('http://localhost:3000/#/something/somethingElse') // data is loaded from the endpoint to populate the page


 // when the button is clicked, the endpoint is called again, but now I need it to deliver some other data.
 cy.get('button')
  .click()

});

Can anyone provide me with a way to set this up? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire