From 38fe36b246c5c54866c2db2c5cb3ab54d69e7e0a Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 10 May 2024 12:56:40 +0100 Subject: [PATCH 1/2] Uptades tests on a regular checkout --- .../consumer/shopping/variant_overrides_spec.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/system/consumer/shopping/variant_overrides_spec.rb b/spec/system/consumer/shopping/variant_overrides_spec.rb index 90c24666d0..11ecb52ee7 100644 --- a/spec/system/consumer/shopping/variant_overrides_spec.rb +++ b/spec/system/consumer/shopping/variant_overrides_spec.rb @@ -8,6 +8,7 @@ RSpec.describe "shopping with variant overrides defined" do include ShopWorkflow include CheckoutRequestsHelper include UIComponentHelper + include CheckoutHelper let(:hub) { create(:distributor_enterprise, with_payment_and_shipping: true) } let(:producer) { create(:supplier_enterprise) } @@ -150,14 +151,20 @@ RSpec.describe "shopping with variant overrides defined" do expect(page).to have_selector "#edit-cart .grand-total", text: with_currency(122.22) end - pending "prices in the checkout" do + context "prices in the checkout" do it "shows the correct prices" do click_add_to_cart product1_variant1, 2 click_checkout + checkout_as_guest - expect(page).to have_selector 'form.edit_order .cart-total', text: with_currency(122.22) - expect(page).to have_selector 'form.edit_order .shipping', text: with_currency(0.00) - expect(page).to have_selector 'form.edit_order .total', text: with_currency(122.22) + fill_out_details + fill_out_billing_address + + proceed_to_payment + proceed_to_summary + + expect(page).to have_selector '.summary-right-line-value', text: with_currency(122.22) + expect(page).to have_selector '#order_total', text: with_currency(122.22) end end end From 4e16eb9c6b405ad527c013d245a608676a2c6534 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 14 May 2024 12:08:23 +0100 Subject: [PATCH 2/2] Updates spec to split checkout --- .../shopping/variant_overrides_spec.rb | 33 +++++-------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/spec/system/consumer/shopping/variant_overrides_spec.rb b/spec/system/consumer/shopping/variant_overrides_spec.rb index 11ecb52ee7..cda13c4459 100644 --- a/spec/system/consumer/shopping/variant_overrides_spec.rb +++ b/spec/system/consumer/shopping/variant_overrides_spec.rb @@ -169,11 +169,9 @@ RSpec.describe "shopping with variant overrides defined" do end end - pending "creating orders" do + describe "creating orders" do it "creates the order with the correct prices" do click_add_to_cart product1_variant1, 2 - click_checkout - complete_checkout o = Spree::Order.complete.last @@ -235,32 +233,17 @@ RSpec.describe "shopping with variant overrides defined" do private def complete_checkout + click_checkout + checkout_as_guest - within "#details" do - fill_in "First Name", with: "Some" - fill_in "Last Name", with: "One" - fill_in "Email", with: "test@example.com" - fill_in "Phone", with: "0456789012" - end + fill_out_details + fill_out_billing_address - within "#billing" do - fill_in "Address", with: "123 Street" - select "Australia", from: "Country" - select "Victoria", from: "State" - fill_in "City", with: "Melbourne" - fill_in "Postcode", with: "3066" - end + proceed_to_payment + proceed_to_summary - within "#shipping" do - choose sm.name - end - - within "#payment" do - choose pm.name - end - - place_order + click_on "Complete order" expect(page).to have_content "Your order has been processed successfully" end