I consistently receive the response of 'operation not found' when I send a GraphQL query or mutation in Cypress. Taking tips from this post https://stackoverflow.com/a/68750026/16958500 I have the following in my it block (its working in Postman)
it('Retrieve and Store Session Token', () => {
const query = `mutation {
requestSMSSessionToken(phoneNumber: "1666555021"){
cookieKey
tokenValue
expires
}
}`;
cy.request({
method: 'POST',
url: '/',
headers: {
'Content-Type': 'application/json',
},
body: { query },
}).then((res)=>{
cy.log(JSON.stringify(res))
expect(res.status).to.eq(200)
});
})
Here is my Postman Curl Code Snippet (that's working)
curl --location --request POST '/' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"mutation {\r\n requestSMSSessionToken(phoneNumber: \"1666555021\"){\r\n \r\n cookieKey\r\n tokenValue\r\n expires\r\n \r\n }\r\n }","variables":{}}'
any tips to share to get this working?