Skip to content

Commit

Permalink
Better fix for issue #127
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Jan 29, 2014
1 parent 9a493a1 commit 83b030c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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/"

Expand Down Expand Up @@ -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"
Expand Down
12 changes: 4 additions & 8 deletions canopy/reporters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,19 @@ 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 =
consoleReporter.describe d

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
Expand All @@ -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 = ()
Expand Down

0 comments on commit 83b030c

Please sign in to comment.