From 1d5e970b477fc27154400f4715fb2c2d671f9365 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Tue, 23 Jul 2013 17:48:54 +1000 Subject: [PATCH] Fix test regressions with multiple 'Save and Continue' buttons in checkout --- ...ses_distributor_info_rich_text_feature_spec.rb | 6 +++--- spec/features/consumer/checkout_spec.rb | 15 +++------------ spec/spec_helper.rb | 1 + spec/support/spree/checkout_helpers.rb | 7 +++++++ 4 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 spec/support/spree/checkout_helpers.rb diff --git a/spec/features/chili/enterprises_distributor_info_rich_text_feature_spec.rb b/spec/features/chili/enterprises_distributor_info_rich_text_feature_spec.rb index 6ad553536a..ed56b57ed3 100644 --- a/spec/features/chili/enterprises_distributor_info_rich_text_feature_spec.rb +++ b/spec/features/chili/enterprises_distributor_info_rich_text_feature_spec.rb @@ -106,8 +106,8 @@ feature "enterprises distributor info as rich text" do select('Australia', :from => 'order_bill_address_attributes_country_id') select('Victoria', :from => 'order_bill_address_attributes_state_id') - click_button 'Save and Continue' - click_button 'Save and Continue' - click_button 'Process My Order' + click_checkout_continue_button + click_checkout_continue_button + click_checkout_continue_button end end diff --git a/spec/features/consumer/checkout_spec.rb b/spec/features/consumer/checkout_spec.rb index 27d95b867a..873366ec0f 100644 --- a/spec/features/consumer/checkout_spec.rb +++ b/spec/features/consumer/checkout_spec.rb @@ -192,15 +192,14 @@ feature %q{ # Disabled until this form takes order cycles into account # page.should have_selector "select#order_distributor_id option[value='#{@distributor_alternative.id}']" - #click_button 'Save and Continue' - click_continue_button + click_checkout_continue_button # -- Checkout: Delivery page.should have_selector 'label', :text => "Delivery $3.00" - click_continue_button + click_checkout_continue_button # -- Checkout: Payment - click_continue_button + click_checkout_continue_button # -- Checkout: Order complete page.should have_content('Your order has been processed successfully') @@ -211,12 +210,4 @@ feature %q{ # page.should have_content('On Tuesday, 4 PM') # page.should have_content('12 Bungee Rd, Carion') end - - - private - - def click_continue_button - page.find('#add_new_save_checkout_button input[type=submit]').click - end - end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7e3ca55e45..0349817f41 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -65,6 +65,7 @@ RSpec.configure do |config| config.include Rails.application.routes.url_helpers config.include Spree::UrlHelpers + config.include Spree::CheckoutHelpers config.include Spree::Core::TestingSupport::ControllerRequests, :type => :controller config.include Devise::TestHelpers, :type => :controller diff --git a/spec/support/spree/checkout_helpers.rb b/spec/support/spree/checkout_helpers.rb new file mode 100644 index 0000000000..44da6a9e74 --- /dev/null +++ b/spec/support/spree/checkout_helpers.rb @@ -0,0 +1,7 @@ +module Spree + module CheckoutHelpers + def click_checkout_continue_button + page.find('#add_new_save_checkout_button input[type=submit]').click + end + end +end