Adds coverage for required fields - address shipping

This commit is contained in:
filipefurtad0
2022-01-10 11:55:55 +00:00
parent 01f870b818
commit 0da2d6e469

View File

@@ -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