Created
February 9, 2019 19:15
-
-
Save twalpole/cd87c608a20aa1759d0ca2f69e72f356 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 '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