Skip to content

Commit

Permalink
Fix #292 runFor
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Oct 6, 2016
1 parent 81ff5c0 commit d4befdc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
42 changes: 26 additions & 16 deletions src/canopy/runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,33 @@ let run () =
(* documented/testing *)
let runFor browsers =
// suites are in reverse order and have to be reversed before running the tests
let currentSuites = suites |> List.rev
suites <- [new suite()]
let currentSuites = suites

match box browsers with
| :? (types.BrowserStartMode list) as browsers ->
browsers
|> List.iter (fun browser ->
toString browser
|> sprintf "Running tests with %s browser"
|> context
once (fun _ -> start browser)
suites <- suites @ currentSuites)
let newSuites =
browsers
|> List.rev
|> List.map (fun browser ->
let suite = new suite()
suite.Context <- sprintf "Running tests with %s browser" (toString browser)
suite.Once <- fun _ -> start browser
let currentSuites2 = currentSuites |> List.map(fun suite -> suite.Clone())
currentSuites2 |> List.iter (fun suite -> suite.Context <- sprintf "(%s) %s" (toString browser) suite.Context)
currentSuites2 @ [suite])
|> List.concat
suites <- newSuites
| :? (IWebDriver list) as browsers ->
browsers
|> List.iter (fun browser ->
browser.ToString()
|> sprintf "Running tests with %s browser"
|> context
once (fun _ -> switchTo browser)
suites <- suites @ currentSuites)
let newSuites =
browsers
|> List.rev
|> List.map (fun browser ->
let suite = new suite()
suite.Context <- sprintf "Running tests with %s browser" (browser.ToString())
suite.Once <- fun _ -> switchTo browser
let currentSuites2 = currentSuites |> List.map(fun suite -> suite.Clone())
currentSuites2 |> List.iter (fun suite -> suite.Context <- sprintf "(%s) %s" (browser.ToString()) suite.Context)
currentSuites2 @ [suite])
|> List.concat
suites <- newSuites
| _ -> raise <| Exception "I dont know what you have given me"
1 change: 1 addition & 0 deletions src/canopy/types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type suite () = class
member val Manys : Test list = [] with get, set
member val Always : Test list = [] with get, set
member val IsParallel = false with get, set
member this.Clone() = this.MemberwiseClone() :?> suite
end

type Result =
Expand Down

0 comments on commit d4befdc

Please sign in to comment.