Remove redundant visibility matcher usages
By default, Capybara only finds visible elements, so adding the `visible: true` option is usually redundant. We were using it sometimes to make it an obvious contrast with another test using `visible: false`. However, from the user's perspective, we don't care whether the element has been removed from the DOM or has been hidden, so we can just test that the visible selector can't be found. Besides, using `visible: false` means the test will also pass if the element is present and visible. However, we want the test to fail if the element is visible. That's why a couple of JavaScript-dependant tests were passing even when JavaScript was disabled.
This commit is contained in:
@@ -5,9 +5,11 @@ module Votes
|
||||
end
|
||||
|
||||
def expect_message_you_need_to_sign_in_to_vote_comments
|
||||
expect(page).to have_content "You must sign in or sign up to vote"
|
||||
expect(page).to have_selector(".participation-allowed", visible: false)
|
||||
expect(page).to have_selector(".participation-not-allowed", visible: true)
|
||||
within(".participation-not-allowed") do
|
||||
expect(page).to have_content "You must sign in or sign up to vote"
|
||||
end
|
||||
|
||||
expect(page).not_to have_selector(".participation-allowed")
|
||||
end
|
||||
|
||||
def expect_message_to_many_anonymous_votes
|
||||
|
||||
Reference in New Issue
Block a user