From 4d96d29f8353581197f238dc1c375c792cd3d51a Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Thu, 9 Jan 2025 13:12:34 +0200 Subject: [PATCH] Fix tests --- lib/plausible_web/controllers/auth_controller.ex | 1 + lib/plausible_web/live/components/verification.ex | 10 +++++----- .../templates/layout/base_email.html.heex | 4 +--- .../controllers/settings_controller_test.exs | 6 +++++- .../plausible_web/controllers/site_controller_test.exs | 1 + test/plausible_web/live/verification_test.exs | 5 +++-- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex index f9b53de98f328..c18ee85b5e758 100644 --- a/lib/plausible_web/controllers/auth_controller.ex +++ b/lib/plausible_web/controllers/auth_controller.ex @@ -57,6 +57,7 @@ defmodule PlausibleWeb.AuthController do flow = params["flow"] || PlausibleWeb.Flows.register() render(conn, "activate.html", + error: nil, has_email_code?: Plausible.Users.has_email_code?(user), has_any_memberships?: Plausible.Teams.Users.has_sites?(user), form_submit_url: "/activate?flow=#{flow}" diff --git a/lib/plausible_web/live/components/verification.ex b/lib/plausible_web/live/components/verification.ex index 4513aae550d98..ac796c6b8eee1 100644 --- a/lib/plausible_web/live/components/verification.ex +++ b/lib/plausible_web/live/components/verification.ex @@ -59,7 +59,7 @@ defmodule PlausibleWeb.Live.Components.Verification do Verifying your installation - <%= List.first(@interpretation.errors) %> + {List.first(@interpretation.errors)}

@@ -67,19 +67,19 @@ defmodule PlausibleWeb.Live.Components.Verification do

Awaiting your first pageview

-

<%= @message %>

+

{@message}

- <%= List.first(@interpretation.recommendations).text %>.  + {List.first(@interpretation.recommendations).text}.  <.styled_link href={List.first(@interpretation.recommendations).url} new_tab={true}> Learn more @@ -145,7 +145,7 @@ defmodule PlausibleWeb.Live.Components.Verification do <.focus_list> <:item :for={{diag, value} <- Map.from_struct(@verification_state.diagnostics)}> - <%= Phoenix.Naming.humanize(diag) %>: <%= value %> + {Phoenix.Naming.humanize(diag)}: {value} diff --git a/lib/plausible_web/templates/layout/base_email.html.heex b/lib/plausible_web/templates/layout/base_email.html.heex index fc5e13c86e6fa..2be2f7bae147f 100644 --- a/lib/plausible_web/templates/layout/base_email.html.heex +++ b/lib/plausible_web/templates/layout/base_email.html.heex @@ -11,6 +11,4 @@ <%= plausible_url() %>
-<%= if ee?() do %> - {"{{ pm:unsubscribe }}"} -<% end %> +

{{{ pm:unsubscribe }}}

diff --git a/test/plausible_web/controllers/settings_controller_test.exs b/test/plausible_web/controllers/settings_controller_test.exs index 5eb13b94b2dd6..162b7526bf340 100644 --- a/test/plausible_web/controllers/settings_controller_test.exs +++ b/test/plausible_web/controllers/settings_controller_test.exs @@ -830,7 +830,11 @@ defmodule PlausibleWeb.SettingsControllerTest do test "fails to update with no input", %{conn: conn} do conn = post(conn, Routes.settings_path(conn, :update_password), %{ - "user" => %{} + "user" => %{ + "password" => "", + "old_password" => "", + "password_confirmation" => "" + } }) assert html = html_response(conn, 200) diff --git a/test/plausible_web/controllers/site_controller_test.exs b/test/plausible_web/controllers/site_controller_test.exs index ba88a05bd8a1a..f79cce7ec8b81 100644 --- a/test/plausible_web/controllers/site_controller_test.exs +++ b/test/plausible_web/controllers/site_controller_test.exs @@ -378,6 +378,7 @@ defmodule PlausibleWeb.SiteControllerTest do conn = post(conn, "/sites", %{ "site" => %{ + "domain" => "", "timezone" => "Europe/London" } }) diff --git a/test/plausible_web/live/verification_test.exs b/test/plausible_web/live/verification_test.exs index 4238b93ce9f92..2c61fbb9dab80 100644 --- a/test/plausible_web/live/verification_test.exs +++ b/test/plausible_web/live/verification_test.exs @@ -10,6 +10,7 @@ defmodule PlausibleWeb.Live.VerificationTest do @retry_button ~s|a[phx-click="retry"]| # @go_to_dashboard_button ~s|a[href$="?skip_to_dashboard=true"]| @progress ~s|#progress-indicator p#progress| + @awaiting ~s|#progress-indicator p#awaiting| @heading ~s|#progress-indicator h2| describe "GET /:domain" do @@ -66,7 +67,7 @@ defmodule PlausibleWeb.Live.VerificationTest do html = render(lv) { - text_of_element(html, @progress) =~ + text_of_element(html, @awaiting) =~ "Awaiting your first pageview", html } @@ -99,7 +100,7 @@ defmodule PlausibleWeb.Live.VerificationTest do html = render(lv) - refute text_of_element(html, @progress) =~ "Awaiting your first pageview" + refute text_of_element(html, @awaiting) =~ "Awaiting your first pageview" refute_redirected(lv, "http://localhost:8000/#{URI.encode_www_form(site.domain)}") end