Skip to content

Commit

Permalink
Improve support for chromium, fixes #276
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Jul 15, 2016
1 parent 2f3ca1b commit 2f31f90
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/canopy/canopy.fs
Expand Up @@ -30,6 +30,8 @@ let edgeBETA = EdgeBETA
(* documented/actions *)
let chrome = Chrome
(* TODO/documented/actions *)
let chromium = Chromium
(* TODO/documented/actions *)
let phantomJS = PhantomJS
(* TODO/documented/actions *)
let safari = Safari
Expand Down Expand Up @@ -794,12 +796,16 @@ let start b =
| IEWithOptionsAndTimeSpan(options, timeSpan) -> new IE.InternetExplorerDriver(ieDir, options, timeSpan) :> IWebDriver
| EdgeBETA -> new Edge.EdgeDriver(edgeDir) :> IWebDriver
| Chrome ->
let options = OpenQA.Selenium.Chrome.ChromeOptions()
options.AddArgument("test-type") //https://code.google.com/p/chromedriver/issues/detail?id=799
new Chrome.ChromeDriver(chromeDir, options) :> IWebDriver
let options = OpenQA.Selenium.Chrome.ChromeOptions()
options.AddArgument("test-type") //https://code.google.com/p/chromedriver/issues/detail?id=799
new Chrome.ChromeDriver(chromeDir, options) :> IWebDriver
| ChromeWithOptions options -> new Chrome.ChromeDriver(chromeDir, options) :> IWebDriver
| ChromeWithUserAgent userAgent -> chromeWithUserAgent userAgent
| ChromeWithOptionsAndTimeSpan(options, timeSpan) -> new Chrome.ChromeDriver(chromeDir, options, timeSpan) :> IWebDriver
| Chromium ->
let options = OpenQA.Selenium.Chrome.ChromeOptions()
options.AddArgument("test-type") //https://code.google.com/p/chromedriver/issues/detail?id=799
new Chrome.ChromeDriver(chromiumDir, options) :> IWebDriver
| Firefox -> new FirefoxDriver() :> IWebDriver
| FirefoxWithProfile profile -> new FirefoxDriver(profile) :> IWebDriver
| FirefoxWithPath path -> new FirefoxDriver(new Firefox.FirefoxBinary(path), Firefox.FirefoxProfile()) :> IWebDriver
Expand Down
8 changes: 8 additions & 0 deletions src/canopy/configuration.fs
Expand Up @@ -10,6 +10,12 @@ let folderByOSType =
| PlatformID.Unix -> @"/usr/bin/"
| _ -> @"c:\"

let folderByOSTypeChromium =
match System.Environment.OSVersion.Platform with
| PlatformID.MacOSX
| PlatformID.Unix -> @"/usr/lib/chromium-browser"
| _ -> @"c:\"

//runner related
(* documented/configuration *)
let failFast = ref false
Expand All @@ -20,6 +26,8 @@ let mutable failScreenshotFileName = fun (test : types.Test) (suite: types.suite

(* documented/configuration *)
let mutable chromeDir = folderByOSType
(* TODO/documented/configuration *)
let mutable chromiumDir = folderByOSTypeChromium
(* documented/configuration *)
let mutable ieDir = folderByOSType
(* documented/configuration *)
Expand Down
2 changes: 1 addition & 1 deletion src/canopy/reporters.fs
Expand Up @@ -189,7 +189,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string, ?pinBrows
| IEWithOptions options ->new OpenQA.Selenium.IE.InternetExplorerDriver(driverPath, options) :> IWebDriver
| IEWithOptionsAndTimeSpan(options, timeSpan) -> new OpenQA.Selenium.IE.InternetExplorerDriver(driverPath, options, timeSpan) :> IWebDriver
| EdgeBETA -> new OpenQA.Selenium.Edge.EdgeDriver(driverPath) :> IWebDriver
| Chrome ->
| Chrome | Chromium ->
let options = OpenQA.Selenium.Chrome.ChromeOptions()
options.AddArgument("test-type") //https://code.google.com/p/chromedriver/issues/detail?id=799
new OpenQA.Selenium.Chrome.ChromeDriver(driverPath, options) :> IWebDriver
Expand Down
1 change: 1 addition & 0 deletions src/canopy/types.fs
Expand Up @@ -53,6 +53,7 @@ type BrowserStartMode =
| ChromeWithOptions of Chrome.ChromeOptions
| ChromeWithOptionsAndTimeSpan of Chrome.ChromeOptions * TimeSpan
| ChromeWithUserAgent of string
| Chromium
| Safari
| PhantomJS
| PhantomJSProxyNone
Expand Down

0 comments on commit 2f31f90

Please sign in to comment.