Merge pull request #12421 from filipefurtad0/legacy_checkout_multilingual_spec

Updates multilingual spec to test checkout steps
This commit is contained in:
David Cook
2024-05-01 09:55:05 +10:00
committed by GitHub

View File

@@ -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
@@ -80,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
@@ -90,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