Created
September 23, 2016 16:20
-
-
Save twalpole/a12aeef278c9c714b9e078ce2adfda99 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
require "capybara" | |
require "benchmark" | |
require "capybara/poltergeist" | |
# require "selenium-webdriver" | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
# sess = Capybara::Session.new(:selenium, app) | |
sess = Capybara::Session.new(:poltergeist, app) | |
sess.visit("/") | |
sess.find("#tags").send_keys "Java" | |
sess.find("ul.ui-autocomplete li.ui-menu-item", text: "JavaScript").click() | |
sess.assert_selector(:field, 'tags', with: 'JavaScript') | |
__END__ | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>jQuery UI Autocomplete - Default functionality</title> | |
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> | |
<link rel="stylesheet" href="/resources/demos/style.css"> | |
<script src="https://code.jquery.com/jquery-1.12.4.js"></script> | |
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | |
<script> | |
$( function() { | |
var availableTags = [ | |
"ActionScript", | |
"AppleScript", | |
"Asp", | |
"BASIC", | |
"C", | |
"C++", | |
"Clojure", | |
"COBOL", | |
"ColdFusion", | |
"Erlang", | |
"Fortran", | |
"Groovy", | |
"Haskell", | |
"Java", | |
"JavaScript", | |
"Lisp", | |
"Perl", | |
"PHP", | |
"Python", | |
"Ruby", | |
"Scala", | |
"Scheme" | |
]; | |
$( "#tags" ).autocomplete({ | |
source: availableTags | |
}); | |
} ); | |
</script> | |
</head> | |
<body> | |
<div class="ui-widget"> | |
<label for="tags">Tags: </label> | |
<input id="tags"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment