From 96d4ee3f4f8b4c82fa9aa2123e68d033e11b9193 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 17 Feb 2022 14:39:52 +0100 Subject: [PATCH] Extract to a method in the split checkout helper --- spec/support/split_checkout_helper.rb | 7 +++++++ spec/system/consumer/split_checkout_spec.rb | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/support/split_checkout_helper.rb b/spec/support/split_checkout_helper.rb index 7b6cafe8cf..24a80c50d6 100644 --- a/spec/support/split_checkout_helper.rb +++ b/spec/support/split_checkout_helper.rb @@ -46,4 +46,11 @@ module SplitCheckoutHelper click_button "Next - Payment method" expect(page).to have_button("Next - Order summary") end + + def expect_to_be_on_first_step + expect(page).to have_content("1 - Your details") + expect(page).to have_selector("div.checkout-tab.selected", text: "1 - Your details") + expect(page).to have_content("2 - Payment method") + expect(page).to have_content("3 - Order summary") + end end diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index bd9af52961..cd7e741d1c 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -103,10 +103,7 @@ describe "As a consumer, I want to checkout my order", js: true do it "should display the split checkout details page" do click_on "Checkout as guest" expect(page).to have_content distributor.name - expect(page).to have_content("1 - Your details") - expect(page).to have_selector("div.checkout-tab.selected", text: "1 - Your details") - expect(page).to have_content("2 - Payment method") - expect(page).to have_content("3 - Order summary") + expect_to_be_on_first_step end it "should display error when fields are empty" do