From 16a8e97737fe33647c967091c329f0c161b354bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 10 Apr 2021 14:17:49 +0200 Subject: [PATCH] Explicitly use rack driver in moderation specs Just like we mentioned in commit 5f0c422eb, the filter "Mark as viewed" doesn't work properly, so here's a case where the test would fail with JavaScript not because the test is wrong, but due to a bug. The test was passing simplify because there was a typo in the CSS selector, which was supposed to select an element by ID but didn't have the "#" prefix. For now we're keeping the test as it was, but eventually we'll have to fix the bug. --- spec/system/moderation/budget_investments_spec.rb | 6 ++---- spec/system/moderation/comments_spec.rb | 5 ++--- spec/system/moderation/debates_spec.rb | 5 ++--- spec/system/moderation/proposals_spec.rb | 5 ++--- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/spec/system/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb index a4520ce47..03b91e87e 100644 --- a/spec/system/moderation/budget_investments_spec.rb +++ b/spec/system/moderation/budget_investments_spec.rb @@ -85,10 +85,8 @@ describe "Moderate budget investments" do expect(investment.author).to be_hidden end - scenario "Ignore the investment" do - accept_confirm { click_button "Mark as viewed" } - - expect(page).not_to have_css("investment_#{investment.id}") + scenario "Ignore the investment", :no_js do + click_button "Mark as viewed" investment.reload diff --git a/spec/system/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb index 7c74bb98d..b81512b5d 100644 --- a/spec/system/moderation/comments_spec.rb +++ b/spec/system/moderation/comments_spec.rb @@ -101,10 +101,9 @@ describe "Moderate comments" do expect(comment.user).to be_hidden end - scenario "Ignore the comment" do - accept_confirm { click_button "Mark as viewed" } + scenario "Ignore the comment", :no_js do + click_button "Mark as viewed" - expect(page).not_to have_css("comment_#{comment.id}") expect(comment.reload).to be_ignored_flag expect(comment.reload).not_to be_hidden expect(comment.user).not_to be_hidden diff --git a/spec/system/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb index 1fa2e19e1..3f4fc3c42 100644 --- a/spec/system/moderation/debates_spec.rb +++ b/spec/system/moderation/debates_spec.rb @@ -74,10 +74,9 @@ describe "Moderate debates" do expect(debate.author).to be_hidden end - scenario "Ignore the debate" do - accept_confirm { click_button "Mark as viewed" } + scenario "Ignore the debate", :no_js do + click_button "Mark as viewed" - expect(page).not_to have_css("debate_#{debate.id}") expect(debate.reload).to be_ignored_flag expect(debate.reload).not_to be_hidden expect(debate.author).not_to be_hidden diff --git a/spec/system/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb index 2ff3e3084..fdd19d1dc 100644 --- a/spec/system/moderation/proposals_spec.rb +++ b/spec/system/moderation/proposals_spec.rb @@ -73,10 +73,9 @@ describe "Moderate proposals" do expect(proposal.author).to be_hidden end - scenario "Ignore the proposal" do - accept_confirm { click_button "Mark as viewed" } + scenario "Ignore the proposal", :no_js do + click_button "Mark as viewed" - expect(page).not_to have_css("proposal_#{proposal.id}") expect(proposal.reload).to be_ignored_flag expect(proposal.reload).not_to be_hidden expect(proposal.author).not_to be_hidden