View Source Pages.Driver.LiveView (Pages v0.13.2)

A page driver for interacting with Phoenix.LiveView pages.

Link to this section Summary

Functions

Called from Pages.click/4 when the given page is a LiveView.

Perform a live redirect to the given path.

Called from Paged.render_change/3 when the given page is a LiveView.

Called from Paged.render_hook/3 when the given page is a LiveView.

Called from Paged.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.update_form/4 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.

Link to this section Types

@type t() :: %Pages.Driver.LiveView{
  conn: Plug.Conn.t(),
  live: any(),
  rendered: binary() | nil
}

Link to this section Functions

Link to this function

click(page, atom, maybe_title, selector)

View Source

Called from Pages.click/4 when the given page is a LiveView.

Link to this function

live_redirect(page, destination_path)

View Source
@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_sessions, 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.

Link to this function

render_change(page, selector, value)

View Source
@spec render_change(Pages.Driver.t(), HtmlQuery.Css.selector(), Enum.t()) ::
  Pages.result()

Called from Paged.render_change/3 when the given page is a LiveView.

Link to this function

render_hook(page, event, value_attrs, options)

View Source
@spec render_hook(Pages.Driver.t(), binary(), Pages.attrs_t(), keyword()) ::
  Pages.result()

Called from Paged.render_hook/3 when the given page is a LiveView.

Link to this function

render_upload(page, upload, entry_name, percent)

View Source
@spec render_upload(Pages.Driver.t(), Pages.live_view_upload(), binary(), integer()) ::
  Pages.result()

Called from Paged.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.

Link to this function

submit_form(page, selector)

View Source
@spec submit_form(Pages.Driver.t(), HtmlQuery.Css.selector()) :: Pages.result()

Called from Pages.submit_form/2 when the given page is a LiveView.

Link to this function

submit_form(page, selector, schema, form_attrs, hidden_attrs \\ %{})

View Source

Called from Pages.submit_form/4 and Pages.submit_form/5 when the given page is a LiveView.

Link to this function

update_form(page, selector, schema, attrs, opts \\ [])

View Source

Called from Pages.update_form/4 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.

Link to this function

with_child_component(page, child_id, fun)

View Source

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.