From 1763c516ecded9107e926ef5bcfdd4da764ea24b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 29 Apr 2024 17:44:42 +0100 Subject: [PATCH 1/2] Adds localization test for checkout as a guest --- spec/system/consumer/multilingual_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/system/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb index 48edc6e685..eaf4364a73 100644 --- a/spec/system/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -61,6 +61,13 @@ describe 'Multilingual' do expect_menu_and_cookie_in_es expect(page).to have_content 'Precio' end + + it "visiting checkout as a guest user" do + visit checkout_path(locale: 'es') + + expect_menu_and_cookie_in_es + expect(page).to have_content 'Iniciar sesión' + end end end From fb5f31375ae2df8c27a53627e0f4090e16b9e83b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 29 Apr 2024 19:28:21 +0100 Subject: [PATCH 2/2] Adds localization test for checkout steps As a logged user --- spec/system/consumer/multilingual_spec.rb | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/spec/system/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb index eaf4364a73..b50b51f77d 100644 --- a/spec/system/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -87,6 +87,7 @@ describe 'Multilingual' do it 'updates user locale and stays in cookie after logout' do login_as user + visit root_path(locale: 'es') user.reload @@ -97,6 +98,57 @@ describe 'Multilingual' do expect_menu_and_cookie_in_es expect(page).to have_content '¿Estás interesada en entrar en Open Food Network?' end + + context "visiting checkout as logged user" do + let!(:zone) { create(:zone_with_member) } + let(:supplier) { create(:supplier_enterprise) } + let(:distributor) { create(:distributor_enterprise, charges_sales_tax: true) } + let(:product) { + create(:taxed_product, supplier:, price: 10, zone:) + } + let(:variant) { product.variants.first } + let!(:order_cycle) { + create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], + coordinator: create(:distributor_enterprise), + variants: [variant]) + } + + let(:free_shipping) { + create(:shipping_method, require_ship_address: false) + } + let!(:payment) { + create(:payment_method, distributors: [distributor], + name: "Payment") + } + let(:order) { + create(:order_ready_for_confirmation, distributor:) + } + before do + set_order order + login_as user + end + + it "on the details step" do + visit checkout_step_path(:details, locale: 'es') + + expect_menu_and_cookie_in_es + expect(page).to have_content "Sus detalles" + end + + it "on the payment step" do + visit checkout_step_path(:payment, locale: 'es') + + expect_menu_and_cookie_in_es + expect(page).to have_content "Puede revisar y confirmar su pedido" + end + + it "on the summary step" do + visit checkout_step_path(:summary, locale: 'es') + + expect_menu_and_cookie_in_es + expect(page).to have_content "Detalles de entrega" + end + end end describe "using the language switcher UI" do