Skip to content

Instantly share code, notes, and snippets.

@mcrumm
Created February 8, 2021 22:10
Show Gist options
  • Save mcrumm/751f34c6a54df754c3f54cd747c42780 to your computer and use it in GitHub Desktop.
Save mcrumm/751f34c6a54df754c3f54cd747c42780 to your computer and use it in GitHub Desktop.
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