Skip to content

Commit

Permalink
fixed for issue #99 notDisplayed failing on elements that do not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Sep 4, 2013
1 parent ab9b70c commit 7163190
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open runner
open configuration
open reporters

start phantomJS
start chrome
let mainBrowser = browser
elementTimeout <- 3.0
compareTimeout <- 3.0
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 7163190

Please sign in to comment.