Filament.Test.LiveView.Helpers (filament v0.2.1)

Copy Markdown

Helper functions for Rung 4 integration tests.

These wrap Phoenix.LiveViewTest functions with Filament-specific conventions. Import via use Filament.Test.LiveView.

Summary

Functions

Assert that selector element has CSS class class_name in the current render. Raises RuntimeError with a descriptive message on failure.

Click the element matching selector in a live view. Wraps Phoenix.LiveViewTest.element/2 + render_click/1. Returns the updated rendered HTML string.

Submit the form matching selector with params. Wraps Phoenix.LiveViewTest.element/2 + render_submit/2. Returns the updated rendered HTML string.

Return the current rendered text content (tags stripped) for the live view.

Functions

assert_has_class(view, selector, class_name)

@spec assert_has_class(
  view :: term(),
  selector :: String.t(),
  class_name :: String.t()
) :: :ok

Assert that selector element has CSS class class_name in the current render. Raises RuntimeError with a descriptive message on failure.

filament_click(view, selector)

@spec filament_click(view :: term(), selector :: String.t()) :: String.t()

Click the element matching selector in a live view. Wraps Phoenix.LiveViewTest.element/2 + render_click/1. Returns the updated rendered HTML string.

filament_submit(view, selector, params \\ %{})

@spec filament_submit(view :: term(), selector :: String.t(), params :: map()) ::
  String.t()

Submit the form matching selector with params. Wraps Phoenix.LiveViewTest.element/2 + render_submit/2. Returns the updated rendered HTML string.

filament_text(view)

@spec filament_text(view :: term()) :: String.t()

Return the current rendered text content (tags stripped) for the live view.