upgrade to phoenix 1.7
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -2,7 +2,6 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
use MemexWeb.ConnCase
|
||||
import Phoenix.LiveViewTest
|
||||
import Memex.Fixtures
|
||||
alias MemexWeb.Endpoint
|
||||
|
||||
@create_attrs %{
|
||||
content: "some content",
|
||||
@ -18,7 +17,7 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
}
|
||||
@invalid_attrs %{
|
||||
content: nil,
|
||||
tags_string: " ",
|
||||
tags_string: "invalid tags",
|
||||
slug: nil,
|
||||
visibility: nil
|
||||
}
|
||||
@ -31,24 +30,24 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
setup [:register_and_log_in_user, :create_context]
|
||||
|
||||
test "lists all contexts", %{conn: conn, context: context} do
|
||||
{:ok, _index_live, html} = live(conn, Routes.context_index_path(conn, :index))
|
||||
{:ok, _index_live, html} = live(conn, ~p"/contexts")
|
||||
|
||||
assert html =~ "contexts"
|
||||
assert html =~ context.slug
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, context: %{tags: [tag]}} do
|
||||
{:ok, index_live, html} = live(conn, Routes.context_index_path(conn, :index))
|
||||
{:ok, index_live, html} = live(conn, ~p"/contexts")
|
||||
|
||||
assert html =~ tag
|
||||
assert index_live |> element("a", tag) |> render_click()
|
||||
assert_patch(index_live, Routes.context_index_path(conn, :search, tag))
|
||||
assert_patch(index_live, ~p"/contexts/#{tag}")
|
||||
end
|
||||
|
||||
test "saves new context", %{conn: conn} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.context_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/contexts")
|
||||
assert index_live |> element("a", "new context") |> render_click() =~ "new context"
|
||||
assert_patch(index_live, Routes.context_index_path(conn, :new))
|
||||
assert_patch(index_live, ~p"/contexts/new")
|
||||
|
||||
assert index_live
|
||||
|> form("#context-form")
|
||||
@ -58,19 +57,19 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
index_live
|
||||
|> form("#context-form")
|
||||
|> render_submit(context: @create_attrs)
|
||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/contexts")
|
||||
|
||||
assert html =~ "#{@create_attrs.slug} created"
|
||||
assert html =~ @create_attrs.slug
|
||||
end
|
||||
|
||||
test "updates context in listing", %{conn: conn, context: context} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.context_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/contexts")
|
||||
|
||||
assert index_live |> element(~s/a[aria-label="edit #{context.slug}"]/) |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.context_index_path(conn, :edit, context.slug))
|
||||
assert_patch(index_live, ~p"/contexts/#{context}/edit")
|
||||
|
||||
assert index_live
|
||||
|> form("#context-form")
|
||||
@ -80,14 +79,14 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
index_live
|
||||
|> form("#context-form")
|
||||
|> render_submit(context: @update_attrs)
|
||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/contexts")
|
||||
|
||||
assert html =~ "#{@update_attrs.slug} saved"
|
||||
assert html =~ "some-updated-slug"
|
||||
end
|
||||
|
||||
test "deletes context in listing", %{conn: conn, context: context} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.context_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/contexts")
|
||||
|
||||
assert index_live |> element(~s/a[aria-label="delete #{context.slug}"]/) |> render_click()
|
||||
refute has_element?(index_live, "#context-#{context.id}")
|
||||
@ -98,16 +97,16 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
setup [:register_and_log_in_user, :create_context]
|
||||
|
||||
test "displays context", %{conn: conn, context: context} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
{:ok, _show_live, html} = live(conn, ~p"/context/#{context}")
|
||||
|
||||
assert html =~ "context"
|
||||
assert html =~ context.slug
|
||||
end
|
||||
|
||||
test "updates context within modal", %{conn: conn, context: context} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/context/#{context}")
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
assert_patch(show_live, Routes.context_show_path(conn, :edit, context.slug))
|
||||
assert_patch(show_live, ~p"/context/#{context}/edit")
|
||||
|
||||
html =
|
||||
show_live
|
||||
@ -121,20 +120,20 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
show_live
|
||||
|> form("#context-form")
|
||||
|> render_submit(context: Map.put(@update_attrs, "slug", context.slug))
|
||||
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|> follow_redirect(conn, ~p"/context/#{context}")
|
||||
|
||||
assert html =~ "#{context.slug} saved"
|
||||
assert html =~ "tag2"
|
||||
end
|
||||
|
||||
test "deletes context", %{conn: conn, context: context} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/context/#{context}")
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|> element(~s/button[aria-label="delete #{context.slug}"]/)
|
||||
|> render_click()
|
||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/contexts")
|
||||
|
||||
refute has_element?(index_live, "#context-#{context.id}")
|
||||
end
|
||||
@ -157,18 +156,18 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, context: %{tags: [tag]} = context} do
|
||||
{:ok, show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
{:ok, show_live, html} = live(conn, ~p"/context/#{context}")
|
||||
|
||||
assert html =~ tag
|
||||
assert show_live |> element("a", tag) |> render_click()
|
||||
assert_redirect(show_live, Routes.context_index_path(conn, :search, tag))
|
||||
assert_redirect(show_live, ~p"/contexts/#{tag}")
|
||||
end
|
||||
|
||||
test "displays context", %{conn: conn, context: context, note: %{slug: note_slug}} do
|
||||
{:ok, show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
{:ok, show_live, html} = live(conn, ~p"/context/#{context}")
|
||||
|
||||
assert html =~ "context"
|
||||
assert html =~ Routes.note_show_path(Endpoint, :show, note_slug)
|
||||
assert html =~ ~p"/note/#{note_slug}"
|
||||
assert has_element?(show_live, "a", note_slug)
|
||||
end
|
||||
end
|
||||
|
11
test/memex_web/live/faq_live_test.exs
Normal file
11
test/memex_web/live/faq_live_test.exs
Normal file
@ -0,0 +1,11 @@
|
||||
defmodule MemexWeb.FaqLiveTest do
|
||||
use MemexWeb.ConnCase
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
test "disconnected and connected render", %{conn: conn} do
|
||||
{:ok, page_live, disconnected_html} = live(conn, ~p"/faq")
|
||||
assert disconnected_html =~ "faq"
|
||||
assert render(page_live) =~ "faq"
|
||||
end
|
||||
end
|
@ -4,7 +4,7 @@ defmodule MemexWeb.HomeLiveTest do
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
test "disconnected and connected render", %{conn: conn} do
|
||||
{:ok, page_live, disconnected_html} = live(conn, "/")
|
||||
{:ok, page_live, disconnected_html} = live(conn, ~p"/")
|
||||
assert disconnected_html =~ "memEx"
|
||||
assert render(page_live) =~ "memEx"
|
||||
end
|
@ -21,16 +21,16 @@ defmodule MemexWeb.InviteLiveTest do
|
||||
end
|
||||
|
||||
test "lists all invites", %{conn: conn, invite: invite} do
|
||||
{:ok, _index_live, html} = live(conn, Routes.invite_index_path(conn, :index))
|
||||
{:ok, _index_live, html} = live(conn, ~p"/invites")
|
||||
|
||||
assert html =~ "invites"
|
||||
assert html =~ invite.name
|
||||
end
|
||||
|
||||
test "saves new invite", %{conn: conn} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.invite_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/invites")
|
||||
assert index_live |> element("a", "create invite") |> render_click() =~ "new invite"
|
||||
assert_patch(index_live, Routes.invite_index_path(conn, :new))
|
||||
assert_patch(index_live, ~p"/invites/new")
|
||||
|
||||
assert index_live
|
||||
|> form("#invite-form")
|
||||
@ -40,19 +40,19 @@ defmodule MemexWeb.InviteLiveTest do
|
||||
index_live
|
||||
|> form("#invite-form")
|
||||
|> render_submit(invite: @create_attrs)
|
||||
|> follow_redirect(conn, Routes.invite_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/invites")
|
||||
|
||||
assert html =~ "some name created successfully"
|
||||
end
|
||||
|
||||
test "updates invite in listing", %{conn: conn, invite: invite} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.invite_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/invites")
|
||||
|
||||
assert index_live
|
||||
|> element(~s/a[aria-label="edit invite for #{invite.name}"]/)
|
||||
|> render_click() =~ "edit invite"
|
||||
|
||||
assert_patch(index_live, Routes.invite_index_path(conn, :edit, invite))
|
||||
assert_patch(index_live, ~p"/invites/#{invite}/edit")
|
||||
|
||||
assert index_live
|
||||
|> form("#invite-form")
|
||||
@ -62,13 +62,13 @@ defmodule MemexWeb.InviteLiveTest do
|
||||
index_live
|
||||
|> form("#invite-form")
|
||||
|> render_submit(invite: @update_attrs)
|
||||
|> follow_redirect(conn, Routes.invite_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/invites")
|
||||
|
||||
assert html =~ "some updated name updated successfully"
|
||||
end
|
||||
|
||||
test "deletes invite in listing", %{conn: conn, invite: invite} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.invite_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/invites")
|
||||
|
||||
assert index_live
|
||||
|> element(~s/a[aria-label="delete invite for #{invite.name}"]/)
|
||||
|
@ -3,7 +3,6 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
import Memex.Fixtures
|
||||
alias MemexWeb.Endpoint
|
||||
|
||||
@create_attrs %{
|
||||
content: "some content",
|
||||
@ -19,7 +18,7 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
}
|
||||
@invalid_attrs %{
|
||||
content: nil,
|
||||
tags_string: " ",
|
||||
tags_string: "invalid tags",
|
||||
slug: nil,
|
||||
visibility: nil
|
||||
}
|
||||
@ -32,24 +31,24 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
setup [:register_and_log_in_user, :create_note]
|
||||
|
||||
test "lists all notes", %{conn: conn, note: note} do
|
||||
{:ok, _index_live, html} = live(conn, Routes.note_index_path(conn, :index))
|
||||
{:ok, _index_live, html} = live(conn, ~p"/notes")
|
||||
|
||||
assert html =~ "notes"
|
||||
assert html =~ note.slug
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, note: %{tags: [tag]}} do
|
||||
{:ok, index_live, html} = live(conn, Routes.note_index_path(conn, :index))
|
||||
{:ok, index_live, html} = live(conn, ~p"/notes")
|
||||
|
||||
assert html =~ tag
|
||||
assert index_live |> element("a", tag) |> render_click()
|
||||
assert_patch(index_live, Routes.note_index_path(conn, :search, tag))
|
||||
assert_patch(index_live, ~p"/notes/#{tag}")
|
||||
end
|
||||
|
||||
test "saves new note", %{conn: conn} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.note_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/notes")
|
||||
assert index_live |> element("a", "new note") |> render_click() =~ "new note"
|
||||
assert_patch(index_live, Routes.note_index_path(conn, :new))
|
||||
assert_patch(index_live, ~p"/notes/new")
|
||||
|
||||
html =
|
||||
index_live
|
||||
@ -63,19 +62,19 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
index_live
|
||||
|> form("#note-form")
|
||||
|> render_submit(note: @create_attrs)
|
||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/notes")
|
||||
|
||||
assert html =~ "#{@create_attrs.slug} created"
|
||||
assert html =~ @create_attrs.slug
|
||||
end
|
||||
|
||||
test "updates note in listing", %{conn: conn, note: note} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.note_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/notes")
|
||||
|
||||
assert index_live |> element(~s/a[aria-label="edit #{note.slug}"]/) |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.note_index_path(conn, :edit, note.slug))
|
||||
assert_patch(index_live, ~p"/notes/#{note}/edit")
|
||||
|
||||
assert index_live
|
||||
|> form("#note-form")
|
||||
@ -85,14 +84,14 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
index_live
|
||||
|> form("#note-form")
|
||||
|> render_submit(note: @update_attrs)
|
||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/notes")
|
||||
|
||||
assert html =~ "#{@update_attrs.slug} saved"
|
||||
assert html =~ @update_attrs.slug
|
||||
end
|
||||
|
||||
test "deletes note in listing", %{conn: conn, note: note} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.note_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/notes")
|
||||
|
||||
assert index_live |> element(~s/a[aria-label="delete #{note.slug}"]/) |> render_click()
|
||||
refute has_element?(index_live, "#note-#{note.id}")
|
||||
@ -103,16 +102,16 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
setup [:register_and_log_in_user, :create_note]
|
||||
|
||||
test "displays note", %{conn: conn, note: note} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
{:ok, _show_live, html} = live(conn, ~p"/note/#{note}")
|
||||
|
||||
assert html =~ "note"
|
||||
assert html =~ note.slug
|
||||
end
|
||||
|
||||
test "updates note within modal", %{conn: conn, note: note} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/note/#{note}")
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
assert_patch(show_live, Routes.note_show_path(conn, :edit, note.slug))
|
||||
assert_patch(show_live, ~p"/note/#{note}/edit")
|
||||
|
||||
assert show_live
|
||||
|> form("#note-form")
|
||||
@ -122,20 +121,20 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
show_live
|
||||
|> form("#note-form")
|
||||
|> render_submit(note: @update_attrs |> Map.put(:slug, note.slug))
|
||||
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
|> follow_redirect(conn, ~p"/note/#{note}")
|
||||
|
||||
assert html =~ "#{note.slug} saved"
|
||||
assert html =~ note.slug
|
||||
end
|
||||
|
||||
test "deletes note", %{conn: conn, note: note} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/note/#{note}")
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|> element(~s/button[aria-label="delete #{note.slug}"]/)
|
||||
|> render_click()
|
||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/notes")
|
||||
|
||||
refute has_element?(index_live, "#note-#{note.id}")
|
||||
end
|
||||
@ -155,11 +154,11 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, note: %{tags: [tag]} = note} do
|
||||
{:ok, show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
{:ok, show_live, html} = live(conn, ~p"/note/#{note}")
|
||||
|
||||
assert html =~ tag
|
||||
assert show_live |> element("a", tag) |> render_click()
|
||||
assert_redirect(show_live, Routes.note_index_path(conn, :search, tag))
|
||||
assert_redirect(show_live, ~p"/notes/#{tag}")
|
||||
end
|
||||
|
||||
test "displays context", %{
|
||||
@ -167,11 +166,10 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
backlinked_note: %{slug: backlinked_note_slug},
|
||||
note: %{slug: note_slug}
|
||||
} do
|
||||
{:ok, show_live, html} =
|
||||
live(conn, Routes.note_show_path(conn, :show, backlinked_note_slug))
|
||||
{:ok, show_live, html} = live(conn, ~p"/note/#{backlinked_note_slug}")
|
||||
|
||||
assert html =~ "context"
|
||||
assert html =~ Routes.note_show_path(Endpoint, :show, note_slug)
|
||||
assert html =~ ~p"/note/#{note_slug}"
|
||||
assert has_element?(show_live, "a", note_slug)
|
||||
end
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
}
|
||||
@invalid_attrs %{
|
||||
description: nil,
|
||||
tags_string: " ",
|
||||
tags_string: "invalid tags",
|
||||
slug: nil,
|
||||
visibility: nil
|
||||
}
|
||||
@ -42,25 +42,25 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
setup [:register_and_log_in_user, :create_pipeline]
|
||||
|
||||
test "lists all pipelines", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, _index_live, html} = live(conn, Routes.pipeline_index_path(conn, :index))
|
||||
{:ok, _index_live, html} = live(conn, ~p"/pipelines")
|
||||
|
||||
assert html =~ "pipelines"
|
||||
assert html =~ pipeline.description
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, pipeline: %{tags: [tag]}} do
|
||||
{:ok, index_live, html} = live(conn, Routes.pipeline_index_path(conn, :index))
|
||||
{:ok, index_live, html} = live(conn, ~p"/pipelines")
|
||||
|
||||
assert html =~ tag
|
||||
assert index_live |> element("a", tag) |> render_click()
|
||||
assert_patch(index_live, Routes.pipeline_index_path(conn, :search, tag))
|
||||
assert_patch(index_live, ~p"/pipelines/#{tag}")
|
||||
end
|
||||
|
||||
test "saves new pipeline", %{conn: conn} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.pipeline_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/pipelines")
|
||||
|
||||
assert index_live |> element("a", "new pipeline") |> render_click() =~ "new pipeline"
|
||||
assert_patch(index_live, Routes.pipeline_index_path(conn, :new))
|
||||
assert_patch(index_live, ~p"/pipelines/new")
|
||||
|
||||
assert index_live
|
||||
|> form("#pipeline-form")
|
||||
@ -70,19 +70,19 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
index_live
|
||||
|> form("#pipeline-form")
|
||||
|> render_submit(pipeline: @create_attrs)
|
||||
|> follow_redirect(conn, Routes.pipeline_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/pipelines")
|
||||
|
||||
assert html =~ "#{@create_attrs.slug} created"
|
||||
assert html =~ @create_attrs.description
|
||||
end
|
||||
|
||||
test "updates pipeline in listing", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.pipeline_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/pipelines")
|
||||
|
||||
assert index_live |> element(~s/a[aria-label="edit #{pipeline.slug}"]/) |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.pipeline_index_path(conn, :edit, pipeline.slug))
|
||||
assert_patch(index_live, ~p"/pipelines/#{pipeline}/edit")
|
||||
|
||||
assert index_live
|
||||
|> form("#pipeline-form")
|
||||
@ -92,14 +92,14 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
index_live
|
||||
|> form("#pipeline-form")
|
||||
|> render_submit(pipeline: @update_attrs)
|
||||
|> follow_redirect(conn, Routes.pipeline_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/pipelines")
|
||||
|
||||
assert html =~ "#{@update_attrs.slug} saved"
|
||||
assert html =~ @update_attrs.description
|
||||
end
|
||||
|
||||
test "deletes pipeline in listing", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, index_live, _html} = live(conn, Routes.pipeline_index_path(conn, :index))
|
||||
{:ok, index_live, _html} = live(conn, ~p"/pipelines")
|
||||
|
||||
assert index_live
|
||||
|> element(~s/a[aria-label="delete #{pipeline.slug}"]/)
|
||||
@ -113,16 +113,16 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
setup [:register_and_log_in_user, :create_pipeline]
|
||||
|
||||
test "displays pipeline", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, _show_live, html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ "pipeline"
|
||||
assert html =~ pipeline.description
|
||||
end
|
||||
|
||||
test "updates pipeline within modal", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :edit, pipeline.slug))
|
||||
assert_patch(show_live, ~p"/pipeline/#{pipeline}/edit")
|
||||
|
||||
html =
|
||||
show_live
|
||||
@ -136,34 +136,34 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
show_live
|
||||
|> form("#pipeline-form")
|
||||
|> render_submit(pipeline: @update_attrs |> Map.put(:slug, pipeline.slug))
|
||||
|> follow_redirect(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|> follow_redirect(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ "#{pipeline.slug} saved"
|
||||
assert html =~ @update_attrs.description
|
||||
end
|
||||
|
||||
test "deletes pipeline", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|> element(~s/button[aria-label="delete #{pipeline.slug}"]/)
|
||||
|> render_click()
|
||||
|> follow_redirect(conn, Routes.pipeline_index_path(conn, :index))
|
||||
|> follow_redirect(conn, ~p"/pipelines")
|
||||
|
||||
refute has_element?(index_live, "#pipeline-#{pipeline.id}")
|
||||
end
|
||||
|
||||
test "creates a step", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
show_live |> element("a", "add step") |> render_click()
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :add_step, pipeline.slug))
|
||||
assert_patch(show_live, ~p"/pipeline/#{pipeline}/add_step")
|
||||
|
||||
{:ok, _show_live, html} =
|
||||
show_live
|
||||
|> form("#step-form")
|
||||
|> render_submit(step: @step_create_attrs)
|
||||
|> follow_redirect(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|> follow_redirect(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ @step_create_attrs.title
|
||||
assert html =~ @step_create_attrs.content
|
||||
@ -180,21 +180,21 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
end
|
||||
|
||||
test "searches by tag", %{conn: conn, pipeline: %{tags: [tag]} = pipeline} do
|
||||
{:ok, show_live, html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ tag
|
||||
assert show_live |> element("a", tag) |> render_click()
|
||||
assert_redirect(show_live, Routes.pipeline_index_path(conn, :search, tag))
|
||||
assert_redirect(show_live, ~p"/pipelines/#{tag}")
|
||||
end
|
||||
|
||||
test "updates a step", %{conn: conn, pipeline: pipeline, step: step} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
show_live
|
||||
|> element(~s/a[aria-label="edit #{step.title}"]/)
|
||||
|> render_click()
|
||||
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :edit_step, pipeline.slug, step.id))
|
||||
assert_patch(show_live, ~p"/pipeline/#{pipeline}/#{step.id}")
|
||||
|
||||
assert show_live
|
||||
|> form("#step-form")
|
||||
@ -204,21 +204,21 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
show_live
|
||||
|> form("#step-form")
|
||||
|> render_submit(step: @step_update_attrs)
|
||||
|> follow_redirect(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|> follow_redirect(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ @step_update_attrs.title
|
||||
assert html =~ @step_update_attrs.content
|
||||
end
|
||||
|
||||
test "deletes a step", %{conn: conn, pipeline: pipeline, step: step} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
html =
|
||||
show_live
|
||||
|> element(~s/button[aria-label="delete #{step.title}"]/)
|
||||
|> render_click()
|
||||
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
assert_patch(show_live, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
assert html =~ "#{step.title} deleted"
|
||||
refute html =~ step.content
|
||||
@ -238,7 +238,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
|
||||
test "reorders a step",
|
||||
%{conn: conn, pipeline: pipeline, first_step: first_step, second_step: second_step} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
{:ok, show_live, _html} = live(conn, ~p"/pipeline/#{pipeline}")
|
||||
|
||||
html =
|
||||
show_live
|
||||
|
Reference in New Issue
Block a user