From 57bda006b50b2e0de6ed42079bf5947363c2ca8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 25 Jun 2019 19:44:50 +0200 Subject: [PATCH] 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. --- spec/features/proposals_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 426f13a0a..4a6c3b4de 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -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