Add cypress command to wait for specific GraphQL query

This commit is contained in:
Ramon Wenger 2019-02-14 18:54:16 +01:00
parent 59495d13c8
commit be7259403e
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}
});
});