You’re not receiving notifications from this thread.
Fill in Stripe Elements JS for SCA / 3D Secure 2 and Capybara Discussion
I have followed your course on Stripe and i'm stuck one complete_stripe_sca step. The problem is the test does not go beyond that. It keeps on waiting.
fill_stripe_elements card: 4000002760003184 fill_in 'name_on_card', with: user.full_name click_button 'Subscribe' complete_stripe_sca expect(page).to have_current_path(orders_path)
Thats it. It nevers comes to the last line. When on without headless chrome, it stucks after clicking the dialogue box of SCA and just stays there on the same page.
Do you have any idea what is wrong ? Let me know if you need more details.
I figured this out. It was
chrome driver on which it was not working. I changed to firefox and it worked perfectly fine.
the same thing as Ahmad happened to me, and switching to firefox did not fix the issue.
I don't know why but after some digging I found that the tests were never going back to the top level once inside the second within_frame call:
find_frame('body > div > iframe') do sleep 1 find_frame('#challengeFrame') do click_on "Complete authentication" # test hang here end end
To fix it I instead used :
stripe_frame = find('body > div > iframe') switch_to_frame(stripe_frame) # enter the first frame auth_frame = find('#challengeFrame') sleep 2 switch_to_frame(auth_frame) # enter the second frame sleep 2 click_on "Fail authentication" switch_to_frame(:top) # go back to the top level
That is manually switching between frames and going back to the top level.
I post that here in case it happens to somebody else.
PS: My SCA confirmation/failure take place inside a Capybara.using_session if that's of any help.
I had to go one level deeper:
def complete_stripe_sca find_frame('body > div > iframe') do find_frame('#challengeFrame') do find_frame("iframe[name='acsFrame']") do click_on "Complete authentication" end end end end