Don't click two places at the same time

When clicking the button "Search", the link "newest" is already present,
so capybara might click the "newest" link before the "Search" request is
finished, leading to unexpected results.

Checking the page to make sure the "Search" request has finished before
clicking the "newest" link solves the problem.
This commit is contained in:
Javi Martín
2019-06-25 19:44:50 +02:00
parent 79852716f2
commit 57bda006b5

View File

@@ -1478,7 +1478,11 @@ describe "Proposals" do
visit proposals_path
fill_in "search", with: "Show what you got"
click_button "Search"
expect(page).to have_content "Search results"
click_link "newest"
expect(page).to have_selector("a.is-active", text: "newest")
within("#proposals") do