Created
January 23, 2017 17:03
-
-
Save twalpole/3ae9f5313758ff308fec3bc0cbe5bea1 to your computer and use it in GitHub Desktop.
Test fill_in with number field
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 'selenium/webdriver' | |
require 'capybara/dsl' | |
require 'rspec' | |
require 'capybara/rspec' | |
require 'byebug' | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
RSpec.configure { |c| c.include Capybara::RSpecMatchers } | |
test = describe "sample test" do | |
it "should be able find by value" do | |
sess = Capybara::Session.new(:selenium, app) | |
sess.visit("/") | |
sess.fill_in('foo', with: '100') | |
expect(sess).to have_field('foo', with: '100') | |
end | |
end | |
puts test.run | |
__END__ | |
<!doctype html> | |
<html> | |
<head> | |
<title>Some title</title> | |
</head> | |
<body> | |
<label for="foo">Foo</label> | |
<input class="form-control" id="foo" type="number" value="0"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment