我试图为我的Rails 3.2应用程序为Stripe的checkout.js [ https://checkout.stripe.com/checkout.js ] 编写集成测试.
手动测试(使用Stripe的测试键)时,条纹检查对我来说正常工作,但我无法让Capybara检测fill_in到Stripe checkout iframe模式中的电子邮件字段.
我正在使用无头javascript的poltergeist,虽然也用capybara-webkit和甚至selenium测试了同样的问题.
我要测试的是完整的订阅注册流程,以显示新用户在Stripe中输入付款详细信息后可以创建订阅者帐户 - 但我无法通过Stripe checkout弹出窗口.
这是我的before .. do:
describe "show Stripe checkout", :js => true do
before do
visit pricing_path
click_button 'plan-illuminated'
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
Capybara.within_frame stripe_iframe do
fill_in "email", :with => "test-user@example.com"
fill_in "billing-name", :with => "Mr Name"
fill_in "billing-street", :with => "test Street"
fill_in "billing-zip", :with => 10000
fill_in "billing-city", :with => "Berlin"
click_button "Payment Info"
end
end
it …Run Code Online (Sandbox Code Playgroud) testing ruby-on-rails capybara ruby-on-rails-3 stripe-payments
我\xc2\xb4m 正在学习 Ruby on Rails,并且 i\xc2\xb4m 正在开发一个使用 stripe 创建高级帐户的应用程序。此外,i\xc2\xb4m 使用 Rspec 和 Capybara 进行集成测试。
\n\nrequire \'spec_helper\'\n\nfeature "user upgrade account to a premium plan" do\n scenario "user upgrade account", :js => true do\n user = FactoryGirl.create :user\n visit new_user_session_path\n fill_in \'Email\', :with => user.email\n fill_in \'Password\', :with => user.password\n click_button \'Sign in\'\n\n visit new_charge_path\n click_button "Pay with Card"\n\n fill_in \'Email\', :with => \'persona@example.com\'\n fill_in "Card number", :with => "4242424242424242"\n fill_in \'CVC\', :with => \'123\'\n fill_in \'MM/YY\', :with => \'11/14\'\n\n click_button …Run Code Online (Sandbox Code Playgroud)