From 7163190c6a694bf388072b23699293b65e6b6708 Mon Sep 17 00:00:00 2001 From: lefthandedgoat Date: Tue, 3 Sep 2013 23:18:35 -0500 Subject: [PATCH] fixed for issue #99 notDisplayed failing on elements that do not exist --- basictests/Program.fs | 6 +++++- canopy/canopy.fs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/basictests/Program.fs b/basictests/Program.fs index d6d510ed..c0e3f582 100644 --- a/basictests/Program.fs +++ b/basictests/Program.fs @@ -6,7 +6,7 @@ open runner open configuration open reporters -start phantomJS +start chrome let mainBrowser = browser elementTimeout <- 3.0 compareTimeout <- 3.0 @@ -390,6 +390,10 @@ context "other tests" !^ "http://lefthandedgoat.github.io/canopy/testpages/notDisplayed" notDisplayed "#notDisplayed") +"notDisplayed test for element that is not on the screen" &&& (fun _ -> + !^ "http://lefthandedgoat.github.io/canopy/testpages/notDisplayed" + notDisplayed "#nalsjdfalfalsdjfalsjfaljsflsjf") + "count test" &&& (fun _ -> !^ "http://lefthandedgoat.github.io/canopy/testpages/count" count ".number" 5) diff --git a/canopy/canopy.fs b/canopy/canopy.fs index 60ca3f07..a61b000f 100644 --- a/canopy/canopy.fs +++ b/canopy/canopy.fs @@ -474,7 +474,7 @@ let displayed cssSelector = let notDisplayed cssSelector = try - wait compareTimeout (fun _ -> not(shown cssSelector)) + wait compareTimeout (fun _ -> (elements cssSelector |> List.isEmpty) || not(shown cssSelector)) () with | :? WebDriverTimeoutException -> raise (CanopyNotDisplayedFailedException(sprintf "notDisplay checked for %s failed." cssSelector));