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.
This commit is contained in:
Javi Martín
2018-08-09 11:56:31 +02:00
parent b2e15facce
commit 579ea8ab43

View File

@@ -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"