Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created February 9, 2019 19:15
Show Gist options
  • Save twalpole/cd87c608a20aa1759d0ca2f69e72f356 to your computer and use it in GitHub Desktop.
Save twalpole/cd87c608a20aa1759d0ca2f69e72f356 to your computer and use it in GitHub Desktop.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'capybara'
gem 'puma'
gem 'apparition'
gem 'selenium-webdriver'
end
require 'capybara/apparition'
require 'selenium-webdriver'
require "capybara/dsl"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
%i[selenium rack_test apparition].each do |driver|
puts "Using #{driver}"
sess = Capybara::Session.new(driver, app)
sess.visit('/')
sess.assert_selector(:css, 'div', text: 'Your balance: $100')
end
__END__
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
</head>
<body>
<div>
Your balance:
$100
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment