From d21cbf994ba2bda0e5402f08bbc67413b4edb140 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 15 Jun 2019 13:10:54 +1200 Subject: [PATCH] poltergeist work around not needed anymore --- spec/features/crops/alternate_name_spec.rb | 8 ++++---- spec/features/plantings/planting_a_crop_spec.rb | 8 ++------ spec/support/feature_helpers.rb | 5 ----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/spec/features/crops/alternate_name_spec.rb b/spec/features/crops/alternate_name_spec.rb index 2656517eb..04c344409 100644 --- a/spec/features/crops/alternate_name_spec.rb +++ b/spec/features/crops/alternate_name_spec.rb @@ -43,10 +43,10 @@ describe "Alternate names", js: true do it "Crop wranglers can delete alternate names" do visit crop_path(alternate_eggplant.crop) click_link 'aubergine' - expect(page).to have_link "Delete", - href: alternate_name_path(alternate_eggplant) - within('.alternate_names') { click_on "Delete" } - dismiss_confirm {click_link 'OK'} + expect(page).to have_link "Delete", href: alternate_name_path(alternate_eggplant) + accept_confirm do + click_link 'Delete' + end expect(pending_alt_name.status_code).to equal 200 expect(page).not_to have_content alternate_eggplant.name expect(page).to have_content 'Alternate name was successfully deleted' diff --git a/spec/features/plantings/planting_a_crop_spec.rb b/spec/features/plantings/planting_a_crop_spec.rb index 28a6be9cc..24925b073 100644 --- a/spec/features/plantings/planting_a_crop_spec.rb +++ b/spec/features/plantings/planting_a_crop_spec.rb @@ -207,11 +207,7 @@ describe "Planting a crop", :js, :elasticsearch do fill_in "When?", with: "2014-07-01" check "Mark as finished" fill_in "Finished date", with: "2014-08-30" - - # Trigger click instead of using Capybara"s uncheck - # because a date selection widget is overlapping - # the checkbox preventing interaction. - find("#planting_finished").trigger 'click' + uncheck 'Mark as finished' end # Javascript removes the finished at date when the @@ -219,7 +215,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(find("#planting_finished_at").value).to eq("") within "form#new_planting" do - find("#planting_finished").trigger 'click' + check 'Mark as finished' end # The finished at date was cached in Javascript in diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 4b87dc66c..857e6b250 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -1,12 +1,7 @@ module FeatureHelpers def fill_autocomplete(field, options = {}) Crop.reindex if ENV["GROWSTUFF_ELASTICSEARCH"] == "true" - fill_in field, with: options[:with] - - # Not needed if using a real browser headless instead of poltergeist - # page.execute_script " $('##{field}').trigger('focus'); " - # page.execute_script " $('##{field}').trigger('keydown'); " end def select_from_autocomplete(select)