Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LiveView artifacts
defmodule MyAppWeb.PageLiveTest do
use MyAppWeb.ConnCase
import Phoenix.LiveViewTest
@tag :tmp_dir
test "disconnected and connected render", %{conn: conn, tmp_dir: tmp_dir} do
{:ok, page_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Welcome to Phoenix!"
assert page_live
|> open_browser(&File.copy!(&1, Path.join([tmp_dir, "welcome.html"])))
|> render() =~ "Welcome to Phoenix!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment