canopy


Assertions

== (equals)

Assert that the element on the left is equal to the value on the right.

1: 
"#firstName" == "Alex"

!= (does not equal)

Assert that the element on the left is not equal to the value on the right.

1: 
"#firstName" != "Tom"

=== (aliased as is)

Assert that the value on the left is equal to the value on right. * Note: does not use retry-ability. Equivalent to Assert.Equals.

1: 
"Not a selector" === "Not a selector"

*= (one of many equals)

Assert that at least one element in a list equals a value.

1: 
".todoItem" *= "Buy milk"

*!= (none equals)

Assert that none of the items in a list equals a value.

1: 
".todoItem" *!= "Sell everything"

contains

Assert that one string contains another.

1: 
contains "Log" (read "#logout")

notContains

Assert that one string does not contains another.

1: 
notContains "Hello Bob!" (read "#name")

count

Assert there are X items of given css selector.

1: 
count ".todoItem" 5

=~ (regex match)

Assert that an element regex matches a value.

1: 
2: 
3: 
4: 
"#lastName" << "Gray"
"#lastName" =~ "Gr[ae]y"
"#lastName" << "Grey"
"#lastName" =~ "Gr[ae]y"

!=~ (regex match)

Assert that an element does not regex match a value.

1: 
2: 
3: 
4: 
"#lastName" << "Gr0y"
"#lastName" !=~ "Gr[ae]y"
"#lastName" << "Gr1y"
"#lastName" !=~ "Gr[ae]y"

*~ (one of many regex match)

Assert that one of many element regex matches a value.

1: 
"#colors li" *~ "gr[ea]y"

on

Assert that the browser is currently on a url. Falls back to using String.Contains after page timeout.

1: 
2: 
url "https://duckduckgo.com/?q=canopy+f%23"
on "https://duckduckgo.com/?q"

onn

Same as on but does not fall back to using String.Contains.

1: 
2: 
url "https://duckduckgo.com/about"
onn "https://duckduckgo.com/about"

selected

Assert that a radio or checkbox is selected.

1: 
selected "#yes"

deselected

Assert that a radio or checkbox is not selected.

1: 
deselected "#yes"

displayed

Assert that an element is displayed on the screen. (Note: Will not walk up the dom. If a parent container is hidden this may give the wrong results, try adding :visible to selector)

1: 
displayed "#modal"

notDisplayed

Assert that an element is not displayed on the screen. (Note: Will not walk up the dom. If a parent container is hidden this may give the wrong results, try adding :visible to selector)

1: 
notDisplayed "#modal"

enabled

Assert that an element is enabled.

1: 
enabled "#button"

disabled

Assert that an element is not enabled.

1: 
disabled "#button"

fadedIn

Returns true/false if element has finished fading in and is shown.

1: 
2: 
let isShown = (fadedIn "#message")()
waitFor <| fadedIn "#message"
namespace canopy
module runner

from canopy
namespace System
val contains : value1:string -> value2:string -> unit

Full name: canopy.core.contains
val read : item:'a -> string

Full name: canopy.core.read
val notContains : value1:string -> value2:string -> unit

Full name: canopy.core.notContains
val count : cssSelector:string -> count:int -> unit

Full name: canopy.core.count
val url : u:string -> unit

Full name: canopy.core.url
val on : u:string -> unit

Full name: canopy.core.on
val onn : u:string -> unit

Full name: canopy.core.onn
val selected : item:'a -> unit

Full name: canopy.core.selected
val deselected : item:'a -> unit

Full name: canopy.core.deselected
val displayed : item:'a -> unit

Full name: canopy.core.displayed
val notDisplayed : item:'a -> unit

Full name: canopy.core.notDisplayed
val enabled : item:'a -> unit

Full name: canopy.core.enabled
val disabled : item:'a -> unit

Full name: canopy.core.disabled
val isShown : bool

Full name: Assertions.isShown
val fadedIn : cssSelector:string -> 'a -> bool

Full name: canopy.core.fadedIn
val waitFor : ((unit -> bool) -> unit)

Full name: canopy.core.waitFor