From 24a66f16f29b1253c3f6b6002b8ee6eb1e82a97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 23 Mar 2021 18:33:07 +0100 Subject: [PATCH] Close datepicker in tests after filling in dates Some tests were failing depending on the window resolution due to the datepicker making it impossible to click the "Filter" button. They were also failing if using `clear: :backspace` to fill in those fields. So we're focusing on a different field in order to hide the datepicker and click the "Filter" button. --- spec/system/advanced_search_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/system/advanced_search_spec.rb b/spec/system/advanced_search_spec.rb index 24dfc3361..f05545839 100644 --- a/spec/system/advanced_search_spec.rb +++ b/spec/system/advanced_search_spec.rb @@ -274,6 +274,7 @@ describe "Advanced search", :js do select "Customized", from: "js-advanced-search-date-min" fill_in "advanced_search_date_min", with: 7.days.ago.strftime("%d/%m/%Y") fill_in "advanced_search_date_max", with: 1.day.ago.strftime("%d/%m/%Y") + find_field("With the text").click click_button "Filter" within("#debates") do @@ -296,6 +297,7 @@ describe "Advanced search", :js do select "Customized", from: "js-advanced-search-date-min" fill_in "advanced_search_date_min", with: 4000.years.ago.strftime("%d/%m/%Y") fill_in "advanced_search_date_max", with: "13/13/2199" + find_field("With the text").click click_button "Filter" expect(page).to have_content("There are 3 citizen proposals") @@ -355,6 +357,7 @@ describe "Advanced search", :js do select "Customized", from: "js-advanced-search-date-min" fill_in "advanced_search_date_min", with: 7.days.ago.strftime("%d/%m/%Y") fill_in "advanced_search_date_max", with: 1.day.ago.strftime("%d/%m/%Y") + find_field("With the text").click click_button "Filter" expect(page).to have_content("citizen proposals cannot be found")