У меня проблема с написанием тестов на огурцы. После оплаты через Paylane (как-то возникает проблема с сценариями Paylane, Paypal, Stripe и Payu отлично работает), когда на странице «Спасибо» Capybara нажимает кнопку (чтобы вернуться в магазин), она становится подсвеченной в браузере, но она ничего не делает. Кроме того, он переходит к следующему шагу и проверяет, находится ли его на странице хранилища, поэтому он думает, что нажатие на кнопку прошло хорошо (я полагаю). Может ли кто-нибудь помочь мне с этим?Похоже, 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
Кнопка содержит текст "Назад к продукту".
Любая помощь будет оценена!
Я добавил спит, прежде чем нажимать, что вызывает проблемы, и это помогает, но я рассматриваю это как временное решение. Есть ли проблемы с огурцом, чтобы дождаться загрузки страницы, прежде чем делать что-то на ней? – sbulat