prehistoric-oxygen-77880
12/15/2022, 1:12 PMstraight-microphone-66008
12/15/2022, 1:16 PMthankful-wire-37848
12/15/2022, 1:34 PMcy.get(...)
?thankful-wire-37848
12/15/2022, 1:35 PMmillions-scientist-9990
12/15/2022, 1:48 PMfresh-doctor-14925
12/15/2022, 1:54 PMcy.get(parent)
.within(() => {
cy.get(child1)
cy.get(child2).click
})
millions-scientist-9990
12/15/2022, 1:56 PMfresh-doctor-14925
12/15/2022, 2:00 PMmillions-scientist-9990
12/15/2022, 2:14 PMfresh-doctor-14925
12/15/2022, 2:15 PMwithin()
docs, as I think it's what you need based on your earlier commentmillions-scientist-9990
12/15/2022, 2:16 PMfresh-doctor-14925
12/15/2022, 2:20 PMcy.within()
millions-scientist-9990
12/15/2022, 2:39 PMgentle-school-70464
12/15/2022, 3:15 PMlimited-barista-33480
12/15/2022, 5:12 PMadorable-smartphone-87280
12/15/2022, 5:19 PMcy.task()
? https://docs.cypress.io/api/commands/taskgray-kilobyte-89541
12/15/2022, 5:27 PMhundreds-rainbow-52802
12/15/2022, 6:36 PM${url}
)
cy.intercept(
{
method: 'GET',
path: '.*/\checkoutshopper.*'
}).as('getMethod')
cy.get('[value="authorised"]').click()
cy.wait(
'@getMethod').then(inter => {
cy.log(JSON.stringify(inter))
console.log(JSON.stringify(inter))
})
cy.end()
});
This is the request that I get:
GET /checkoutshopper/services/PaymentIncomingRedirect/v1/localPaymentMethod?merchantAccount=
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: max-age=0
Connection: keep-alive
Cookie: __cypress.initial=true
Host: checkoutshopper-test.adyen.com
Referer: https://test.adyen.com/
Sec-Fetch-Dest: iframe
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-site
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46
sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Microsoft Edge";v="108"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
This is the response:
HTTP/1.1 302 Found
traceparent: 00-35052b34c35923c9b9ff2fd033713f3f-fb5db89a22c2b58e-01
pspreference: NQ9QKBJVJQRXGN82
Location: mobileapp://3ds1_return?payload=Ab02b4c
Content-Type: text/html; charset=utf-8
date: Thu, 15 Dec 2022 14:16:03 GMT
Set-Cookie: __cypress.initial=true; Domain=adyen.com; Path=/
Vary: Accept, Accept-Encoding
Content-Encoding: gzip
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunkedfresh-doctor-14925
12/15/2022, 6:50 PMkind-photographer-81911
12/15/2022, 7:57 PMcy.intercept('POST', '/graphql', (req) => {
const { body } = req
if (hasOperationName(req, 'ChangeResidentOnboardingAddress')) {
// Declare the alias from the initial intercept in the beforeEach
req.alias = 'gqlChangeResidentOnboardingAddressQuery'
// Set req.fixture or use req.reply to modify portions of the response
}
})
And I've noted that when I do a @wait in my test for the alias, Cypress does seem to execute that correctly, but now that I need to modify the intercept, all the documentation i can find on req.fixture assumes the fixture is the response body, not the request body. I don't see anything on how to set the request variables
The call my code is intercepting looks like this:
{
"operationName": "ChangeResidentOnboardingAddress",
"variables": {
"input": {
"address": {
"unit": "5"
}
}
},
"query": "mutation ChangeResidentOnboardingAddress($input: ChangeResidentOnboardingAddressInput!) {\n changeResidentOnboardingAddress(input: $input) {\n resident {\n id\n toAddress {\n unit\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"
}
but i need it to look like this:
{
"operationName": "ChangeResidentOnboardingAddress",
"variables": {
"input": {
"address": {
"unit": "5"
}
residentId: "14370228"
}
},
*not sure if the query changes to reflect this
residentId is a required fieldbitter-fountain-36713
12/15/2022, 9:06 PMbody
from the req
. Have you tried adding residentId
to req.body?kind-photographer-81911
12/15/2022, 9:07 PMcy.intercept('POST', '/graphql', (req) => {
if (hasOperationName(req, 'ChangeResidentOnboardingAddress')) {
// Declare the alias from the initial intercept in the beforeEach
req.alias = 'gqlChangeResidentOnboardingAddressQuery';
req.body.variables.input.residentId='14271499'
console.log('print out req', req);
}
});
straight-chef-47891
12/15/2022, 10:54 PM@cypress/grep
... gleb suggested using // @ts-ignore
but I remember not having this issue when it was still with the old @cypress/grep
and bahmutov/cypress-grep
gray-kilobyte-89541
12/16/2022, 1:12 AMgray-kilobyte-89541
12/16/2022, 1:13 AMswift-kitchen-62493
12/16/2022, 12:45 PMthousands-house-85089
12/16/2022, 12:48 PMthousands-house-85089
12/16/2022, 12:50 PMthousands-house-85089
12/16/2022, 1:00 PMswift-kitchen-62493
12/16/2022, 1:50 PM