From 83b030c5c31318763a5cf718ba7c9909709b5482 Mon Sep 17 00:00:00 2001 From: Chris Holt Date: Tue, 28 Jan 2014 22:37:11 -0600 Subject: [PATCH] Better fix for issue #127 --- basictests/Program.fs | 6 +++--- canopy/reporters.fs | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/basictests/Program.fs b/basictests/Program.fs index cd7a6c18..fb2d5657 100644 --- a/basictests/Program.fs +++ b/basictests/Program.fs @@ -280,13 +280,13 @@ test (fun _ -> failsWith ("on check failed, expected expression '" + childUrl + "' got " + testpage) on childUrl -context "reddit tests" +context "reddit tests '" once (fun _ -> Console.WriteLine "once: reddit tests") before (fun _ -> Console.WriteLine "before: reddit tests") after (fun _ -> Console.WriteLine "after: reddit tests") lastly (fun _ -> Console.WriteLine "lastly: reddit tests") -"browsing to redit should be on reddit" &&& fun _ -> +"browsing to redit should be on reddit '" &&& fun _ -> url "http://www.reddit.com/" on "http://www.reddit.com/" @@ -587,7 +587,7 @@ let findByHref href f = addFinder findByHref -"Firefox should be resized to 400,500 then rotated to 500,400" &&& fun _ -> +"test new findByHref by clicking an href" &&& fun _ -> url "http://lefthandedgoat.github.io/canopy/index.html" click "about.html" on "http://lefthandedgoat.github.io/canopy/about.html" diff --git a/canopy/reporters.fs b/canopy/reporters.fs index fff6e2a2..b99fac4e 100644 --- a/canopy/reporters.fs +++ b/canopy/reporters.fs @@ -189,15 +189,11 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = interface IReporter with member this.pass () = - let escapedContext = System.Web.HttpUtility.JavaScriptStringEncode(context) - let escapedTest = System.Web.HttpUtility.JavaScriptStringEncode(test) - this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" escapedContext escapedTest "") + this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" context test "") consoleReporter.pass () member this.fail ex id ss = - let escapedContext = System.Web.HttpUtility.JavaScriptStringEncode(context) - let escapedTest = System.Web.HttpUtility.JavaScriptStringEncode(test) - this.swallowedJS (sprintf "addToContext('%s', 'Fail', '%s', '%s');" escapedContext escapedTest (Convert.ToBase64String(ss))) + this.swallowedJS (sprintf "addToContext('%s', 'Fail', '%s', '%s');" context test (Convert.ToBase64String(ss))) consoleReporter.fail ex id ss member this.describe d = @@ -205,7 +201,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = member this.contextStart c = contexts <- c :: contexts - context <- c + context <- System.Web.HttpUtility.JavaScriptStringEncode(c) this.swallowedJS (sprintf "addContext('%s');" context) this.swallowedJS (sprintf "collapseContextsExcept('%s');" context) consoleReporter.contextStart c @@ -223,7 +219,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = consoleReporter.suggestSelectors selector suggestions member this.testStart id = - test <- id + test <- System.Web.HttpUtility.JavaScriptStringEncode(id) consoleReporter.testStart id member this.testEnd id = ()