diff --git a/basictests/Program.fs b/basictests/Program.fs
index fbc3ea04..480c8555 100644
--- a/basictests/Program.fs
+++ b/basictests/Program.fs
@@ -5,6 +5,7 @@ open canopy
open runner
open configuration
open reporters
+open types
start chrome
let mainBrowser = browser
@@ -13,6 +14,7 @@ compareTimeout <- 3.0
pageTimeout <- 3.0
runFailedContextsFirst <- true
reporter <- new LiveHtmlReporter() :> IReporter
+//reporter <- new LiveHtmlReporter(Chrome, configuration.chromeDir) :> IReporter
failFast := true
diff --git a/canopy/canopy.fs b/canopy/canopy.fs
index f8f015ce..0f2d64ed 100644
--- a/canopy/canopy.fs
+++ b/canopy/canopy.fs
@@ -12,56 +12,13 @@ open System
open configuration
open levenshtein
open reporters
-
-type CanopyException(message) = inherit Exception(message)
-type CanopyReadOnlyException(message) = inherit CanopyException(message)
-type CanopyOptionNotFoundException(message) = inherit CanopyException(message)
-type CanopySelectionFailedExeception(message) = inherit CanopyException(message)
-type CanopyDeselectionFailedException(message) = inherit CanopyException(message)
-type CanopyWaitForException(message) = inherit CanopyException(message)
-type CanopyElementNotFoundException(message) = inherit CanopyException(message)
-type CanopyMoreThanOneElementFoundException(message) = inherit CanopyException(message)
-type CanopyEqualityFailedException(message) = inherit CanopyException(message)
-type CanopyNotEqualsFailedException(message) = inherit CanopyException(message)
-type CanopyValueNotInListException(message) = inherit CanopyException(message)
-type CanopyValueInListException(message) = inherit CanopyException(message)
-type CanopyContainsFailedException(message) = inherit CanopyException(message)
-type CanopyCountException(message) = inherit CanopyException(message)
-type CanopyDisplayedFailedException(message) = inherit CanopyException(message)
-type CanopyNotDisplayedFailedException(message) = inherit CanopyException(message)
-type CanopyEnabledFailedException(message) = inherit CanopyException(message)
-type CanopyDisabledFailedException(message) = inherit CanopyException(message)
-type CanopyNotStringOrElementException(message) = inherit CanopyException(message)
-type CanopyOnException(message) = inherit CanopyException(message)
-type CanopyCheckFailedException(message) = inherit CanopyException(message)
-type CanopyUncheckFailedException(message) = inherit CanopyException(message)
+open types
let mutable (browser : IWebDriver) = null
let mutable (failureMessage : string) = null
let mutable wipTest = false
let mutable searchedFor : (string * string) list = []
-//directions
-type direction =
- | Left
- | Right
- | FullScreen
-
-//browser
-type BrowserStartMode =
- | Firefox
- | FirefoxWithProfile of Firefox.FirefoxProfile
- | FirefoxWithUserAgent of string
- | IE
- | IEWithOptions of IE.InternetExplorerOptions
- | IEWithOptionsAndTimeSpan of IE.InternetExplorerOptions * TimeSpan
- | Chrome
- | ChromeWithOptions of Chrome.ChromeOptions
- | ChromeWithOptionsAndTimeSpan of Chrome.ChromeOptions * TimeSpan
- | ChromeWithUserAgent of string
- | PhantomJS
- | PhantomJSProxyNone
-
let firefox = Firefox
let ie = IE
let chrome = Chrome
diff --git a/canopy/canopy.fsproj b/canopy/canopy.fsproj
index 5dd82e14..717a4a6b 100644
--- a/canopy/canopy.fsproj
+++ b/canopy/canopy.fsproj
@@ -55,6 +55,7 @@
AssemblyInfo.fs
+
diff --git a/canopy/reporters.fs b/canopy/reporters.fs
index 36a5e402..65d060a0 100644
--- a/canopy/reporters.fs
+++ b/canopy/reporters.fs
@@ -2,6 +2,7 @@
open System
open OpenQA.Selenium
+open types
type IReporter =
abstract member testStart : string -> unit
@@ -139,10 +140,24 @@ type TeamCityReporter() =
member this.skip () = ()
-type LiveHtmlReporter() =
+type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
let consoleReporter : IReporter = new ConsoleReporter() :> IReporter
-
- let _browser = new OpenQA.Selenium.Firefox.FirefoxDriver() :> IWebDriver
+
+ let _browser =
+ //copy pasta!
+ match browser with
+ | IE -> new OpenQA.Selenium.IE.InternetExplorerDriver(driverPath) :> IWebDriver
+ | IEWithOptions options ->new OpenQA.Selenium.IE.InternetExplorerDriver(driverPath, options) :> IWebDriver
+ | IEWithOptionsAndTimeSpan(options, timeSpan) -> new OpenQA.Selenium.IE.InternetExplorerDriver(driverPath, options, timeSpan) :> IWebDriver
+ | Chrome -> new OpenQA.Selenium.Chrome.ChromeDriver(driverPath) :> IWebDriver
+ | ChromeWithOptions options -> new OpenQA.Selenium.Chrome.ChromeDriver(driverPath, options) :> IWebDriver
+ | ChromeWithOptionsAndTimeSpan(options, timeSpan) -> new OpenQA.Selenium.Chrome.ChromeDriver(driverPath, options, timeSpan) :> IWebDriver
+ | Firefox -> new OpenQA.Selenium.Firefox.FirefoxDriver() :> IWebDriver
+ | FirefoxWithProfile profile -> new OpenQA.Selenium.Firefox.FirefoxDriver(profile) :> 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"))
+ | PhantomJS | PhantomJSProxyNone -> raise(System.Exception("Sorry PhantomJS can't be used for LiveHtmlReporter"))
+
let pin () =
let h = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
let w = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
@@ -156,6 +171,8 @@ type LiveHtmlReporter() =
let mutable canQuit = false
let mutable contexts : string list = []
+ new() = LiveHtmlReporter(Firefox, @"c:\")
+
member this.browser
with get () = _browser
diff --git a/canopy/runner.fs b/canopy/runner.fs
index 76d27811..077de2de 100644
--- a/canopy/runner.fs
+++ b/canopy/runner.fs
@@ -4,53 +4,13 @@ open System
open configuration
open canopy
open reporters
+open types
let rec private last = function
| hd :: [] -> hd
| hd :: tl -> last tl
| _ -> failwith "Empty list."
-type Test (description: string, func : (unit -> unit), number : int) =
- member x.Description = description
- member x.Func = func
- member x.Number = number
-
-type suite () = class
- let mutable context : string = null
- let mutable once = fun () -> ()
- let mutable before = fun () -> ()
- let mutable after = fun () -> ()
- let mutable lastly = fun () -> ()
- let mutable tests : Test list = []
- let mutable wips : Test list = []
- let mutable manys : Test list = []
-
- member x.Context
- with get() = context
- and set(value) = context <- value
- member x.Once
- with get() = once
- and set(value) = once <- value
- member x.Before
- with get() = before
- and set(value) = before <- value
- member x.After
- with get() = after
- and set(value) = after <- value
- member x.Lastly
- with get() = lastly
- and set(value) = lastly <- value
- member x.Tests
- with get() = tests
- and set(value) = tests <- value
- member x.Wips
- with get() = wips
- and set(value) = wips <- value
- member x.Manys
- with get() = manys
- and set(value) = manys <- value
-end
-
let mutable suites = [new suite()]
let mutable todo = fun () -> ()
let mutable skipped = fun () -> ()
diff --git a/canopy/types.fs b/canopy/types.fs
new file mode 100644
index 00000000..921df8c6
--- /dev/null
+++ b/canopy/types.fs
@@ -0,0 +1,89 @@
+module canopy.types
+
+open System
+open OpenQA.Selenium
+
+type CanopyException(message) = inherit Exception(message)
+type CanopyReadOnlyException(message) = inherit CanopyException(message)
+type CanopyOptionNotFoundException(message) = inherit CanopyException(message)
+type CanopySelectionFailedExeception(message) = inherit CanopyException(message)
+type CanopyDeselectionFailedException(message) = inherit CanopyException(message)
+type CanopyWaitForException(message) = inherit CanopyException(message)
+type CanopyElementNotFoundException(message) = inherit CanopyException(message)
+type CanopyMoreThanOneElementFoundException(message) = inherit CanopyException(message)
+type CanopyEqualityFailedException(message) = inherit CanopyException(message)
+type CanopyNotEqualsFailedException(message) = inherit CanopyException(message)
+type CanopyValueNotInListException(message) = inherit CanopyException(message)
+type CanopyValueInListException(message) = inherit CanopyException(message)
+type CanopyContainsFailedException(message) = inherit CanopyException(message)
+type CanopyCountException(message) = inherit CanopyException(message)
+type CanopyDisplayedFailedException(message) = inherit CanopyException(message)
+type CanopyNotDisplayedFailedException(message) = inherit CanopyException(message)
+type CanopyEnabledFailedException(message) = inherit CanopyException(message)
+type CanopyDisabledFailedException(message) = inherit CanopyException(message)
+type CanopyNotStringOrElementException(message) = inherit CanopyException(message)
+type CanopyOnException(message) = inherit CanopyException(message)
+type CanopyCheckFailedException(message) = inherit CanopyException(message)
+type CanopyUncheckFailedException(message) = inherit CanopyException(message)
+
+//directions
+type direction =
+ | Left
+ | Right
+ | FullScreen
+
+//browser
+type BrowserStartMode =
+ | Firefox
+ | FirefoxWithProfile of Firefox.FirefoxProfile
+ | FirefoxWithUserAgent of string
+ | IE
+ | IEWithOptions of IE.InternetExplorerOptions
+ | IEWithOptionsAndTimeSpan of IE.InternetExplorerOptions * TimeSpan
+ | Chrome
+ | ChromeWithOptions of Chrome.ChromeOptions
+ | ChromeWithOptionsAndTimeSpan of Chrome.ChromeOptions * TimeSpan
+ | ChromeWithUserAgent of string
+ | PhantomJS
+ | PhantomJSProxyNone
+
+type Test (description: string, func : (unit -> unit), number : int) =
+ member x.Description = description
+ member x.Func = func
+ member x.Number = number
+
+type suite () = class
+ let mutable context : string = null
+ let mutable once = fun () -> ()
+ let mutable before = fun () -> ()
+ let mutable after = fun () -> ()
+ let mutable lastly = fun () -> ()
+ let mutable tests : Test list = []
+ let mutable wips : Test list = []
+ let mutable manys : Test list = []
+
+ member x.Context
+ with get() = context
+ and set(value) = context <- value
+ member x.Once
+ with get() = once
+ and set(value) = once <- value
+ member x.Before
+ with get() = before
+ and set(value) = before <- value
+ member x.After
+ with get() = after
+ and set(value) = after <- value
+ member x.Lastly
+ with get() = lastly
+ and set(value) = lastly <- value
+ member x.Tests
+ with get() = tests
+ and set(value) = tests <- value
+ member x.Wips
+ with get() = wips
+ and set(value) = wips <- value
+ member x.Manys
+ with get() = manys
+ and set(value) = manys <- value
+end
\ No newline at end of file