Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@shopify/cypress-graphql
Advanced tools
Cypress commands for stubbing, intercepting and testing graphql endpoints
@shopify/cypress-graphql
Cypress commands for intercepting and testing graphql endpoints.
Install this package w/ npm or yarn
npm install --dev @shopify/cypress-graphql
yarn add --dev @shopify/cypress-graphql
Then in your cypress/support/index files, import the entire package to register these commands.
import '@shopify/cypress-graphql';
Typescript types are automatically included, so no further action is required.
cy.interceptGql
This command sets up spies and stubs for a graphql endpoint, similar to cypress route intercepts. This registers a top-level route alias called GraphQL
. Optionally, but definitely encouraged is providing an array of known operations, which will then be registered as sub-operations with their own aliases.
cy.interceptGql('**/graphql') // register route intercepts
cy.get('button[type="submit"]').click() // make the UI send a request
cy.wait('@GraphQL').its('status').should('eq', 200) // test the response
cy.interceptGql('**/graphql', ['UserQuery']) // register route intercepts
cy.get('button[type="submit"]').click() // make the UI send a request
cy.wait('@UserQuery').its('status').should('eq', 200) // test the response
cy.interceptGql('**/graphql', [
['UserQuery', { statusCode: 400, body: { data: null, errors: ['fake err'] } }]
]) // provide a fake error
cy.get('button[type="submit"]').click() // make the UI send a request
cy.wait('@UserQuery').its('status').should('eq', 400) // test the response
FAQs
Cypress commands for stubbing, intercepting and testing graphql endpoints
The npm package @shopify/cypress-graphql receives a total of 4,329 weekly downloads. As such, @shopify/cypress-graphql popularity was classified as popular.
We found that @shopify/cypress-graphql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 18 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.