https://cypress.io logo
Unable to automate payment process
# i-need-help
b
Hello all I need some help please, I am trying to automate the user journey which includes making the payment and receiving the confirmation on the page but after submitting the payment form it get stuck while receiving the conformation and page does not receive the confirmation,. I am sure there some small change I need to do to make it receive the payment confirmation, can I please get some advise what I need to do to, I have tried cy.wait() after making the payment.
Cypress will not wait for the result to come back to the screen and finish the process before it can receive the response from the payment gateway, I tried using cy.wait( ) to wait for the response but Cypress finish the process before the result
e
Try setting up modifyObstructiveCode: false in your config
b
@elegant-wall-98634 thank you for reply, I have tried your solution but it is not working, I can see from the network tab some of the API calls are missing I mean the one responsible for making the payment through are not getting through, Cypress is finishing the process before it can receive the response from payment gateway
@stale-park-86404 please advise
@curved-pager-94835 please advise
@gray-kilobyte-89541 please advise
g
Reproducible example please
e
Cypress is finishing the process before it can receive the response from payment gateway You mentioned you have tried
cy.wait
? Is that an explicit wait or have you tried intercepting and waiting on the actual payment API call? If you've tried that what error are you getting? You can increase the timeout waiting for a response if it's a particularly lengthy API call.
b
I do not really understand the intercept method but since i have the direction now i will work towards it and try to solve the problem, i will learn how intercept work and come back to you if that does not solve the problem
Many thanks for the reply, I will try to understand and use aliasing and intercept method and try to solve it
g
Understanding
cy.intercept
and network testing is easy. Take my paid course https://cypress.tips/courses/network-testing and you will know it 100%
b
Hello All, does cypress have issues with authenticating payment via payment gateway ? I have tried cy.orign(), tried intercepting all the calls made by payment gateway as well, nothing seems to be working
e
Try using
cy.intercept
with an alias for the 200 response when that goes through, and then after you get to this point
cy.wait(aliasName),its('response.statusCode').should('eq', 200)
. This way cypress will wait for that request to come through before continuing with the test.
3 Views