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 class Cat
meow: -> "meow" meow: -> "meow"
console.log("made it")
""" """
Scenario: Use the Node runner using Jasmine Scenario: Use the Node runner using Jasmine

View File

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

View File

@ -18,7 +18,11 @@ module Flowerbox
end end
post '/results' do 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 end
get %r{^/__F__(/.*)$} do |file| get %r{^/__F__(/.*)$} do |file|
@ -63,6 +67,10 @@ module Flowerbox
end end
end end
def log(msg)
puts msg
end
def template def template
env = start_test_environment env = start_test_environment
@ -70,6 +78,22 @@ module Flowerbox
<html> <html>
<head> <head>
<title>Flowerbox - Selenium Runner</title> <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")} #{template_files.join("\n")}
</head> </head>
<body> <body>