From be7259403ecd423e7f4b494ebafbd86fc03177c3 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 14 Feb 2019 18:54:16 +0100 Subject: [PATCH] Add cypress command to wait for specific GraphQL query --- client/cypress/support/commands.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js index 2a0fa5f9..66477c4a 100644 --- a/client/cypress/support/commands.js +++ b/client/cypress/support/commands.js @@ -59,3 +59,12 @@ Cypress.Commands.add('loginByCsrf', (username, password, csrftoken) => { } }); }); + +// from https://stackoverflow.com/questions/53814647/how-can-i-alias-specific-graphql-requests-in-cypress +Cypress.Commands.add('waitFor', operationName => { + cy.wait('@graphQL').then(({request}) => { + if(request.body.operationName !== operationName) { + return cy.waitFor(operationName); + } + }); +});