Don't click two places at the same time

Quoting from commit 57bda006b5:

> 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.

We're doing the same thing for the other tests that click the "Search"
button and then clicked on a link. We're also making sure the language
selector changes before clicking it again.
This commit is contained in:
Javi Martín
2025-03-10 22:32:28 +01:00
parent d3df20ba88
commit 548e282564
3 changed files with 17 additions and 0 deletions

View File

@@ -375,9 +375,12 @@ describe "Admin edit translatable records", :admin do
translatable.update!(status: nil)
visit admin_polymorphic_path(translatable, action: :edit)
expect_to_have_language_selected "English"
click_link "Remove language"
expect_to_have_language_selected "Español"
click_link "Remove language"
expect_to_have_language_selected nil
click_button "Update milestone"
@@ -388,9 +391,12 @@ describe "Admin edit translatable records", :admin do
translatable.update!(status: Milestone::Status.first)
visit admin_polymorphic_path(translatable, action: :edit)
expect_to_have_language_selected "English"
click_link "Remove language"
expect_to_have_language_selected "Español"
click_link "Remove language"
expect_to_have_language_selected nil
click_button "Update milestone"
@@ -480,6 +486,8 @@ describe "Admin edit translatable records", :admin do
click_link "Remove language"
select "Español", from: "Current language"
click_link "Remove language"
expect_to_have_language_selected "Français"
click_button "Save"
expect(page).to have_content "Polls description updated successfully"

View File

@@ -597,6 +597,9 @@ describe "Debates" do
visit debates_path
fill_in "search", with: "Show you got"
click_button "Search"
expect(page).to have_content "Search results"
click_link "newest"
expect(page).to have_css "a.is-active", text: "newest"
@@ -621,6 +624,9 @@ describe "Debates" do
visit debates_path
fill_in "search", with: "Show you got"
click_button "Search"
expect(page).to have_content "Search results"
click_link "recommendations"
expect(page).to have_css "a.is-active", text: "recommendations"

View File

@@ -1249,6 +1249,9 @@ describe "Proposals" do
visit proposals_path
fill_in "search", with: "Show you got"
click_button "Search"
expect(page).to have_content "Search results"
click_link "recommendations"
expect(page).to have_css "a.is-active", text: "recommendations"