2

I am having a difficult time testing Stripe's Checkout.js product with Capybara. The problem is Stripe has some tricky client side validation that fools Capybara's javascript driver, so when I tell Capybara to fill in a field, like this:

fill_in "card_number", with: "4242424242424242"

Stripe field only fills up oly the first three digits then it automatically puts a space after those digits, and that breaks Capybara badly.

How can I fix this?

Eliot Sykes
  • 9,616
  • 6
  • 50
  • 64
picardo
  • 24,530
  • 33
  • 104
  • 151

1 Answers1

4

I don't know exactly but when i get into these situations i consider dropping directly into the browsers javascript, such as (in this case assuming jquery is present)

page.execute_script(%Q{ $('input#itsId').val('424242424242424242'); })
linojon
  • 1,052
  • 1
  • 10
  • 19