Skip to content

Commit

Permalink
HtmlLiveReporter optional ctor arg for specifying a report save filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
KevM committed Sep 4, 2013
1 parent eff44a4 commit e703b33
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions canopy/reporters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ type LiveHtmlReporter() =
member this.browser
with get () = _browser

member val reportPath = @"http://lefthandedgoat.github.com/canopy/reporttemplate.html" with get, set
member val reportPath = None with get, set
member val reportTemplateUrl = @"http://lefthandedgoat.github.com/canopy/reporttemplate.html" with get, set
member this.js script = (_browser :?> IJavaScriptExecutor).ExecuteScript(script)
member this.reportHtml () = (this.js "return $('*').html();").ToString()
member private this.swallowedJS script = try (_browser :?> IJavaScriptExecutor).ExecuteScript(script) |> ignore with | ex -> ()
Expand Down Expand Up @@ -206,9 +207,16 @@ type LiveHtmlReporter() =

member this.testEnd id = ()

member this.quit () = if canQuit then _browser.Quit()
member this.quit () =
match this.reportPath with
| Some(string) ->
let reportFileInfo = new IO.FileInfo(this.reportPath.Value)
this.saveReportHtml reportFileInfo.Directory.FullName reportFileInfo.Name
| None -> Console.WriteLine("Not saving report")

if canQuit then _browser.Quit()

member this.suiteBegin () = _browser.Navigate().GoToUrl(this.reportPath)
member this.suiteBegin () = _browser.Navigate().GoToUrl(this.reportTemplateUrl)

member this.suiteEnd () =
canQuit <- true
Expand Down

0 comments on commit e703b33

Please sign in to comment.