Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlLiveReporter optional property for specifying a report save filepath #103

Merged
merged 1 commit into from
Sep 5, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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