Test funnels list in settings

pull/2859/head
Adam Rutkowski 4 years ago
parent 813ba66d3d
commit da474a47a1

@ -2,7 +2,7 @@
<header class="relative">
<h2 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">Funnels</h2>
<p class="mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200">Compose goals into funnels</p>
<%= link(to: "https://plausible.io/docs/goal-conversions", target: "_blank", rel: "noreferrer") do %>
<%= link(to: "https://plausible.io/docs/funnels", target: "_blank", rel: "noreferrer") do %>
<svg class="w-6 h-6 absolute top-0 right-0 text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
<% end %>
</header>

@ -1329,4 +1329,37 @@ defmodule PlausibleWeb.SiteControllerTest do
"Your domain has been changed. You must update the JavaScript snippet on your site within 72 hours"
end
end
describe "GET /:website/settings/funnels" do
setup [:create_user, :log_in, :create_site]
test "lists funnels for the site and renders help link", %{conn: conn, site: site} do
{:ok, g1} = Plausible.Goals.create(site, %{"page_path" => "/go/to/blog/**"})
{:ok, g2} = Plausible.Goals.create(site, %{"event_name" => "Signup"})
{:ok, _} =
Plausible.Funnels.create(
site,
"From blog to signup",
[%{"goal_id" => g1.id}, %{"goal_id" => g2.id}]
)
{:ok, _} =
Plausible.Funnels.create(
site,
"From signup to blog",
[%{"goal_id" => g2.id}, %{"goal_id" => g1.id}]
)
conn = get(conn, "/#{site.domain}/settings/funnels")
resp = html_response(conn, 200)
assert resp =~ "Compose goals into funnels"
assert resp =~ "From blog to signup"
assert resp =~ "From signup to blog"
doc = Floki.parse_document!(resp)
assert [{"a", _, _}] = Floki.find(doc, "a[href=\"https://plausible.io/docs/funnels\"]")
end
end
end

Loading…
Cancel
Save