Puppetry
3.2.2
Search
K

Target Assertions

target.assertAttribute

Asserts that the specified attribute of a target satisfies the given constraint
target.assertAttribute
target.assertAttribute available assertions

target.assertProperty

Asserts that the specified property of a target satisfies the given constraint
target.assertProperty
target.assertProperty available assertions

target.assertVisible

Asserts that the element is currently available and visible. Available settings:
  • available on the page and observable - the target is available in the DOM and visible to the user (displayed, visible, opaque, within the viewport)
  • available on the page - the target is available in the DOM. It enables the following options
    • display: any/none/NOT none
    • visibility: any/hidden/NOT hidden
    • opacity: any/0/NOT 0
    • offset: any/within the viewport/out of the viewport
  • available, but NOT observable - the target is available in the DOM, not not visible to the user (display: none or visibility: hidden or opacity: 0 or out of the viewport)
  • NOT available on the page - the target is not available in the DOM
target.assertVisible

target.assertHtml

Asserts that the HTML content of the focused element satisfies the given constraint
target.assertHtml

target.assertText

Asserts that the rendered text content of the focused element satisfies the given constraint. Unlike target.assertHtml this method takes pure text content without HTML, which approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.
target.assertText

target.assertBoundingBox

Asserts that the bounding box (size and position) of a target satisfies the given constraint
target.assertBoundingBox

target.assertPosition

Asserts that target's position relative to other given target
target.assertPosition

target.assertStyle

Asserts that the computed style of a target matches the given value
target.assertStyle

target.assertMatchesSelector

Asserts that a target matches a given selector or pseudo-selector
target.assertMatchesSelector

target.assertNodeCount

Asserts that number of child elements matching a specified selector satisfies the given constraint.
target.assertNodeCount

target.assertTextCount

Asserts that number of child elements containing a specified text satisfies the given constraint.
target.assertTextCount

target.assertContainsClass

Asserts that the specified class value exists in the element's class attribute.
target.assertContainsClass

target.assertScroll

Asserts that scroll offset on the target satisfies the given constraint
target.assertScroll

target.assertScreenshot

Asserts that screenshot of the target matches already approved one
target.assertScreenshot