Skip to content

Instantly share code, notes, and snippets.

@mcrumm
Created February 8, 2021 22:10
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
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!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment