View Source Pages.Driver.LiveView (Pages v2.2.1)
A page driver for interacting with Phoenix.LiveView pages.
Summary
Functions
Called from Pages.click/4
when the given page is a LiveView.
Called from Pages.handle_redirect/1
when the given page is a LiveView.
Perform a live redirect to the given path.
Attempt to open the current page in a web browser.
Called from Pages.render_change/3
when the given page is a LiveView.
Called from Pages.render_hook/3
when the given page is a LiveView.
Called from Pages.render_upload/4
when the given page is a LiveView.
Called from Pages.rerender/1
when the given page is a LiveView.
Called from Pages.submit_form/2
when the given page is a LiveView.
Called from Pages.submit_form/4
and Pages.submit_form/5
when the given page is a LiveView.
Called from Pages.update_form/5
when the given page is a LiveView.
Initialize a live
with the given path.
Find a child component, and pass it as a new Page into the given function.
Types
@type t() :: %Pages.Driver.LiveView{ conn: Plug.Conn.t(), context: %{required(atom()) => any()}, live: any(), rendered: binary() | nil }
Functions
@spec click( Pages.Driver.t(), Pages.http_method(), Pages.text_filter() | nil, HtmlQuery.Css.selector() ) :: Pages.result()
Called from Pages.click/4
when the given page is a LiveView.
@spec handle_redirect(Pages.Driver.t()) :: Pages.Driver.t()
Called from Pages.handle_redirect/1
when the given page is a LiveView.
@spec live_redirect(Pages.Driver.t(), binary()) :: Pages.result()
Perform a live redirect to the given path.
When issuing a live_redirect from one live view to another live view where the
routes cross between two live_session
s, then live view will not just remount
the socket, but will issue a redirect. In this case, if the test pages have been
initialized via Phoenix.ConnTest.build_conn/0
, the test adapter will have the
URI host set to be www.example.com
... the live_redirect will be seen as an
external redirect.
When using live_redirect/2
between two live sessions, ensure that the initial
test setup (for example in ConnCase) instead calls
Phoenix.ConnTest.build_conn(:get, "http://localhost:4002/")
, so that redirects
are seen as internal redirects.
This is not implemented in Pages
due to its specificity to LiveView and LiveViewTest.
@spec open_browser(Pages.Driver.t()) :: Pages.Driver.t()
Attempt to open the current page in a web browser.
@spec render_change(Pages.Driver.t(), HtmlQuery.Css.selector(), Enum.t()) :: Pages.result()
Called from Pages.render_change/3
when the given page is a LiveView.
@spec render_hook(Pages.Driver.t(), binary(), Pages.attrs_t(), keyword()) :: Pages.result()
Called from Pages.render_hook/3
when the given page is a LiveView.
@spec render_upload(Pages.Driver.t(), Pages.live_view_upload(), binary(), integer()) :: Pages.result()
Called from Pages.render_upload/4
when the given page is a LiveView.
@spec rerender(Pages.Driver.t()) :: Pages.result()
Called from Pages.rerender/1
when the given page is a LiveView.
@spec submit_form(Pages.Driver.t(), HtmlQuery.Css.selector()) :: Pages.result()
Called from Pages.submit_form/2
when the given page is a LiveView.
@spec submit_form( Pages.Driver.t(), HtmlQuery.Css.selector(), atom(), Pages.attrs_t(), Pages.attrs_t() ) :: Pages.result()
Called from Pages.submit_form/4
and Pages.submit_form/5
when the given page is a LiveView.
Called from Pages.update_form/5
when the given page is a LiveView.
@spec visit(Pages.Driver.t(), binary()) :: Pages.result()
Initialize a live
with the given path.
This is called from Pages.visit/2
when the conn indicates that the pages is a LiveView,
and should only be called directly if the parent function does not work for some reason.
Find a child component, and pass it as a new Page into the given function.
Rerenders the top-level page upon completion. See Pages.with_child_component/3
.