Typed event-wait values and event capture orchestration.
Events annotated "Playwright only" require the Playwright backend when passed
to Fluffy.wait_for/4. With the Phoenix backend, capture raises
Fluffy.CapabilityError before the action runs. Constructing an event value
does not require a session.
Download events accept:
:timeout(non_neg_integer/0) - Maximum time in milliseconds to wait for the operation. Playwright browser bookkeeping and navigation synchronization use the session timeout separately.:filename- Only capture downloads whose suggested filename matches this exact string or regex.:url- Only capture downloads whose URL matches this absolute string, regex, or URI predicate.:max_bytes(non_neg_integer/0) - Maximum number of response bytes to retain; defaults to 10,000,000.
Dialog events accept:
:timeout(non_neg_integer/0) - Maximum time in milliseconds to wait for the operation. Playwright browser bookkeeping and navigation synchronization use the session timeout separately.:decision(:accept,:dismiss,{:accept, prompt_text}, or a one-argument function) - Accept, dismiss, accept with prompt text, or decide from the captured dialog.:accept(trueorString.t/0) - Compatibility shorthand for accepting, optionally with prompt text.:dismiss(true) - Compatibility shorthand for dismissing the dialog.
File-chooser, page, popup, navigation, request, and response events accept the shared timeout option:
:timeout(non_neg_integer/0) - Maximum time in milliseconds to wait for the operation. Playwright browser bookkeeping and navigation synchronization use the session timeout separately.
Summary
Functions
Captures and handles the browser dialog opened by the action.
Captures the first download matching the optional filename and URL filters.
Captures the browser file chooser opened by the action.
Captures the first document navigation or URL change. HTTP redirects resolve to their final URL and status.
Captures the first new tab or window anywhere in the session.
Captures the first new tab or window opened by the current page.
Captures the first browser request matching the supplied matcher.
Captures the first browser response matching the supplied matcher.
Types
@type dialog_option() :: {:timeout, non_neg_integer()} | {:decision, :accept | :dismiss | {:accept, String.t()} | (Fluffy.Dialog.t() -> :accept | :dismiss | {:accept, String.t()})} | {:accept, true | String.t()} | {:dismiss, true}
@type download_option() :: {:timeout, non_neg_integer()} | {:filename, binary() | struct()} | {:url, binary() | struct() | (term() -> term())} | {:max_bytes, non_neg_integer()}
@type network_option() :: {:timeout, non_neg_integer()} | {:matcher, String.t() | Regex.t() | (term() -> boolean())}
@type option() :: timeout_option() | download_option() | dialog_option() | network_option()
@type timeout_option() :: {:timeout, non_neg_integer()}
@type type() ::
:dialog
| :download
| :file_chooser
| :navigation
| :page
| :popup
| :request
| :response
Functions
@spec dialog(term(), [dialog_option()]) :: t()
Captures and handles the browser dialog opened by the action.
@spec download(term(), [download_option()]) :: t()
Captures the first download matching the optional filename and URL filters.
Playwright uses the session timeout separately to save the captured download.
@spec file_chooser(term(), [timeout_option()]) :: t()
Captures the browser file chooser opened by the action.
@spec page(term(), [timeout_option()]) :: t()
Captures the first new tab or window anywhere in the session.
Equivalent to Playwright's context.waitForEvent('page'). Use popup/2
to capture only pages opened by the current page.
The session timeout applies separately to initializing the captured page.
@spec popup(term(), [timeout_option()]) :: t()
Captures the first new tab or window opened by the current page.
Equivalent to Playwright's page.waitForEvent('popup'); includes tabs opened
by target="_blank" links. The opener is fixed when the wait starts, even if
the callback switches pages. Use page/2 to capture any new page in the session.
The session timeout applies separately to initializing the captured page.
Captures the first browser request matching the supplied matcher.
Captures the first browser response matching the supplied matcher.