From eca18ba6eedea7ee01c173393b43d74f0a98b9df Mon Sep 17 00:00:00 2001 From: Duende13 Date: Fri, 4 Aug 2017 17:29:49 +0100 Subject: [PATCH] Test to control order of shipping methods by name --- spec/features/consumer/shopping/checkout_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/features/consumer/shopping/checkout_spec.rb b/spec/features/consumer/shopping/checkout_spec.rb index 0a55324b37..beeec2202b 100644 --- a/spec/features/consumer/shopping/checkout_spec.rb +++ b/spec/features/consumer/shopping/checkout_spec.rb @@ -222,11 +222,12 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do page.should_not have_content product.tax_category.name end - it "shows all shipping methods" do + it "shows all shipping methods in order by name" do toggle_shipping - page.should have_content "Frogs" - page.should have_content "Donkeys" - page.should have_content "Local" + shipping_methods = page.all(:xpath, '//*[@id="shipping"]/ng-form/dd/div/div[1]').map {|row| row.all('label').map(&:text)}.flatten + expect(shipping_methods[0]).to include(sm2.name) # Donkeys + expect(shipping_methods[1]).to include(sm1.name) # Frogs + expect(shipping_methods[2]).to include(sm3.name) # Local end context "when shipping method requires an address" do