better selenium support

This commit is contained in:
John Bintz 2012-02-23 20:34:02 -05:00
parent af77c8f1b3
commit cbdb553c42
3 changed files with 28 additions and 5 deletions

View File

@ -15,6 +15,8 @@ Feature: Basic Run
"""
class Cat
meow: -> "meow"
console.log("made it")
"""
Scenario: Use the Node runner using Jasmine

View File

@ -1,6 +1,3 @@
class jasmine.SimpleSeleniumReporter
reportRunnerResults: (runner) ->
xhr = new XMLHttpRequest()
xhr.open("POST", "/results")
xhr.send(runner.results().totalCount + '/' + runner.results().failedCount)
Flowerbox.contact("results", runner.results().totalCount + '/' + runner.results().failedCount)

View File

@ -18,7 +18,11 @@ module Flowerbox
end
post '/results' do
runner.results = request.env['rack.input'].read
runner.results = request.body.string
end
post '/log' do
runner.log(request.body.string)
end
get %r{^/__F__(/.*)$} do |file|
@ -63,6 +67,10 @@ module Flowerbox
end
end
def log(msg)
puts msg
end
def template
env = start_test_environment
@ -70,6 +78,22 @@ module Flowerbox
<html>
<head>
<title>Flowerbox - Selenium Runner</title>
<script type="text/javascript">
this.Flowerbox = {
contact: function(url, message) {
xhr = new XMLHttpRequest();
xhr.open("POST", "/" + url);
xhr.send(message);
}
}
console._log = console.log;
console.log = function(msg) {
console._log(msg);
Flowerbox.contact("log", msg);
}
</script>
#{template_files.join("\n")}
</head>
<body>