相关疑难解决方法(0)

如何在Rails上编写Stripe checkout的集成测试?

我试图为我的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

18
推荐指数
2
解决办法
5747
查看次数