From d9e2a80a4fadb6e0b7ccc62894f66dc046f7afe2 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 9 Nov 2020 11:26:12 +0000 Subject: [PATCH] Improve flaky order cycle spec There are various points in this spec where content is dynamically added to the DOM, but Capybara is jumping ahead to start interacting with it before it as actually finished loading. --- spec/features/admin/order_cycles/simple_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/features/admin/order_cycles/simple_spec.rb b/spec/features/admin/order_cycles/simple_spec.rb index 98cb3f0abf..f6acf1e9c5 100644 --- a/spec/features/admin/order_cycles/simple_spec.rb +++ b/spec/features/admin/order_cycles/simple_spec.rb @@ -217,8 +217,11 @@ feature ' select 'Permitted distributor', from: 'new_distributor_id' click_button 'Add distributor' + 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' + + expect(page).to have_input 'order_cycle_outgoing_exchange_1_pickup_time' fill_in 'order_cycle_outgoing_exchange_1_pickup_time', with: 'pickup time 2' fill_in 'order_cycle_outgoing_exchange_1_pickup_instructions', with: 'pickup instructions' @@ -389,12 +392,15 @@ feature ' expect(page).to have_selector "tr.supplier-#{supplier_managed.id}" expect(page).to have_selector 'tr.supplier', count: 1 + expect(page).to_not have_content "Loading..." + # Open the products list for managed_supplier's incoming exchange within "tr.supplier-#{supplier_managed.id}" do page.find("td.products").click end # I should be able to see and toggle v1 + expect(page).to have_selector ".exchange-product-variant" expect(page).to have_checked_field "order_cycle_incoming_exchange_0_variants_#{v1.id}", disabled: false uncheck "order_cycle_incoming_exchange_0_variants_#{v1.id}"