mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
Adds coverage for required fields - address shipping
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user