Skip to content

Commit

Permalink
Fix #218
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Oct 22, 2015
1 parent 535ee2a commit ded7d61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,6 @@ Improve reporting skip for console and TeamCity reporter [Issue #215](https://gi

#### 0.9.37 - October 18 2015
Great PR from @LimoWanKenobi that fixed a performance problem with add a lot of tests, thanks! [Issue #217](https://github.com/lefthandedgoat/canopy/issues/217)

#### 0.9.38 - October 22 2015
Fix a bug in html reporter trying to describe json, it would fail to because the data was not encoded properly [Issue #218](https://github.com/lefthandedgoat/canopy/issues/218)
6 changes: 3 additions & 3 deletions src/canopy/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("canopy")>]
[<assembly: AssemblyProductAttribute("canopy")>]
[<assembly: AssemblyDescriptionAttribute("F# web testing framework")>]
[<assembly: AssemblyVersionAttribute("0.9.37")>]
[<assembly: AssemblyFileVersionAttribute("0.9.37")>]
[<assembly: AssemblyVersionAttribute("0.9.38")>]
[<assembly: AssemblyFileVersionAttribute("0.9.38")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "0.9.37"
let [<Literal>] Version = "0.9.38"
10 changes: 6 additions & 4 deletions src/canopy/reporters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
let mutable environment = System.String.Empty
let testStopWatch = System.Diagnostics.Stopwatch()
let contextStopWatch = System.Diagnostics.Stopwatch()
let jsEncode value = System.Web.HttpUtility.JavaScriptStringEncode(value)
new() = LiveHtmlReporter(Firefox, String.Empty)
new(browser : BrowserStartMode) = LiveHtmlReporter(browser, String.Empty)
Expand All @@ -234,7 +235,6 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
then System.IO.Directory.CreateDirectory(directory) |> ignore
IO.File.WriteAllText(System.IO.Path.Combine(directory,filename + ".html"), this.reportHtml())


interface IReporter with
member this.pass () =
this.swallowedJS (sprintf "updateTestInContext('%s', 'Pass', '%s');" context "")
Expand All @@ -243,20 +243,21 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
member this.fail ex id ss url =
this.swallowedJS (sprintf "updateTestInContext('%s', 'Fail', '%s');" context (Convert.ToBase64String(ss)))
let stack = sprintf "%s%s%s" ex.Message System.Environment.NewLine ex.StackTrace
let stack = System.Web.HttpUtility.JavaScriptStringEncode(stack)
let stack = jsEncode stack
this.swallowedJS (sprintf "addStackToTest ('%s', '%s');" context stack)
this.swallowedJS (sprintf "addUrlToTest ('%s', '%s');" context url)
consoleReporter.fail ex id ss url

member this.describe d =
let d = jsEncode d
this.swallowedJS (sprintf "addMessageToTest ('%s', '%s');" context d)
consoleReporter.describe d

member this.contextStart c =
contextStopWatch.Reset()
contextStopWatch.Start()
contexts <- c :: contexts
context <- System.Web.HttpUtility.JavaScriptStringEncode(c)
context <- jsEncode c
this.swallowedJS (sprintf "addContext('%s');" context)
this.swallowedJS (sprintf "collapseContextsExcept('%s');" context)
consoleReporter.contextStart c
Expand All @@ -272,6 +273,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
consoleReporter.summary minutes seconds passed failed skipped

member this.write w =
let w = jsEncode w
this.swallowedJS (sprintf "addMessageToTest ('%s', '%s');" context w)
consoleReporter.write w

Expand All @@ -281,7 +283,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) =
member this.testStart id =
testStopWatch.Reset()
testStopWatch.Start()
test <- System.Web.HttpUtility.JavaScriptStringEncode(id)
test <- jsEncode id
this.swallowedJS (sprintf "addToContext ('%s', '%s');" context test)
consoleReporter.testStart id

Expand Down

0 comments on commit ded7d61

Please sign in to comment.