graphql requests in tests #22515
Unanswered
websitevirtuoso
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I have problem with getting my gql object in cypress.
I have next setup
I have next test case
https://gist.github.com/websitevirtuoso/c39b6b817a930b99299d353b83a05afe
Command - gqlRequest looks like
https://gist.github.com/websitevirtuoso/2c2146eaecae3631421c83633afcb7cc
On line 3 I import gql query
My gql file looks like
https://gist.github.com/websitevirtuoso/1a850aa2b911acf431e3bbf8ac5595af
1 file can have multiple queries or mutations.
I import them like this
import { CategoryUpsert } from '../../../graphql/mutations/category.gql'
and this object I use in mutations or queries functions
In cypress I am getting this type of error when trying to get my gql object
How to use gql objects in cypress?
From this article
https://glebbahmutov.com/blog/request-graphql/
I can define gql query manually in cy.request but it will duplicate my gql objects. I would like to reuse my existing gql objects. Please help me how to do this?
I know that I need to add cypress-preprocessor but I couldn't find any
https://docs.cypress.io/plugins/directory
Something like this
Beta Was this translation helpful? Give feedback.
All reactions