diff --git a/spec/support/wait_for_ajax.rb b/spec/support/wait_for_ajax.rb deleted file mode 100644 index 2cfeb881eb..0000000000 --- a/spec/support/wait_for_ajax.rb +++ /dev/null @@ -1,9 +0,0 @@ -def wait_for_ajax - Timeout.timeout(Capybara.default_max_wait_time) do - loop until finished_all_ajax_requests? - end -end - -def finished_all_ajax_requests? - page.evaluate_script("jQuery.active").zero? -end diff --git a/spec/system/adjustment_system_spec.rb b/spec/system/adjustment_system_spec.rb index 4d857af15e..6db5ff3adb 100644 --- a/spec/system/adjustment_system_spec.rb +++ b/spec/system/adjustment_system_spec.rb @@ -21,7 +21,7 @@ end it "allows you to choose items that do not yet exist" do - wait_for_ajax + expect(page).to have_select("adjustment_line_items_attributes_0_item_id", with_options: [item.name], wait: 10) select Item.active.last.name, from: "adjustment_line_items_attributes_0_item_id" fill_in "adjustment_line_items_attributes_0_quantity", with: add_quantity.to_s diff --git a/spec/system/distribution_system_spec.rb b/spec/system/distribution_system_spec.rb index fe8659d377..679a1d4231 100644 --- a/spec/system/distribution_system_spec.rb +++ b/spec/system/distribution_system_spec.rb @@ -119,7 +119,7 @@ visit @url_prefix + "/distributions/new" select @partner.name, from: "Partner" select @storage_location.name, from: "From storage location" - wait_for_ajax + expect(page).to have_select("distribution_line_items_attributes_0_item_id", with_options: [item.name], wait: 10) select item.name, from: "distribution_line_items_attributes_0_item_id" fill_in "distribution_line_items_attributes_0_quantity", with: 18