Created
June 21, 2013 13:35
-
-
Save bogdanRada/5831183 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_autocomplete(field, options = {}) | |
fill_in field, :with => options[:with] | |
page.execute_script("$('##{field}').trigger('focus');") | |
page.execute_script ("$('##{field}').trigger('keydown');") | |
selector = "span.tt-dropdown-menu div.tt-suggestion:contains('#{options[:select]}')" | |
page.should have_selector selector | |
page.execute_script("$(\"#{selector}\").mouseenter().click()") | |
page.should have_field(field, :with => options[:select]) | |
end | |
scenario "typeahead test" do | |
test_autocomplete("platform_primary_domain",{:with=> "1.com", :select => "domain_name_1.com"}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment