#fabiano_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1267492623116013589
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Complete helper method here:
module FillStripeElements
IFRAME_PATH = '#card-element > div > iframe'
def fill_stripe_multi_elements(element_selector='#payment-element', card='4242424242424242', expiry='1234', cvc='123', postal='12345')
iframe_path = "#{element_selector} > div > iframe[title='Secure payment input frame']"
find_frame(iframe_path) do
card.to_s.chars.each do |piece|
field = find_field('Field-numberInput', wait: 20)
field.send_keys(piece)
end
find_field('Field-expiryInput').send_keys expiry
find_field('Field-cvcInput').send_keys cvc
select('United States', from: 'Field-countryInput')
find_field('Field-postalCodeInput').send_keys postal
end
end
# Generic helper for finding an iframe
def find_frame(selector, &block)
using_wait_time(15) do
frame = find(selector)
within_frame(frame) do
block.call
end
end
end
end
Error I usually get when it fails:
Capybara::ElementNotFound: Unable to find field "Field-numberInput" that is not disabled
(edited the helper to remove unused method)
Our general advice is not to build end-to-end integration tests like as the libraries don't support it. You should instead be mocking API responses etc: https://docs.stripe.com/automated-testing
THanks for the advice. I already have some tests covering Stripe API which does exactly that, mocking API responses. However in addition to that, it's really important for us having these integration tests in place that specifically tests the user interaction with the chekout page, adding payment method etc, Since this is such a critical part of our business model.
THe checkout page is one step in a multi-step flow that I need to test in my application
As stated, the libraries don't support integration testing like this I'm afraid. We're unable to assist in this regard
Could I at least find more technical documentation about Elements? The current tests I have already work like 90% of the time, seems to me like I just need to tweak it a bit more make sure it work 100%.
What technical documentation specifically? Everything public is available at https://docs.stripe.com/js