-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
43 lines (33 loc) · 1.26 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'rubygems'
require 'bundler/setup'
require 'selenium-webdriver'
require 'service_manager'
desc 'Run Jasmine tests with Phantomjs'
task :phantomjs do
# Note: we are assuming phantomjs is installed and available in $PATH
sh %{phantomjs lib/phantom-jasmine/run_jasmine_test.coffee SpecRunner.html}
end
desc 'Run Jasmine tests with Webdriver'
task :webdriver do
# Use service_manager to start a simple web server
ServiceManager.start
# Detect which browser we want to run
case ENV['browser']
when 'chromium'
# TODO: detect chromium path? I use Linux, this is the path on my machine
Selenium::WebDriver::Chrome.path = '/usr/lib/chromium-browser/chromium-browser'
driver = Selenium::WebDriver.for :chrome
when 'firefox'
driver = Selenium::WebDriver.for :firefox
else
raise ArgumentError, 'Unknown browser requested'
end
# Finally, we load the spec runner HTML page with WebDriver
driver.navigate.to 'http://localhost:8000/SpecRunner.html'
status = driver.execute_script('return consoleReporter.status;')
output = driver.execute_script('return consoleReporter.getLogsAsString();')
driver.quit
print output
# Make sure to exit with code > 0 if there is a test failure
raise RuntimeError, 'Failure' unless status === 'success'
end