diff --git a/app/helpers/checkout_helper.rb b/app/helpers/checkout_helper.rb index dabbf3d4a6..eb96a28dd7 100644 --- a/app/helpers/checkout_helper.rb +++ b/app/helpers/checkout_helper.rb @@ -148,4 +148,10 @@ module CheckoutHelper ] end end + + # Set the Page title of checkout process as step based like + # Checkout Details, Checkout Payment and Checkout Summary + def checkout_page_title + t("checkout_#{checkout_step}_title") + end end diff --git a/app/views/checkout/edit.html.haml b/app/views/checkout/edit.html.haml index b9dab1817f..990c8387b5 100644 --- a/app/views/checkout/edit.html.haml +++ b/app/views/checkout/edit.html.haml @@ -1,5 +1,5 @@ - content_for(:title) do - = t :checkout_title + = checkout_page_title .darkswarm.footer-pad{"data-turbo": "true"} - content_for :order_cycle_form do diff --git a/config/locales/en.yml b/config/locales/en.yml index 7a51352b98..05ee256012 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2227,6 +2227,9 @@ en: order_back_to_store: Back To Store order_back_to_cart: Back To Cart order_back_to_website: Back To Website + checkout_details_title: Checkout Details + checkout_payment_title: Checkout Payment + checkout_summary_title: Checkout Summary bom_tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required." diff --git a/spec/system/consumer/checkout/details_spec.rb b/spec/system/consumer/checkout/details_spec.rb index 7492b4721d..d44b0cc2ad 100644 --- a/spec/system/consumer/checkout/details_spec.rb +++ b/spec/system/consumer/checkout/details_spec.rb @@ -389,6 +389,10 @@ describe "As a consumer, I want to checkout my order" do end it "pre-fills address details" do + # Check for the right title first. This is a random place here but + # we don't have a standard success checkout flow case to add this to. + expect(page).to have_title "Checkout Details - Open Food Network" + visit checkout_path expect(page).to have_select( "order_bill_address_attributes_state_id", selected: "Testville" diff --git a/spec/system/consumer/checkout/payment_spec.rb b/spec/system/consumer/checkout/payment_spec.rb index e97bb2e683..65f18d271b 100644 --- a/spec/system/consumer/checkout/payment_spec.rb +++ b/spec/system/consumer/checkout/payment_spec.rb @@ -62,14 +62,12 @@ describe "As a consumer, I want to checkout my order" do let(:order) { create(:order_ready_for_payment, distributor:) } context "with one payment method, with a fee" do - before do - visit checkout_step_path(:payment) - end it "preselect the payment method if only one is available" do - expect(page).to have_checked_field "payment_method_#{payment_with_fee.id}" - end - it "displays the transaction fee" do - expect(page).to have_content("#{payment_with_fee.name} " + with_currency(1.23).to_s) + visit checkout_step_path(:payment) + + expect(page).to have_title "Checkout Payment - Open Food Network" + expect(page).to have_checked_field "Payment with Fee" + expect(page).to have_content "Payment with Fee $1.23" end end diff --git a/spec/system/consumer/checkout/summary_spec.rb b/spec/system/consumer/checkout/summary_spec.rb index ac17de5f31..2f2767d7dd 100644 --- a/spec/system/consumer/checkout/summary_spec.rb +++ b/spec/system/consumer/checkout/summary_spec.rb @@ -66,15 +66,16 @@ describe "As a consumer, I want to checkout my order" do visit checkout_step_path(:summary) end - it "displays the ship address" do + it "displays title and ship address" do + expect(page).to have_title "Checkout Summary - Open Food Network" + expect(page).to have_content "Delivery address" expect(page).to have_content order.ship_address.address1 expect(page).to have_content order.ship_address.city expect(page).to have_content order.ship_address.zipcode expect(page).to have_content order.ship_address.phone - end - it "and not the billing address" do + # but not the billing address expect(page).not_to have_content order.bill_address.address1 expect(page).not_to have_content order.bill_address.city expect(page).not_to have_content order.bill_address.zipcode