Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created November 21, 2017 04:38
Show Gist options
  • Save twalpole/2b9852cbbe01dc6b14916283398fceb2 to your computer and use it in GitHub Desktop.
Save twalpole/2b9852cbbe01dc6b14916283398fceb2 to your computer and use it in GitHub Desktop.
require "capybara/dsl"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium_chrome, app)
sess.visit("/")
sess.fill_in('phone_number', with: '0987654321')
sess.assert_selector(:field, 'phone_number', with: '0987654321')
__END__
<!doctype html>
<html>
<head>
<title>Some title</title>
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<script src="https://raw.githubusercontent.com/isocra/TableDnD/master/js/jquery.tablednd.js"></script
</head>
<body>
<input name="phone_number"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment