diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 78fb7ed6..71dfb52a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -153,4 +153,10 @@ * Fix broken link to html reporter introduced in 0.9.27 #### 0.9.29 - June 17 2015 -* Fix issue 203, using canopy for unit tests [Issue #203](https://github.com/lefthandedgoat/canopy/issues/203) \ No newline at end of file +* Fix issue 203, using canopy for unit tests [Issue #203](https://github.com/lefthandedgoat/canopy/issues/203) + +#### 0.9.30 - July 30 2015 +* Updated to Selenium 2.47 +* Fix issue 205, making switchToTab more reliable [Issue #205](https://github.com/lefthandedgoat/canopy/issues/205) +* Improve LiveHtmlReporter so that puts and describe will add ordered messages to the output +* Improved behaviour for failing all tests if on failed. Changed it to only fail all tests if the 'once' function fails \ No newline at end of file diff --git a/docs/files/reporttemplate.html b/docs/files/reporttemplate.html index 099d2c56..c29d3194 100644 --- a/docs/files/reporttemplate.html +++ b/docs/files/reporttemplate.html @@ -87,27 +87,32 @@ $("#todo").text($(".results .warning").length); $("#skipped").text($(".results .info").length); }; - - var addToContext = function (context, passFailSkip, testName, image) { + + var addToContext = function (context, testName) { + var ctx = $('#contexts tr[data-context="' + context + '"]'); + ctx.next('tr').find('table').append('
' + testName + '
'); + }; + + var updateTestInContext = function (context, passFailSkip, image) { var ctx = $('#contexts tr[data-context="' + context + '"]'); if (passFailSkip === "Pass") { - ctx.next('tr').find('table').last('tr').append('
' + testName + '
'); + ctx.next('tr').find('table').find('tr').last().addClass('success'); if (ctx.hasClass("error") === false) { ctx.removeClass("warning").removeClass("info").addClass("success"); } } if (passFailSkip === "Fail") { - ctx.next('tr').find('table').last('tr').append('
' + testName + '
'); + ctx.next('tr').find('table').find('tr').last().addClass('error'); ctx.removeClass("success").removeClass("warning").removeClass("info").addClass("error"); } if (passFailSkip === "Todo") { - ctx.next('tr').find('table').last('tr').append('
' + testName + '
'); + ctx.next('tr').find('table').find('tr').last().addClass('warning'); if (ctx.hasClass("error") === false && ctx.hasClass("info") === false && ctx.hasClass("success") === false){ ctx.addClass("warning"); } } if (passFailSkip === "Skip") { - ctx.next('tr').find('table').last('tr').append('
' + testName + '
'); + ctx.next('tr').find('table').find('tr').last().addClass('info'); if (ctx.hasClass("error") === false && ctx.hasClass("warning") === false && ctx.hasClass("success") === false){ ctx.addClass("info"); } @@ -130,6 +135,15 @@ ctx.next('tr').find('table').last('tr').find('.test').last().after('
' + stack + '
'); }; + var addMessageToTest = function (context, message) { + var ctx = $('#contexts tr[data-context="' + context + '"]'); + if(ctx.next('tr').find('table').last('tr').find('.test').last().siblings('pre').length === 0) { + ctx.next('tr').find('table').last('tr').find('.test').last().after('
  1. ' + message + '
'); + } else { + ctx.next('tr').find('table').last('tr').find('.test').last().siblings('pre').find('ol').append('
  • ' + message + '
  • '); + } + }; + var collapseContextsExcept = function (context) { var ctxs = $('#contexts tr.result[data-owning-context !="' + context + '"]'); ctxs.each(function () { diff --git a/nuget/canopy.nuspec b/nuget/canopy.nuspec index ed1dc4e7..26be9506 100644 --- a/nuget/canopy.nuspec +++ b/nuget/canopy.nuspec @@ -13,8 +13,8 @@ @tags@ - - + + diff --git a/src/canopy/AssemblyInfo.fs b/src/canopy/AssemblyInfo.fs index 5274705c..ad5ce479 100644 --- a/src/canopy/AssemblyInfo.fs +++ b/src/canopy/AssemblyInfo.fs @@ -4,9 +4,9 @@ open System.Reflection [] [] [] -[] -[] +[] +[] do () module internal AssemblyVersionInformation = - let [] Version = "0.9.29" + let [] Version = "0.9.30" diff --git a/src/canopy/canopy.fs b/src/canopy/canopy.fs index 224b1e3d..517fe9e7 100644 --- a/src/canopy/canopy.fs +++ b/src/canopy/canopy.fs @@ -693,8 +693,14 @@ let start b = let switchTo b = browser <- b let switchToTab number = - let tabs = browser.WindowHandles; - browser.SwitchTo().Window(tabs.[(number - 1)]) |> ignore + wait pageTimeout (fun _ -> + let number = number - 1 + let tabs = browser.WindowHandles; + if tabs |> Seq.length >= number then + browser.SwitchTo().Window(tabs.[number]) |> ignore + true + else + false) let closeTab number = switchToTab number diff --git a/src/canopy/canopy.fsproj b/src/canopy/canopy.fsproj index 59e78106..925349ea 100644 --- a/src/canopy/canopy.fsproj +++ b/src/canopy/canopy.fsproj @@ -84,11 +84,11 @@ - ..\..\packages\Selenium.WebDriver.2.46.0\lib\net40\WebDriver.dll + ..\..\packages\Selenium.WebDriver.2.47.0\lib\net40\WebDriver.dll True - ..\..\packages\Selenium.Support.2.46.0\lib\net40\WebDriver.Support.dll + ..\..\packages\Selenium.Support.2.47.0\lib\net40\WebDriver.Support.dll True diff --git a/src/canopy/packages.config b/src/canopy/packages.config index 3d7c0b06..bf231070 100644 --- a/src/canopy/packages.config +++ b/src/canopy/packages.config @@ -2,7 +2,7 @@ - - + + \ No newline at end of file diff --git a/src/canopy/reporters.fs b/src/canopy/reporters.fs index 051b038a..ce77e822 100644 --- a/src/canopy/reporters.fs +++ b/src/canopy/reporters.fs @@ -221,18 +221,19 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = interface IReporter with member this.pass () = - this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" context test "") + this.swallowedJS (sprintf "updateTestInContext('%s', 'Pass', '%s');" context "") consoleReporter.pass () member this.fail ex id ss url = - this.swallowedJS (sprintf "addToContext('%s', 'Fail', '%s', '%s');" context test (Convert.ToBase64String(ss))) + 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) 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 = + member this.describe d = + this.swallowedJS (sprintf "addMessageToTest ('%s', '%s');" context d) consoleReporter.describe d member this.contextStart c = @@ -249,6 +250,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = consoleReporter.summary minutes seconds passed failed member this.write w = + this.swallowedJS (sprintf "addMessageToTest ('%s', '%s');" context w) consoleReporter.write w member this.suggestSelectors selector suggestions = @@ -256,6 +258,7 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = member this.testStart id = test <- System.Web.HttpUtility.JavaScriptStringEncode(id) + this.swallowedJS (sprintf "addToContext ('%s', '%s');" context test) consoleReporter.testStart id member this.testEnd id = () @@ -279,10 +282,11 @@ type LiveHtmlReporter(browser : BrowserStartMode, driverPath : string) = if (contexts |> List.exists (fun c -> c = "Coverage Reports")) = false then contexts <- "Coverage Reports" :: contexts this.swallowedJS (sprintf "addContext('%s');" "Coverage Reports") - this.swallowedJS (sprintf "addToContext('%s', 'Pass', '%s', '%s');" "Coverage Reports" url (Convert.ToBase64String(ss))) + this.swallowedJS (sprintf "addToContext ('%s', '%s');" "Coverage Reports" url) + this.swallowedJS (sprintf "updateTestInContext('%s', 'Pass', '%s');" "Coverage Reports" (Convert.ToBase64String(ss))) member this.todo () = - this.swallowedJS (sprintf "addToContext('%s', 'Todo', '%s', '%s');" context test "") + this.swallowedJS (sprintf "updateTestInContext('%s', 'Todo', '%s');" context "") member this.skip () = - this.swallowedJS (sprintf "addToContext('%s', 'Skip', '%s', '%s');" context test "") \ No newline at end of file + this.swallowedJS (sprintf "updateTestInContext('%s', 'Skip', '%s');" context "") \ No newline at end of file diff --git a/tests/basictests/basictests.fsproj b/tests/basictests/basictests.fsproj index 2bf23798..9f933195 100644 --- a/tests/basictests/basictests.fsproj +++ b/tests/basictests/basictests.fsproj @@ -75,11 +75,11 @@ - ..\..\packages\Selenium.WebDriver.2.46.0\lib\net40\WebDriver.dll + ..\..\packages\Selenium.WebDriver.2.47.0\lib\net40\WebDriver.dll True - ..\..\packages\Selenium.Support.2.46.0\lib\net40\WebDriver.Support.dll + ..\..\packages\Selenium.Support.2.47.0\lib\net40\WebDriver.Support.dll True diff --git a/tests/basictests/packages.config b/tests/basictests/packages.config index 9ec92b84..5936c3e9 100644 --- a/tests/basictests/packages.config +++ b/tests/basictests/packages.config @@ -2,6 +2,6 @@ - - + + \ No newline at end of file