Skip to content

Instantly share code, notes, and snippets.

@aleccool213
Created December 16, 2019 14:21
Show Gist options
  • Save aleccool213/5df73bab0eff93f4be583178e32a6554 to your computer and use it in GitHub Desktop.
Save aleccool213/5df73bab0eff93f4be583178e32a6554 to your computer and use it in GitHub Desktop.
declare global {
namespace Cypress {
interface Chainable<Subject> {
createFooBar: () => Chainable<string>;
}
}
}
/**
* Creates a foo and returns a bar.
*/
Cypress.Commands.add("createFooBar", () => {
cy.getCookie("token").then((token: any) => {
return graphQLClient
.request(print(CREATE_FOO), {
token: token.value,
fooName: "IAM A FOO",
input: {}
})
.then(results => {
return results.mutator.createFoo.bar;
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment