Last active
April 28, 2016 20:23
-
-
Save jnicklas/754cc8ed42122f52b92abc7196c437e9 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
source "http://rubygems.org" | |
ruby "2.3.0" | |
gem "selenium-webdriver" | |
gem "capybara", "2.7.0" |
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
GEM | |
remote: http://rubygems.org/ | |
specs: | |
addressable (2.4.0) | |
capybara (2.7.0) | |
addressable | |
mime-types (>= 1.16) | |
nokogiri (>= 1.3.3) | |
rack (>= 1.0.0) | |
rack-test (>= 0.5.4) | |
xpath (~> 2.0) | |
childprocess (0.5.9) | |
ffi (~> 1.0, >= 1.0.11) | |
ffi (1.9.10) | |
mime-types (3.0) | |
mime-types-data (~> 3.2015) | |
mime-types-data (3.2016.0221) | |
mini_portile2 (2.0.0) | |
nokogiri (1.6.7.2) | |
mini_portile2 (~> 2.0.0.rc2) | |
rack (1.6.4) | |
rack-test (0.6.3) | |
rack (>= 1.0) | |
rubyzip (1.2.0) | |
selenium-webdriver (2.53.0) | |
childprocess (~> 0.5) | |
rubyzip (~> 1.0) | |
websocket (~> 1.0) | |
websocket (1.2.2) | |
xpath (2.0.0) | |
nokogiri (~> 1.3) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
capybara (= 2.7.0) | |
selenium-webdriver | |
BUNDLED WITH | |
1.11.2 |
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" | |
queue = Queue.new | |
# this thread just writes stuff to stdout, we do this so we're *sure* of the order of things | |
Thread.new do | |
loop do | |
puts queue.pop | |
end | |
end | |
html = DATA.read | |
app = proc do |env| | |
sleep 0.2 | |
queue.push "Request #{env["PATH_INFO"]}" | |
[200, { "Content-Type" => "text/html" }, [html] ] | |
end | |
Capybara.app = app | |
Capybara.current_driver = :selenium | |
Capybara.current_session.visit("/") | |
Capybara.using_session :another do | |
Capybara.current_session.visit("/") | |
end | |
sleep 1 | |
queue.push "reset" | |
Capybara.reset_sessions! | |
queue.push "done" | |
sleep 2 | |
__END__ | |
<!doctype html> | |
<html> | |
<body> | |
<script> | |
var counter = 25; | |
window.addEventListener('beforeunload', function(event) { | |
send(); | |
}); | |
function send() { | |
counter--; | |
if(counter <= 0) clearInterval(int); | |
var oReq = new XMLHttpRequest(); | |
oReq.open("GET", "/ajax"); | |
oReq.send(); | |
}; | |
var int = setInterval(send, 10); | |
</script> | |
</body> | |
</html> |
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
Request / | |
Request /ajax | |
Request /ajax | |
Request /favicon.ico | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request / | |
Request /ajax | |
Request /favicon.ico | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
Request /ajax | |
reset | |
Request /ajax | |
Request /ajax | |
Request /favicon.ico | |
Request /ajax | |
done | |
Request /ajax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment