Playwright test assertions - LocatorAssertions, PageAssertions, APIResponseAssertions.
Entry point is assert-that which returns the appropriate assertions
object for the given Playwright type. Chain with assertion functions
and use not- variants for negation.
All assertion functions wrap calls in safe to return anomaly maps
on assertion failure rather than throwing.
Playwright test assertions - LocatorAssertions, PageAssertions, APIResponseAssertions. Entry point is `assert-that` which returns the appropriate assertions object for the given Playwright type. Chain with assertion functions and use `not-` variants for negation. All assertion functions wrap calls in `safe` to return anomaly maps on assertion failure rather than throwing.
(api-not ara)Returns negated APIResponseAssertions (expect the opposite).
Params:
ara - APIResponseAssertions instance.
Returns: APIResponseAssertions (negated).
Returns negated APIResponseAssertions (expect the opposite). Params: `ara` - APIResponseAssertions instance. Returns: APIResponseAssertions (negated).
(assert-that target)Creates an assertion object for the given Playwright instance.
Params:
target - Locator, Page, or APIResponse instance.
Returns: LocatorAssertions, PageAssertions, or APIResponseAssertions.
Creates an assertion object for the given Playwright instance. Params: `target` - Locator, Page, or APIResponse instance. Returns: LocatorAssertions, PageAssertions, or APIResponseAssertions.
(contains-class la class-val)(contains-class la class-val opts)Asserts the locator's class attribute contains the specified class.
Params:
la - LocatorAssertions instance.
class - String or vector of strings.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator's class attribute contains the specified class.
Params:
`la` - LocatorAssertions instance.
`class` - String or vector of strings.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(contains-text la text)(contains-text la text opts)Asserts the locator contains the specified text.
Params:
la - LocatorAssertions instance.
text - String or Pattern.
opts - Map, optional. {:timeout ms, :use-inner-text bool}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator contains the specified text.
Params:
`la` - LocatorAssertions instance.
`text` - String or Pattern.
`opts` - Map, optional. {:timeout ms, :use-inner-text bool}.
Returns:
nil or anomaly map on assertion failure.(has-accessible-description la desc)Asserts the locator has the specified accessible description.
Params:
la - LocatorAssertions instance.
desc - String or Pattern.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified accessible description. Params: `la` - LocatorAssertions instance. `desc` - String or Pattern. Returns: nil or anomaly map on assertion failure.
(has-accessible-error-message la msg)Asserts the locator has the specified accessible error message.
Params:
la - LocatorAssertions instance.
msg - String or Pattern.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified accessible error message. Params: `la` - LocatorAssertions instance. `msg` - String or Pattern. Returns: nil or anomaly map on assertion failure.
(has-accessible-name la name-val)Asserts the locator has the specified accessible name.
Params:
la - LocatorAssertions instance.
name - String or Pattern.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified accessible name. Params: `la` - LocatorAssertions instance. `name` - String or Pattern. Returns: nil or anomaly map on assertion failure.
(has-attribute la name value)(has-attribute la name value opts)Asserts the locator has the specified attribute with value.
Params:
la - LocatorAssertions instance.
name - String. Attribute name.
value - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified attribute with value.
Params:
`la` - LocatorAssertions instance.
`name` - String. Attribute name.
`value` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-class la class-val)(has-class la class-val opts)Asserts the locator has the specified CSS class.
Params:
la - LocatorAssertions instance.
class - String, Pattern, or vector of strings/patterns.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified CSS class.
Params:
`la` - LocatorAssertions instance.
`class` - String, Pattern, or vector of strings/patterns.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-count la count)(has-count la count opts)Asserts the locator resolves to the expected number of elements.
Params:
la - LocatorAssertions instance.
count - Long. Expected element count.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator resolves to the expected number of elements.
Params:
`la` - LocatorAssertions instance.
`count` - Long. Expected element count.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-css la name value)(has-css la name value opts)Asserts the locator has the specified CSS property with value.
Params:
la - LocatorAssertions instance.
name - String. CSS property name.
value - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified CSS property with value.
Params:
`la` - LocatorAssertions instance.
`name` - String. CSS property name.
`value` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-id la id)(has-id la id opts)Asserts the locator has the specified ID.
Params:
la - LocatorAssertions instance.
id - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified ID.
Params:
`la` - LocatorAssertions instance.
`id` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-js-property la name value)Asserts the locator has the specified JavaScript property.
Params:
la - LocatorAssertions instance.
name - String. Property name.
value - Object. Expected value.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified JavaScript property. Params: `la` - LocatorAssertions instance. `name` - String. Property name. `value` - Object. Expected value. Returns: nil or anomaly map on assertion failure.
(has-role la role)Asserts the locator has the specified ARIA role.
Params:
la - LocatorAssertions instance.
role - AriaRole enum value.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified ARIA role. Params: `la` - LocatorAssertions instance. `role` - AriaRole enum value. Returns: nil or anomaly map on assertion failure.
(has-text la text)(has-text la text opts)Asserts the locator has the specified text.
Params:
la - LocatorAssertions instance.
text - String or Pattern.
opts - Map, optional. {:timeout ms, :use-inner-text bool}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator has the specified text.
Params:
`la` - LocatorAssertions instance.
`text` - String or Pattern.
`opts` - Map, optional. {:timeout ms, :use-inner-text bool}.
Returns:
nil or anomaly map on assertion failure.(has-title pa title)(has-title pa title opts)Asserts the page has the specified title.
Params:
pa - PageAssertions instance.
title - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the page has the specified title.
Params:
`pa` - PageAssertions instance.
`title` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-url pa url)(has-url pa url opts)Asserts the page has the specified URL.
Params:
pa - PageAssertions instance.
url - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the page has the specified URL.
Params:
`pa` - PageAssertions instance.
`url` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-value la value)(has-value la value opts)Asserts the locator (input) has the specified value.
Params:
la - LocatorAssertions instance.
value - String or Pattern.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator (input) has the specified value.
Params:
`la` - LocatorAssertions instance.
`value` - String or Pattern.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(has-values la values)(has-values la values opts)Asserts the locator (multi-select) has the specified values.
Params:
la - LocatorAssertions instance.
values - Vector of strings or patterns.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator (multi-select) has the specified values.
Params:
`la` - LocatorAssertions instance.
`values` - Vector of strings or patterns.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-attached la)(is-attached la opts)Asserts the locator is attached to the DOM.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is attached to the DOM.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-checked la)(is-checked la opts)Asserts the locator (checkbox/radio) is checked.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator (checkbox/radio) is checked.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-disabled la)(is-disabled la opts)Asserts the locator is disabled.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is disabled.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-editable la)(is-editable la opts)Asserts the locator is editable.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is editable.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-empty la)Asserts the locator (input) is empty.
Params:
la - LocatorAssertions instance.
Returns: nil or anomaly map on assertion failure.
Asserts the locator (input) is empty. Params: `la` - LocatorAssertions instance. Returns: nil or anomaly map on assertion failure.
(is-enabled la)(is-enabled la opts)Asserts the locator is enabled.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is enabled.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-focused la)(is-focused la opts)Asserts the locator is focused.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is focused.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-hidden la)(is-hidden la opts)Asserts the locator is hidden.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is hidden.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(is-in-viewport la)(is-in-viewport la opts)Asserts the locator is in the viewport.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms, :ratio double}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is in the viewport.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms, :ratio double}.
Returns:
nil or anomaly map on assertion failure.(is-ok ara)Asserts the API response status is 2xx.
Params:
ara - APIResponseAssertions instance.
Returns: nil or anomaly map on assertion failure.
Asserts the API response status is 2xx. Params: `ara` - APIResponseAssertions instance. Returns: nil or anomaly map on assertion failure.
(is-visible la)(is-visible la opts)Asserts the locator is visible.
Params:
la - LocatorAssertions instance.
opts - Map, optional. {:timeout ms}.
Returns: nil or anomaly map on assertion failure.
Asserts the locator is visible.
Params:
`la` - LocatorAssertions instance.
`opts` - Map, optional. {:timeout ms}.
Returns:
nil or anomaly map on assertion failure.(loc-not la)Returns negated LocatorAssertions (expect the opposite).
Params:
la - LocatorAssertions instance.
Returns: LocatorAssertions (negated).
Returns negated LocatorAssertions (expect the opposite). Params: `la` - LocatorAssertions instance. Returns: LocatorAssertions (negated).
(matches-aria-snapshot la snapshot)Asserts the locator matches the ARIA snapshot.
Params:
la - LocatorAssertions instance.
snapshot - String. ARIA snapshot to match.
Returns: nil or anomaly map on assertion failure.
Asserts the locator matches the ARIA snapshot. Params: `la` - LocatorAssertions instance. `snapshot` - String. ARIA snapshot to match. Returns: nil or anomaly map on assertion failure.
(page-not pa)Returns negated PageAssertions (expect the opposite).
Params:
pa - PageAssertions instance.
Returns: PageAssertions (negated).
Returns negated PageAssertions (expect the opposite). Params: `pa` - PageAssertions instance. Returns: PageAssertions (negated).
(set-default-assertion-timeout! timeout)Sets the default timeout for all assertions.
Params:
timeout - Double. Timeout in milliseconds.
Sets the default timeout for all assertions. Params: `timeout` - Double. Timeout in milliseconds.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |