From 0da2d6e4692a57db5c688f383216bedc980f20f8 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jan 2022 11:55:55 +0000 Subject: [PATCH] Adds coverage for required fields - address shipping --- spec/system/consumer/split_checkout_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index 55024208c3..455dead0d9 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -168,7 +168,6 @@ describe "As a consumer, I want to checkout my order", js: true do before do check "ship_address_same_as_billing" end - it "does not display the shipping address form" do within(:xpath, './/div[@class="checkout-substep"][3]') do expect(page).not_to have_field "order_ship_address_attributes_address1" @@ -185,13 +184,23 @@ describe "As a consumer, I want to checkout my order", js: true do before do uncheck "ship_address_same_as_billing" end - it "displays the shipping address form" do within(:xpath, './/div[@class="checkout-substep"][3]') do expect(page).to have_field "order_ship_address_attributes_address1" end end + it "displays error messages when submitting incomplete billing address" do + click_button "Next - Payment method" + expect(page).to have_content "Saving failed, please update the highlighted fields." + within(:xpath, './/div[@class="checkout-substep"][3]') do + expect(page).to have_field("Address", with: "") + expect(page).to have_field("City", with: "") + expect(page).to have_field("Postcode", with: "") + expect(page).to have_content("can't be blank", count: 3) + end + end + it "fills in shipping details and redirects the user to the Payment Method step, when submiting the form" do fill_out_shipping_address