I am trying to use cypress for testing my Razorpay payment flow in my ROR project.I am able to get fields in iframe,select a bank and click on "Pay rs 399 now".On clicking the "Pay now button" a new window opens up which has two options to make the payment success OR fail it.Everything till now is already tested in cypress...My question is how do I access the new window opened using cypress and click "success"
I HAVE TRIED:
As I was not able to access the new window.I tried adding a random razorpay_payment_id and amount and passing it directly using "POST" request to my "update" action in the Subscription Controller.But alas!!! this action chks if razorpay_payment_id is present and if present fetches it like
payment = Razorpay::Payment.fetch(params[:razorpay_payment_id]).
capture({ amount: params[:amount] })
which errs to "The id provided does not exist"
Also tried:
refered this question to access the new window...But got an err "Expected "open" to be called at least once.But was never called"
Please help!!
here are the images for ref
(1)this image shows the razorpay modal before i finally click on pay button (2)here is the new window which opens when I click PAY.