Skip to content

Commit

Permalink
Merge pull request #103 from KevM/htmlliveoutput
Browse files Browse the repository at this point in the history
HtmlLiveReporter optional property for specifying a report save filepath
  • Loading branch information
lefthandedgoat committed Sep 5, 2013
2 parents a729426 + e703b33 commit 0ad9382
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 0ad9382

Please sign in to comment.