Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ukutaht committed Jan 9, 2025
1 parent 43c25f8 commit 4d96d29
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/plausible_web/controllers/auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
10 changes: 5 additions & 5 deletions lib/plausible_web/live/components/verification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,27 @@ defmodule PlausibleWeb.Live.Components.Verification do
<span :if={not @finished?}>Verifying your installation</span>
<span :if={@finished? and not @success? and @interpretation}>
<%= List.first(@interpretation.errors) %>
{List.first(@interpretation.errors)}
</span>
</.title>
<p :if={@finished? and @success?} id="progress" class="text-sm mt-4">
Your installation is working and visitors are being counted accurately
</p>
<p
:if={@finished? and @success? and @awaiting_first_pageview?}
id="progress"
id="awaiting"
class="text-sm mt-4 animate-pulse"
>
Awaiting your first pageview
</p>
<p :if={not @finished?} class="text-sm mt-4 animate-pulse" id="progress"><%= @message %></p>
<p :if={not @finished?} class="text-sm mt-4 animate-pulse" id="progress">{@message}</p>
<p
:if={@finished? and not @success? and @interpretation}
class="mt-4 text-sm text-ellipsis overflow-hidden"
id="recommendation"
>
<span><%= List.first(@interpretation.recommendations).text %>.&nbsp;</span>
<span>{List.first(@interpretation.recommendations).text}.&nbsp;</span>
<.styled_link href={List.first(@interpretation.recommendations).url} new_tab={true}>
Learn more
</.styled_link>
Expand Down Expand Up @@ -145,7 +145,7 @@ defmodule PlausibleWeb.Live.Components.Verification do
<.focus_list>
<:item :for={{diag, value} <- Map.from_struct(@verification_state.diagnostics)}>
<span class="text-sm">
<%= Phoenix.Naming.humanize(diag) %>: <span class="font-mono"><%= value %></span>
{Phoenix.Naming.humanize(diag)}: <span class="font-mono">{value}</span>
</span>
</:item>
</.focus_list>
Expand Down
4 changes: 1 addition & 3 deletions lib/plausible_web/templates/layout/base_email.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
<a href={plausible_url()}><%= plausible_url() %></a>
<br />

<%= if ee?() do %>
{"{{ pm:unsubscribe }}"}
<% end %>
<p :if={ee?()} phx-no-curly-interpolation>{{{ pm:unsubscribe }}}</p>
6 changes: 5 additions & 1 deletion test/plausible_web/controllers/settings_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/plausible_web/controllers/site_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ defmodule PlausibleWeb.SiteControllerTest do
conn =
post(conn, "/sites", %{
"site" => %{
"domain" => "",
"timezone" => "Europe/London"
}
})
Expand Down
5 changes: 3 additions & 2 deletions test/plausible_web/live/verification_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4d96d29

Please sign in to comment.