Skip to content

Commit

Permalink
Run canopy on OSX and Linux with mono
Browse files Browse the repository at this point in the history
- Added Safari to the available browsers
- Path for the drivers are is now different depending on the OS
  • Loading branch information
pedro-ramirez-suarez committed Aug 20, 2015
1 parent 40313e9 commit b50b1bb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let aurora = FirefoxWithPath(@"C:\Program Files (x86)\Aurora\firefox.exe")
let ie = IE
let chrome = Chrome
let phantomJS = PhantomJS
let safari = Safari
let phantomJSProxyNone = PhantomJSProxyNone

let mutable browsers = []
Expand Down Expand Up @@ -660,6 +661,7 @@ let start b =
//also download IEDriverServer and place in c:\ or configure with ieDir
//firefox just works
//for phantomjs download it and put in c:\ or configure with phantomJSDir
//for Safari download it and put in c:\ or configure with safariDir
browser <-
match b with
Expand All @@ -677,6 +679,7 @@ let start b =
| FirefoxWithProfile profile -> new FirefoxDriver(profile) :> IWebDriver
| FirefoxWithPath path -> new FirefoxDriver(Firefox.FirefoxBinary(path), Firefox.FirefoxProfile()) :> IWebDriver
| FirefoxWithUserAgent userAgent -> firefoxWithUserAgent userAgent
| Safari ->new Safari.SafariDriver() :> IWebDriver
| PhantomJS ->
autoPinBrowserRightOnLaunch <- false
new PhantomJS.PhantomJSDriver(phantomJSDir) :> IWebDriver
Expand Down
16 changes: 13 additions & 3 deletions src/canopy/configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
open reporters
open System

//location of drivers depending on OS
let FolderByOSType =
if System.Environment.OSVersion.Platform = PlatformID.MacOSX then
@"/usr/bin/"
elif System.Environment.OSVersion.Platform = PlatformID.Unix then
@"/usr/bin/"
else
@"c:\"

//runner related
let failFast = ref false
let mutable failScreenshotPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\canopy\"

let mutable chromeDir = @"c:\"
let mutable ieDir = @"c:\"
let mutable phantomJSDir = @"c:\"
let mutable chromeDir = FolderByOSType
let mutable ieDir = FolderByOSType
let mutable phantomJSDir = FolderByOSType
let mutable safariDir = FolderByOSType
let mutable elementTimeout = 10.0
let mutable compareTimeout = 10.0
let mutable pageTimeout = 10.0
Expand Down
1 change: 1 addition & 0 deletions src/canopy/reporters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
| FirefoxWithPath path -> new OpenQA.Selenium.Firefox.FirefoxDriver(Firefox.FirefoxBinary(path), Firefox.FirefoxProfile()) :> IWebDriver
| ChromeWithUserAgent userAgent -> raise(System.Exception("Sorry ChromeWithUserAgent can't be used for LiveHtmlReporter"))
| FirefoxWithUserAgent userAgent -> raise(System.Exception("Sorry FirefoxWithUserAgent can't be used for LiveHtmlReporter"))
| Safari -> new OpenQA.Selenium.Safari.SafariDriver() :> IWebDriver
| PhantomJS | PhantomJSProxyNone -> raise(System.Exception("Sorry PhantomJS can't be used for LiveHtmlReporter"))
| Remote(_,_) -> raise(System.Exception("Sorry Remote can't be used for LiveHtmlReporter"))
Expand Down
1 change: 1 addition & 0 deletions src/canopy/types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type BrowserStartMode =
| ChromeWithOptions of Chrome.ChromeOptions
| ChromeWithOptionsAndTimeSpan of Chrome.ChromeOptions * TimeSpan
| ChromeWithUserAgent of string
| Safari
| PhantomJS
| PhantomJSProxyNone
| Remote of string * ICapabilities
Expand Down
3 changes: 2 additions & 1 deletion tests/basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ open configuration
open reporters
open types

start chrome
//start chrome
start Safari
let mainBrowser = browser
elementTimeout <- 3.0
compareTimeout <- 3.0
Expand Down

0 comments on commit b50b1bb

Please sign in to comment.