Files
nairobi/spec/support/common_actions/budgets.rb
Javi Martín 202fe2953b Fix matchers checking elements are obscured
These tests were supposed to check the link to vote is hidden when users
don't have permission to vote. However, they aren't testing that, since
the `visible: false` option also matches visible elements. The links are
actually considered visible since they're displayed by the browser;
there's just another element on top of them.

Using `obscured: true` instead of `visible: false` solves the issue.
However, while the `obscured` option is true when the element is hidden
by another element, it's also true when the element is not currently
visible in the browser window, so in some cases we need to scroll so the
condition is effective.
2020-10-25 14:23:53 +01:00

19 lines
478 B
Ruby

module Budgets
def expect_message_organizations_cannot_vote
expect(page).to have_content "Organization"
expect(page).to have_selector(".in-favor a", obscured: true)
end
def hover_over_ballot
scroll_to find("div.ballot"), align: :bottom
find("div.ballot").hover
end
def add_to_ballot(investment_title)
within(".budget-investment", text: investment_title) do
find(".add a").click
expect(page).to have_content "Remove"
end
end
end