diff --git a/basictests/app.config b/basictests/app.config index be4b2d35..6b2604a7 100644 --- a/basictests/app.config +++ b/basictests/app.config @@ -14,6 +14,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/basictests/basictests.fsproj b/basictests/basictests.fsproj index 3b3d93fe..952af95c 100644 --- a/basictests/basictests.fsproj +++ b/basictests/basictests.fsproj @@ -10,7 +10,8 @@ basictests basictests v4.0 - Client + + basictests ..\ true diff --git a/canopy/canopy.fs b/canopy/canopy.fs index 0f2d64ed..bdca4a7d 100644 --- a/canopy/canopy.fs +++ b/canopy/canopy.fs @@ -50,7 +50,7 @@ let sleep seconds = let puts text = reporter.write text - let escapedText = text.Replace("'", @"\'") + let escapedText = System.Web.HttpUtility.JavaScriptStringEncode(text) let info = " var infoDiv = document.getElementById('canopy_info_div'); if(!infoDiv) { infoDiv = document.createElement('div'); } diff --git a/canopy/canopy.fsproj b/canopy/canopy.fsproj index 717a4a6b..60f0f1f8 100644 --- a/canopy/canopy.fsproj +++ b/canopy/canopy.fsproj @@ -83,6 +83,7 @@ + ..\packages\Selenium.WebDriver.2.38.0\lib\net40\WebDriver.dll diff --git a/canopy/reporters.fs b/canopy/reporters.fs index 65d060a0..b34efd56 100644 --- a/canopy/reporters.fs +++ b/canopy/reporters.fs @@ -189,11 +189,15 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = interface IReporter with member this.pass () = - this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" context test "") + let escapedContext = System.Web.HttpUtility.JavaScriptStringEncode(context) + let escapedTest = System.Web.HttpUtility.JavaScriptStringEncode(test) + this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" escapedContext escapedTest "") consoleReporter.pass () member this.fail ex id ss = - this.swallowedJS (sprintf "addToContext('%s', 'Fail', '%s', '%s');" context test (Convert.ToBase64String(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))) consoleReporter.fail ex id ss member this.describe d =