From 579ea8ab43cc0b9df98c28efb90a59faeabf306b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 9 Aug 2018 11:56:31 +0200 Subject: [PATCH] Make capybara wait between valuation actions As mentioned in the comments in PR #1256: "These failures take place because the checkbox is already present before clicking in 'under valuation', and so Capybara doesn't have to wait for the 'under valuation' request to finish before clicking the checkbox." So sometimes Capybara tries to check/uncheck the checkbox at the same time that checkbox is being replaced by the new content, resulting in no request being sent to the server. Making Capybara check the page to ensure the new content is already loaded before checking/unchecking the checkbox solves the problem. --- spec/features/admin/budget_investments_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index dbb2e5a1b..d58263d2a 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1109,6 +1109,7 @@ feature 'Admin budget investments' do visit admin_budget_budget_investments_path(budget) within('#filter-subnav') { click_link 'Under valuation' } + expect(page).not_to have_link("Under valuation") within("#budget_investment_#{investment1.id}") do check "budget_investment_visible_to_valuators" @@ -1154,6 +1155,7 @@ feature 'Admin budget investments' do visit admin_budget_budget_investments_path(budget) within('#filter-subnav') { click_link 'Under valuation' } + expect(page).not_to have_link("Under valuation") within("#budget_investment_#{investment1.id}") do uncheck "budget_investment_visible_to_valuators"