From 2bcf84d9a9e3b3699f6cf4bfe38953e05e3c6bbc Mon Sep 17 00:00:00 2001 From: Abdul Aziz Ali Date: Wed, 24 Jul 2024 17:38:10 +0800 Subject: [PATCH] Add outgoing exchange scenario spec #11326 --- spec/system/admin/order_cycles/simple_spec.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/system/admin/order_cycles/simple_spec.rb b/spec/system/admin/order_cycles/simple_spec.rb index a546b25fbd..0c48f28f3d 100644 --- a/spec/system/admin/order_cycles/simple_spec.rb +++ b/spec/system/admin/order_cycles/simple_spec.rb @@ -154,6 +154,22 @@ describe ' create(:enterprise_fee, :flat_rate, enterprise: supplier_permitted, name: 'Supplier distributor fee4') } + let!(:distributor_permitted_fee1) { + create(:enterprise_fee, :per_item, enterprise: distributor_permitted, + name: 'Distributor distributor fee1') + } + let!(:distributor_permitted_fee2) { + create(:enterprise_fee, :flat_rate, enterprise: distributor_permitted, + name: 'Distributor distributor fee2') + } + let!(:distributor_permitted_fee3) { + create(:enterprise_fee, :per_item, enterprise: distributor_permitted, + name: 'Distributor distributor fee3') + } + let!(:distributor_permitted_fee4) { + create(:enterprise_fee, :flat_rate, enterprise: distributor_permitted, + name: 'Distributor distributor fee4') + } let!(:shipping_method) { create(:shipping_method, distributors: [distributor_managed, distributor_unmanaged, distributor_permitted]) @@ -301,6 +317,18 @@ describe ' click_button 'Add distributor' expect(page).to have_content "Permitted distributor" + within("tr.distributor-#{distributor_permitted.id}") { click_button 'Add fee' } + expect(page).to have_select( + "order_cycle_outgoing_exchange_1_enterprise_fees_0_enterprise_id", minimum: 1 + ) + select "Permitted distributor", + from: "order_cycle_outgoing_exchange_1_enterprise_fees_0_enterprise_id" + expect(page).to have_select( + "order_cycle_outgoing_exchange_1_enterprise_fees_0_enterprise_fee_id", + options: ["", distributor_permitted_fee1.name, distributor_permitted_fee2.name, + distributor_permitted_fee3.name, distributor_permitted_fee4.name] + ) + expect(page).to have_input 'order_cycle_outgoing_exchange_0_pickup_time' fill_in 'order_cycle_outgoing_exchange_0_pickup_time', with: 'pickup time' fill_in 'order_cycle_outgoing_exchange_0_pickup_instructions', with: 'pickup instructions'