让我首先确认这不是重复(因为那里发布的答案没有解决我的问题).这篇文章基本上是我的确切问题:Capybara无法在Stripe模式中找到表单字段来填充它们.
这是我的水豚规格:
describe 'checkout', type: :feature, js: true do
it 'checks out correctly' do
visit '/'
page.should have_content 'Amount: $20.00'
page.find('#button-two').click_button 'Pay with Card'
Capybara.within_frame 'stripe_checkout_app' do
fill_in 'Email', with: 'example@example.com'
fill_in 'Name', with: 'Nick Cox'
fill_in 'Street', with: '123 Anywhere St.'
fill_in 'ZIP', with: '98117'
fill_in 'City', with: 'Seattle'
click_button 'Payment Info'
fill_in 'Card number', with: '4242424242424242' #test card number
fill_in 'MM/YY', with: '02/22'
fill_in 'CVC', with: '222'
click_button 'Pay'
end
page.should have_content 'Thanks'
end
end
Run Code Online (Sandbox Code Playgroud)
该规范中的文字是我最近的尝试. …