Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Safari, changes required to run canopy on OSX and Linux(mono) #211

Merged
merged 1 commit into from
Aug 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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