ExUnit-style assertions backed by Fluffy.Expect.
Use this module after use ExUnit.Case (or your application's case module)
to replace the conflicting ExUnit imports:
use ExUnit.Case
use Fluffy.Assert
import Fluffy
import Fluffy.LocatorInside a test with an initialized session:
session
|> assert(visible(by_text("Creature registered")))
|> refute(page_title("Error"))Locator constructors take a locator. Page constructors target the active page.
All constructors return Fluffy.Expect values, not booleans.
Ordinary ExUnit assertions, including custom messages and pattern matching,
retain ExUnit semantics. With a typed expectation as the second argument,
assert/2 executes it and refute/2 executes its negation. Both return the
updated session. A third argument supplies expectation options.
Negation retains the driver's retry and missing-element semantics. Refuting
visibility accepts an absent or hidden element; use count(locator, 0) for
absence. Static and Live drivers check structural visibility, while Playwright
checks rendered visibility. Refutation does not turn driver errors into success.
Summary
Functions
Imports the assertion vocabulary without conflicts with ExUnit.
Executes a typed expectation, or delegates an ordinary assertion with a message to ExUnit.
Executes a typed expectation with additional options.
Equivalent to Fluffy.Expect.expect_event/3.
Equivalent to Fluffy.Expect.expect_event/4.
Equivalent to Fluffy.Expect.expect_event/5.
Asserts that the locator resolves to a visible element and returns the session.
Equivalent to Fluffy.Expect.to_be_checked/2.
Equivalent to Fluffy.Expect.to_be_disabled/2.
Equivalent to Fluffy.Expect.to_be_editable/2.
Equivalent to Fluffy.Expect.to_be_enabled/2.
Equivalent to Fluffy.Expect.to_be_focused/2. Requires Playwright.
Executes a negated expectation, or delegates an ordinary refutation with a message to ExUnit.
Executes a negated expectation with additional options.
Asserts that the locator is absent or hidden and returns the session.
Equivalent to Fluffy.Expect.to_be_visible/2.
Functions
Imports the assertion vocabulary without conflicts with ExUnit.
Executes a typed expectation, or delegates an ordinary assertion with a message to ExUnit.
Executes a typed expectation with additional options.
Equivalent to Fluffy.Expect.expect_event/3.
Equivalent to Fluffy.Expect.expect_event/4.
Equivalent to Fluffy.Expect.expect_event/5.
Asserts that the locator resolves to a visible element and returns the session.
Equivalent to assert(session, visible(locator), options).
For DOM presence regardless of visibility, use a count expectation.
Equivalent to Fluffy.Expect.to_be_checked/2.
Equivalent to Fluffy.Expect.to_have_count/3.
Equivalent to Fluffy.Expect.to_be_disabled/2.
Equivalent to Fluffy.Expect.to_be_editable/2.
Equivalent to Fluffy.Expect.to_be_enabled/2.
Equivalent to Fluffy.Expect.to_be_focused/2. Requires Playwright.
Equivalent to Fluffy.Expect.page_to_have_opener/2.
Equivalent to Fluffy.Expect.page_to_have_status/2.
Equivalent to Fluffy.Expect.page_to_have_title/2.
Equivalent to Fluffy.Expect.page_to_have_url/2.
Executes a negated expectation, or delegates an ordinary refutation with a message to ExUnit.
Executes a negated expectation with additional options.
Asserts that the locator is absent or hidden and returns the session.
Equivalent to refute(session, visible(locator), options).
Use count(locator, 0) to require DOM absence.
Equivalent to Fluffy.Expect.to_have_value/3.
Equivalent to Fluffy.Expect.to_have_values/3.
Equivalent to Fluffy.Expect.to_be_visible/2.