2021-06-03 03:51:43 +08:00
|
|
|
defmodule LivebookWeb.ExploreLiveTest do
|
2022-01-29 23:39:41 +08:00
|
|
|
use LivebookWeb.ConnCase, async: true
|
2021-06-03 03:51:43 +08:00
|
|
|
|
|
|
|
import Phoenix.LiveViewTest
|
|
|
|
|
|
|
|
test "link to introductory notebook correctly creates a new session", %{conn: conn} do
|
|
|
|
{:ok, view, _} = live(conn, "/explore")
|
|
|
|
|
|
|
|
assert {:error, {:live_redirect, %{to: to}}} =
|
|
|
|
view
|
|
|
|
|> element(~s{a}, "Let's go")
|
|
|
|
|> render_click()
|
|
|
|
|
|
|
|
assert to =~ "/sessions/"
|
|
|
|
|
|
|
|
{:ok, view, _} = live(conn, to)
|
|
|
|
assert render(view) =~ "Welcome to Livebook"
|
|
|
|
end
|
2021-06-15 03:25:18 +08:00
|
|
|
|
|
|
|
test "link to a new notebook creates an empty session", %{conn: conn} do
|
|
|
|
{:ok, view, _} =
|
|
|
|
conn
|
|
|
|
|> live("/explore/notebooks/new")
|
|
|
|
|> follow_redirect(conn)
|
|
|
|
|
|
|
|
assert render(view) =~ "Untitled notebook"
|
|
|
|
end
|
2021-06-03 03:51:43 +08:00
|
|
|
end
|