# Utility step definitions for common use across features Given /^I am logged in as an? (.*?)$/ do |userType| as_user(userType) { log_in } end # Check for link visibility within a section # # @param text the link text (case-sensitive) # @var scope the scope of the search. Defaults to current_page. # # Usage: # Given I am looking at the header # sets scope to header # Then I see a link to "Sign Up" # searches for link with text of "Sign Up" within header # Then /^I should see a link to "(.*?)"$/ do |text| @scope = @current_page unless @scope expect(@scope.link_element(text: text)).to be_visible end # Check visibility of multiple links # # @param links_table table of links (simple list, no hash) # Then /^I should see the links:$/ do |links_table| @scope = @current_page unless @scope links_table.raw.each do |link| expect(@scope.link_element(text: link[0])).to be_visible end end