Skip to content

Instantly share code, notes, and snippets.

@hybridknight
Created June 23, 2015 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hybridknight/4cbe3e057cd13a10a3eb to your computer and use it in GitHub Desktop.
Save hybridknight/4cbe3e057cd13a10a3eb to your computer and use it in GitHub Desktop.
typeahead.js spec support for capybara, poltergeist, and selenium
def fill_in_autocomplete(selector, value)
find("#{selector}.typeahead.tt-input").native.send_keys value
end
def choose_autocomplete(text)
expect(page).to have_css(".tt-suggestion p", text: text, visible: false)
script = %Q{ $('.tt-suggestion:contains("#{text}")').click() }
page.execute_script(script)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment