【发布时间】:2016-07-12 12:54:39
【问题描述】:
我在编写 Cucumber 测试时遇到问题。通过 Paylane 付款后(不知何故,Paylane 场景只有问题;Paypal、Stripe 和 Payu 工作正常)当它在“谢谢”页面上时,它看起来像 Capybara 点击按钮(返回商店)它在浏览器中突出显示,但它什么都不做。此外,它进入下一步并检查它是否在商店页面上,所以它认为点击按钮很顺利(我想)。有人可以帮我吗?
@lp @purchase @paylane @javascript
Feature: Purchase a product from a Landing Page via Paylane
As a Sneakpick user
I can access Landing Pages of product
So I can successfully purchase it via Paylane
Scenario: Purchase product via Paylane # features/purchases/landing_page/paylane.feature:7
Given I visit the Landing Page # features/step_definitions/basic_steps.rb:5
Then I want to order 1 product # features/step_definitions/purchase_steps.rb:92
And product is available via Paylane # features/step_definitions/purchase_steps.rb:1
DEPRECATION WARNING: Passing a template handler in the template name is deprecated. You can simply remove the handler name or pass render :handlers => [:erb] instead. (called from _app_views_paylane_pay_html_erb___1015711955565910954_70249561011280 at /home/szczepan/1000i/Git/sneakpick/app/views/paylane/pay.html.erb:2)
Then I go to payment # features/step_definitions/purchase_steps.rb:53
And I pay via Paylane # features/step_definitions/paylane_steps.rb:1
expected to find text "Product" in "Payment - Sneakpick.co Thank You! Your order has been processed. We've sent you a confirmation emailwith your order details. « Back to product powered by sneakpick" (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/purchase_steps.rb:77:in `/^I am on Landing page$/'
./features/step_definitions/paylane_steps.rb:2:in `/^I pay via Paylane$/'
features/purchases/landing_page/paylane.feature:12:in `And I pay via Paylane'
And my Paylane order should be made # features/step_definitions/paylane_steps.rb:76
Scenario: Purchase product via Paylane # features/purchases/landing_page/paylane.feature:15
Given I visit the Landing Page # features/step_definitions/basic_steps.rb:5
Then I want to order 1 product # features/step_definitions/purchase_steps.rb:92
And product is available via Paylane # features/step_definitions/purchase_steps.rb:1
DEPRECATION WARNING: Passing a template handler in the template name is deprecated. You can simply remove the handler name or pass render :handlers => [:erb] instead. (called from _app_views_paylane_pay_html_erb___1015711955565910954_70249561011280 at /home/szczepan/1000i/Git/sneakpick/app/views/paylane/pay.html.erb:2)
Then I go to payment # features/step_definitions/purchase_steps.rb:53
And I pay via Paylane not with card successfully # features/step_definitions/paylane_steps.rb:13
And my Paylane order should be made # features/step_definitions/paylane_steps.rb:76
哦,第二个工作正常,但第一个没有,但他们点击了同一个按钮。 步骤如下:
And /^I pay via Paylane$/ do
steps %(
And I check if Paylane form is filled with correct data
And I fill in the card data
And I send form
And I accept confirmation alert
And I am on Thank You page
And I click 'Back to product' button
And I am on Landing page
)
end
And /^I pay via Paylane not with card successfully$/ do
steps %(
And I choose last available payment
And I send form
And I accept confirmation alert
And I click 'SUCCESS' button
And I am on Thank You page
And I click 'Back to product' button
And I am on Landing page
)
end
以及“我点击 (.+) 按钮”步骤:
And /^I click '(.+)' button$/ do |button|
click_on(button)
end
按钮包含文本“返回产品”。
任何帮助将不胜感激!
【问题讨论】:
-
我在点击之前添加了睡眠,这会导致麻烦,这会有所帮助,但我将其视为临时解决方案。 cucumber 是否有问题要等到页面加载完毕再在上面做事?
标签: ruby-on-rails-3.2 cucumber capybara