One logical page or tab within a Fluffy session.
A Phoenix page receives fresh Static or LiveView driver state whenever navigation commits a new document. Its monotonically increasing revision survives those state replacements.
This module also constructs expectations whose target is a page, mirroring Playwright's page-specific assertion surface.
Summary
Assertions
Expects the active page to name the requested opener page.
Expects the active page's normalized main-resource status.
Expects the active page title to equal a string or match a regular expression.
Expects the active page to have the requested URL.
Metadata
Assertions
@spec to_have_opener(term(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()
Expects the active page to name the requested opener page.
@spec to_have_status(non_neg_integer(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()
Expects the active page's normalized main-resource status.
@spec to_have_title(title_expectation(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()
Expects the active page title to equal a string or match a regular expression.
Like Playwright's toHaveTitle, the assertion retries on Live and Playwright
pages and normalizes whitespace before matching.
Options
:timeout(non_neg_integer/0) - Maximum time in milliseconds to wait for the operation.
@spec to_have_url(url_expectation(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()
Expects the active page to have the requested URL.
A string matches the complete canonical absolute URL after resolving a relative value against the session base URL. A regular expression matches that complete serialized URL.
A keyword list selects structured components. :path and :fragment are
exact serialized component values; omit either to ignore it. :fragment
excludes the leading #, and fragment: nil requires no fragment.
:query is a map from decoded parameter names to one value or an ordered
list of repeated values. Ordering between distinct names is ignored while
repeated-value order is retained. Bare names and names with an empty value
both decode to ""; + and %20 both decode to a space. Exact mode is the
default. query_mode: :subset permits unrelated names but still requires
the complete ordered value list for each requested name.
Structured components
:path(String.t/0) - Serialized URL pathname to match exactly.:query- Decoded query names and their ordered value or values.:query_mode- Require the complete query or allow unrelated parameter names. The default value is:exact.:fragment- Serialized fragment without#; nil requires no fragment.
Assertion options
:timeout(non_neg_integer/0) - Maximum time in milliseconds to wait for the operation.
Types
@opaque t()
@type url_component() :: {:path, String.t()} | {:query, %{required(String.t()) => query_value()}} | {:query_mode, :exact | :subset} | {:fragment, String.t() | nil}
@type url_expectation() :: String.t() | Regex.t() | [url_component()]