From eacb5f6ce445a01bbdb3a046e3da5f9b2ad7ec87 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Mon, 27 Nov 2023 16:23:32 +0100 Subject: [PATCH] Rest of the fsckn owl --- lib/plausible/billing/quota.ex | 14 ++-- lib/plausible/plugins/api/token.ex | 14 ++-- .../site/memberships/accept_invitation.ex | 2 +- lib/plausible_release.ex | 12 ++-- lib/plausible_web/router.ex | 2 +- .../templates/auth/activate.html.heex | 66 +++++++++++++++---- .../email/google_analytics_import.html.heex | 17 ++--- ..._error.html.eex => server_error.html.heex} | 6 +- lib/plausible_web/views/error_view.ex | 13 ++-- test/plausible/plugins/api/token_test.exs | 8 ++- test/plausible/plugins/api/tokens_test.exs | 1 - test/plausible/release_test.exs | 10 +-- .../memberships/accept_invitation_test.exs | 3 + .../admin_auth_controller_test.exs | 3 +- .../controllers/auth_controller/logs_test.exs | 8 +++ .../controllers/auth_controller_test.exs | 8 +++ .../controllers/avatar_controller_test.exs | 8 +++ .../error_report_controller_test.exs | 2 + .../controllers/page_controller_test.exs | 8 +++ .../controllers/stats_controller_test.exs | 1 + .../unsubscribe_controller_test.exs | 8 +++ .../plugs/first_launch_plug_test.exs | 15 +---- test/support/conn_case.ex | 1 + test/test_helper.exs | 2 + 24 files changed, 155 insertions(+), 77 deletions(-) rename lib/plausible_web/templates/error/{server_error.html.eex => server_error.html.heex} (94%) diff --git a/lib/plausible/billing/quota.ex b/lib/plausible/billing/quota.ex index a4e37d644..569c73062 100644 --- a/lib/plausible/billing/quota.ex +++ b/lib/plausible/billing/quota.ex @@ -209,13 +209,7 @@ defmodule Plausible.Billing.Quota do stats_api_usage = from a in Plausible.Auth.ApiKey, where: a.user_id == ^user.id queries = - if Plausible.Release.selfhost?() do - [ - {Props, props_usage_query}, - {RevenueGoals, revenue_goals_usage}, - {StatsAPI, stats_api_usage} - ] - else + on_full_build do funnels_usage_query = from f in "funnels", inner_join: os in subquery(owned_sites_query(user)), @@ -227,6 +221,12 @@ defmodule Plausible.Billing.Quota do {RevenueGoals, revenue_goals_usage}, {StatsAPI, stats_api_usage} ] + else + [ + {Props, props_usage_query}, + {RevenueGoals, revenue_goals_usage}, + {StatsAPI, stats_api_usage} + ] end Enum.reduce(queries, [], fn {feature, query}, acc -> diff --git a/lib/plausible/plugins/api/token.ex b/lib/plausible/plugins/api/token.ex index 4330da0d9..4f64ccbe8 100644 --- a/lib/plausible/plugins/api/token.ex +++ b/lib/plausible/plugins/api/token.ex @@ -10,6 +10,7 @@ defmodule Plausible.Plugins.API.Token do It is prefixed with a plain text identifier allowing source scanning for leaked secrets. """ + use Plausible use Ecto.Schema import Ecto.Changeset @@ -63,10 +64,15 @@ defmodule Plausible.Plugins.API.Token do can scan repositories for accidental secret commits. """ def prefix() do - case {Plausible.Release.selfhost?(), Application.get_env(:plausible, :environment)} do - {true, _} -> "plausible-plugin-selfhost" - {false, "prod"} -> "plausible-plugin" - {false, env} -> "plausible-plugin-#{env}" + on_full_build do + env = Application.get_env(:plausible, :environment) + + case env do + "prod" -> "plausible-plugin" + env -> "plausible-plugin-#{env}" + end + else + "plausible-plugin-selfhost" end end diff --git a/lib/plausible/site/memberships/accept_invitation.ex b/lib/plausible/site/memberships/accept_invitation.ex index 4ba1720a1..a96b16c97 100644 --- a/lib/plausible/site/memberships/accept_invitation.ex +++ b/lib/plausible/site/memberships/accept_invitation.ex @@ -50,7 +50,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do @spec accept_invitation(String.t(), Auth.User.t(), Keyword.t()) :: {:ok, Site.Membership.t()} | {:error, :invitation_not_found | Ecto.Changeset.t()} def accept_invitation(invitation_id, user, opts \\ []) do - selfhost? = Keyword.get(opts, :selfhost?, Plausible.Release.selfhost?()) + selfhost? = Keyword.get(opts, :selfhost?, small_build?()) with {:ok, invitation} <- Invitations.find_for_user(invitation_id, user) do membership = get_or_create_membership(invitation, user) diff --git a/lib/plausible_release.ex b/lib/plausible_release.ex index 766873ff2..057e3bc53 100644 --- a/lib/plausible_release.ex +++ b/lib/plausible_release.ex @@ -1,4 +1,5 @@ defmodule Plausible.Release do + use Plausible use Plausible.Repo require Logger @@ -10,13 +11,12 @@ defmodule Plausible.Release do :ecto ] - @spec selfhost? :: boolean - def selfhost? do - Application.fetch_env!(@app, :is_selfhost) - end - def should_be_first_launch? do - selfhost?() and not (_has_users? = Repo.exists?(Plausible.Auth.User)) + on_full_build do + false + else + not (_has_users? = Repo.exists?(Plausible.Auth.User)) + end end def migrate do diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.ex index 099361d92..b6d1e00c9 100644 --- a/lib/plausible_web/router.ex +++ b/lib/plausible_web/router.ex @@ -10,7 +10,7 @@ defmodule PlausibleWeb.Router do plug :fetch_live_flash plug :put_secure_browser_headers plug PlausibleWeb.Plugs.NoRobots - plug PlausibleWeb.FirstLaunchPlug, redirect_to: "/register" + on_full_build(do: nil, else: plug(PlausibleWeb.FirstLaunchPlug, redirect_to: "/register")) plug PlausibleWeb.SessionTimeoutPlug, timeout_after_seconds: @two_weeks_in_seconds plug PlausibleWeb.AuthPlug plug PlausibleWeb.LastSeenPlug diff --git a/lib/plausible_web/templates/auth/activate.html.heex b/lib/plausible_web/templates/auth/activate.html.heex index cce619150..93e940525 100644 --- a/lib/plausible_web/templates/auth/activate.html.heex +++ b/lib/plausible_web/templates/auth/activate.html.heex @@ -3,9 +3,9 @@ <%= form_for @conn, "/activate", [class: "w-full max-w-lg mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 py-6 mb-4 mt-8"], fn f -> %>

<%= if @has_any_memberships? do %> - Verify your email address + Verify your email address <% else %> - Activate your account + Activate your account <% end %>

@@ -15,7 +15,17 @@
- <%= text_input f, :code, class: "tracking-widest font-medium shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-36 px-8 border-gray-300 dark:border-gray-500 rounded-l-md dark:text-gray-200 dark:bg-gray-900", oninput: "this.value=this.value.replace(/[^0-9]/g, ''); if (this.value.length >= 4) document.getElementById('submit').focus()", onclick: "this.select();", maxlength: "4", placeholder: "••••", style: "letter-spacing: 10px;", required: "required" %> + <%= text_input(f, :code, + class: + "tracking-widest font-medium shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-36 px-8 border-gray-300 dark:border-gray-500 rounded-l-md dark:text-gray-200 dark:bg-gray-900", + oninput: + "this.value=this.value.replace(/[^0-9]/g, ''); if (this.value.length >= 4) document.getElementById('submit').focus()", + onclick: "this.select();", + maxlength: "4", + placeholder: "••••", + style: "letter-spacing: 10px;", + required: "required" + ) %>
@@ -26,11 +36,27 @@
  1. Check your spam folder
  2. -
  3. <%= link("Send a new code", class: "underline text-indigo-600", to: "/activate/request-code", method: :post) %> to <%= @conn.assigns[:current_user].email %>
  4. +
  5. + <%= link("Send a new code", + class: "underline text-indigo-600", + to: "/activate/request-code", + method: :post + ) %> to <%= @conn.assigns[:current_user].email %> +
  6. <%= if full_build?() do %> -
  7. Contact us if the problem persists
  8. +
  9. + + Contact us + + if the problem persists +
  10. <% else %> -
  11. Ask on our <%= link("community-supported forum", to: "https://github.com/plausible/analytics/discussions", class: "text-indigo-600 underline" ) %>
  12. +
  13. + Ask on our <%= link("community-supported forum", + to: "https://github.com/plausible/analytics/discussions", + class: "text-indigo-600 underline" + ) %> +
  14. <% end %>
@@ -38,13 +64,22 @@
<% end %> @@ -58,8 +93,11 @@ <%= error_tag(assigns, :error) %> - <%= button("Request activation code", to: "/activate/request-code", method: :post, class: "button mt-12") %> - + <%= button("Request activation code", + to: "/activate/request-code", + method: :post, + class: "button mt-12" + ) %> <% end %> diff --git a/lib/plausible_web/templates/email/google_analytics_import.html.heex b/lib/plausible_web/templates/email/google_analytics_import.html.heex index 5c3246809..d7d1ce539 100644 --- a/lib/plausible_web/templates/email/google_analytics_import.html.heex +++ b/lib/plausible_web/templates/email/google_analytics_import.html.heex @@ -1,19 +1,16 @@ <%= if @success do %> - Your Google Analytics import has completed successfully. The Plausible dashboard for <%= @site.domain %> now contains historical imported data from <%= date_format(@site.imported_data.start_date) %> to <%= date_format(@site.imported_data.end_date) %> -

-<%= link("Click here", to: @link) %> to view your dashboard. + Your Google Analytics import has completed successfully. The Plausible dashboard for <%= @site.domain %> now contains historical imported data from <%= date_format( + @site.imported_data.start_date + ) %> to <%= date_format(@site.imported_data.end_date) %> +

+ <%= link("Click here", to: @link) %> to view your dashboard. <% else %> Unfortunately, your Google Analytics import for <%= @site.domain %> did not complete successfully. Sorry about that!

- This may be due to the user metric setting in your Google Analytics account. We found that changing the user metric setting is necessary to get the correct data out of the Google API.

- Please log into your Google Analytics account and go to Admin -> Property Settings -> User Analysis. Then make sure that "Enable User Metric in Reporting" is set to OFF. Then try importing again. You can switch the setting back after the import. -

- - If you've already changed that setting, then it is something else: -
+

If you've already changed that setting, then it is something else:

- If all of the above is fine, please try to do the import once again. Sometimes the Google Analytics API just randomly returns empty data. It's intermittent and random. Trying to do the import again may return what you need. - <%= if full_build?() do %>

Please reply to this email to let us know if you're still experiencing issues with the import. diff --git a/lib/plausible_web/templates/error/server_error.html.eex b/lib/plausible_web/templates/error/server_error.html.heex similarity index 94% rename from lib/plausible_web/templates/error/server_error.html.eex rename to lib/plausible_web/templates/error/server_error.html.heex index d6d26a198..0544c875a 100644 --- a/lib/plausible_web/templates/error/server_error.html.eex +++ b/lib/plausible_web/templates/error/server_error.html.heex @@ -12,14 +12,14 @@

There has been a server error. - <%= if !assigns[:selfhosted?] do %> + <%= if full_build?() do %> But don't worry, we're on it! <% end %>

- <%= if assigns[:trace_id] && !assigns[:selfhosted?] do %> + <%= if assigns[:trace_id] && full_build?() do %> If you would like to help, tell us what you were trying to do. Our development team will receive your report. <% else %> We have been notified. @@ -30,7 +30,7 @@

- <%= if !assigns[:selfhosted?] do %> + <%= if full_build?() do %> <%= if assigns[:trace_id] do %>
<%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %> diff --git a/lib/plausible_web/views/error_view.ex b/lib/plausible_web/views/error_view.ex index 1e133e6f5..3f770e73e 100644 --- a/lib/plausible_web/views/error_view.ex +++ b/lib/plausible_web/views/error_view.ex @@ -1,9 +1,10 @@ defmodule PlausibleWeb.ErrorView do + use Plausible use PlausibleWeb, :view def render("500.json", %{conn: %{private: %{PlausibleWeb.Plugins.API.Router => _}}}) do contact_support_note = - if not Plausible.Release.selfhost?() do + on_full_build do "If the problem persists please contact support@plausible.io" end @@ -32,23 +33,21 @@ defmodule PlausibleWeb.ErrorView do def render(<<"5", _error_5xx::binary-size(2), ".html">>, assigns) do current_user = assigns[:current_user] - selfhosted? = Plausible.Release.selfhost?() last_event = Sentry.get_last_event_id_and_source() - case {selfhosted?, current_user, last_event} do - {false, current_user, {event_id, :plug}} + case {current_user, last_event} do + {current_user, {event_id, :plug}} when is_binary(event_id) and not is_nil(current_user) -> opts = %{ trace_id: event_id, user_name: current_user.name, - user_email: current_user.email, - selfhosted?: selfhosted? + user_email: current_user.email } render("server_error.html", Map.merge(opts, assigns)) _ -> - render("server_error.html", Map.put(assigns, :selfhosted?, selfhosted?)) + render("server_error.html", assigns) end end diff --git a/test/plausible/plugins/api/token_test.exs b/test/plausible/plugins/api/token_test.exs index 57c848f5d..47ce9fdab 100644 --- a/test/plausible/plugins/api/token_test.exs +++ b/test/plausible/plugins/api/token_test.exs @@ -3,6 +3,7 @@ defmodule Plausible.Plugins.API.TokenTest do alias Plausible.Plugins.API.Token + @tag :full_build_only test "basic token properties" do t1 = Token.generate() t2 = Token.generate() @@ -24,20 +25,23 @@ defmodule Plausible.Plugins.API.TokenTest do end describe "prefix/0" do - test "default prefix" do + @tag :full_build_only + test "default prefix - full build" do assert Token.prefix() == "plausible-plugin-test" end + @tag :small_build_only test "selfhosted prefix" do - patch_env(:is_selfhost, true) assert Token.prefix() == "plausible-plugin-selfhost" end + @tag :full_build_only test "prod prefix" do patch_env(:environment, "prod") assert Token.prefix() == "plausible-plugin" end + @tag :full_build_only test "staging prefix" do patch_env(:environment, "staging") assert Token.prefix() == "plausible-plugin-staging" diff --git a/test/plausible/plugins/api/tokens_test.exs b/test/plausible/plugins/api/tokens_test.exs index 43538f7f6..223e92ddb 100644 --- a/test/plausible/plugins/api/tokens_test.exs +++ b/test/plausible/plugins/api/tokens_test.exs @@ -9,7 +9,6 @@ defmodule Plausible.Plugins.API.TokensTest do test "generates and stores the token" do site = insert(:site) assert {:ok, %Token{} = token, raw} = Tokens.create(site, "My test token") - assert <<"plausible-plugin-test-", _::binary-size(40)>> = raw from_db = Repo.get(Token, token.id) diff --git a/test/plausible/release_test.exs b/test/plausible/release_test.exs index 8c8792964..07ba568fd 100644 --- a/test/plausible/release_test.exs +++ b/test/plausible/release_test.exs @@ -1,30 +1,30 @@ defmodule Plausible.ReleaseTest do - use Plausible.DataCase + use Plausible.DataCase, async: true alias Plausible.{Release, Auth} import ExUnit.CaptureIO describe "should_be_first_launch?/0" do + @tag :small_build_only test "returns true when self-hosted and no users" do - patch_env(:is_selfhost, true) refute Repo.exists?(Auth.User) assert Release.should_be_first_launch?() end + @tag :full_build_only test "returns false when not self-hosted and has no users" do - patch_env(:is_selfhost, false) refute Repo.exists?(Auth.User) refute Release.should_be_first_launch?() end + @tag :full_build_only test "returns false when not self-hosted and has users" do insert(:user) - patch_env(:is_selfhost, false) refute Release.should_be_first_launch?() end + @tag :small_build_only test "returns false when self-hosted and has users" do insert(:user) - patch_env(:is_selfhost, true) refute Release.should_be_first_launch?() end end diff --git a/test/plausible/site/memberships/accept_invitation_test.exs b/test/plausible/site/memberships/accept_invitation_test.exs index 79128a038..3098dc257 100644 --- a/test/plausible/site/memberships/accept_invitation_test.exs +++ b/test/plausible/site/memberships/accept_invitation_test.exs @@ -367,6 +367,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do refute Repo.reload(invitation) end + @tag :full_build_only test "locks the site if the new owner has no active subscription or trial" do existing_owner = insert(:user) @@ -447,6 +448,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do assert Repo.reload!(site).locked end + @tag :full_build_only test "sets user's trial expiry date to yesterday if they don't have one" do existing_owner = insert(:user) @@ -473,6 +475,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do assert Repo.reload!(site).locked end + @tag :full_build_only test "ends grace period and sends an email about it if new owner is past grace period" do existing_owner = insert(:user) diff --git a/test/plausible_web/controllers/admin_auth_controller_test.exs b/test/plausible_web/controllers/admin_auth_controller_test.exs index e07fb17e5..cf8414eee 100644 --- a/test/plausible_web/controllers/admin_auth_controller_test.exs +++ b/test/plausible_web/controllers/admin_auth_controller_test.exs @@ -2,9 +2,8 @@ defmodule PlausibleWeb.AdminAuthControllerTest do use PlausibleWeb.ConnCase alias Plausible.Release - setup_patch_env(:is_selfhost, true) - describe "GET /" do + @describetag :small_build_only test "disable registration", %{conn: conn} do prevent_first_launch() patch_config(disable_registration: true) diff --git a/test/plausible_web/controllers/auth_controller/logs_test.exs b/test/plausible_web/controllers/auth_controller/logs_test.exs index e2b1bc293..3e406a6b6 100644 --- a/test/plausible_web/controllers/auth_controller/logs_test.exs +++ b/test/plausible_web/controllers/auth_controller/logs_test.exs @@ -2,6 +2,14 @@ defmodule PlausibleWeb.AuthController.LogsTest do use PlausibleWeb.ConnCase import ExUnit.CaptureLog + if small_build?() do + setup do + # insert some user to prevent first launch redirect + insert(:user) + :ok + end + end + describe "POST /login" do setup do patch_env(:log_failed_login_attempts, true) diff --git a/test/plausible_web/controllers/auth_controller_test.exs b/test/plausible_web/controllers/auth_controller_test.exs index 0f88dafa8..7ec6fb1fb 100644 --- a/test/plausible_web/controllers/auth_controller_test.exs +++ b/test/plausible_web/controllers/auth_controller_test.exs @@ -15,6 +15,14 @@ defmodule PlausibleWeb.AuthControllerTest do setup :verify_on_exit! + if small_build?() do + setup do + # insert some user to prevent first launch redirect + insert(:user) + :ok + end + end + @v3_plan_id "749355" @v4_plan_id "857097" @configured_enterprise_plan_paddle_plan_id "123" diff --git a/test/plausible_web/controllers/avatar_controller_test.exs b/test/plausible_web/controllers/avatar_controller_test.exs index 9ac531eb9..6c1960f76 100644 --- a/test/plausible_web/controllers/avatar_controller_test.exs +++ b/test/plausible_web/controllers/avatar_controller_test.exs @@ -4,6 +4,14 @@ defmodule PlausibleWeb.AvatarControllerTest do import Mox setup :verify_on_exit! + if small_build?() do + setup do + # insert some user to prevent first launch redirect + insert(:user) + :ok + end + end + describe "GET /avatar/:hash" do test "proxies the request to gravatar", %{conn: conn} do expect( diff --git a/test/plausible_web/controllers/error_report_controller_test.exs b/test/plausible_web/controllers/error_report_controller_test.exs index 3af101c7d..52eed6613 100644 --- a/test/plausible_web/controllers/error_report_controller_test.exs +++ b/test/plausible_web/controllers/error_report_controller_test.exs @@ -1,5 +1,7 @@ defmodule PlausibleWeb.ErrorReportControllerTest do use PlausibleWeb.ConnCase, async: true + @moduletag :full_build_only + use Bamboo.Test import Phoenix.View diff --git a/test/plausible_web/controllers/page_controller_test.exs b/test/plausible_web/controllers/page_controller_test.exs index f9246391d..738aaf769 100644 --- a/test/plausible_web/controllers/page_controller_test.exs +++ b/test/plausible_web/controllers/page_controller_test.exs @@ -1,6 +1,14 @@ defmodule PlausibleWeb.PageControllerTest do use PlausibleWeb.ConnCase, async: true + if small_build?() do + setup do + # insert some user to prevent first launch redirect + insert(:user) + :ok + end + end + describe "GET /" do test "shows landing page when user not authenticated", %{conn: conn} do assert conn |> get("/") |> html_response(200) =~ "Welcome to Plausible Analytics!" diff --git a/test/plausible_web/controllers/stats_controller_test.exs b/test/plausible_web/controllers/stats_controller_test.exs index 50f818b0f..427fbe4cb 100644 --- a/test/plausible_web/controllers/stats_controller_test.exs +++ b/test/plausible_web/controllers/stats_controller_test.exs @@ -44,6 +44,7 @@ defmodule PlausibleWeb.StatsControllerTest do end test "can not view stats of a private website", %{conn: conn} do + _ = insert(:user) conn = get(conn, "/test-site.com") assert html_response(conn, 404) =~ "There's nothing here" end diff --git a/test/plausible_web/controllers/unsubscribe_controller_test.exs b/test/plausible_web/controllers/unsubscribe_controller_test.exs index d95527064..2186cfaa9 100644 --- a/test/plausible_web/controllers/unsubscribe_controller_test.exs +++ b/test/plausible_web/controllers/unsubscribe_controller_test.exs @@ -2,6 +2,14 @@ defmodule PlausibleWeb.UnsubscribeControllerTest do use PlausibleWeb.ConnCase, async: true use Plausible.Repo + if small_build?() do + setup do + # insert some user to prevent first launch redirect + insert(:user) + :ok + end + end + describe "GET /sites/:website/weekly-report/unsubscribe" do test "removes a recipient from the weekly report without them having to log in", %{conn: conn} do site = insert(:site) diff --git a/test/plausible_web/plugs/first_launch_plug_test.exs b/test/plausible_web/plugs/first_launch_plug_test.exs index 7048a8fe9..6f33f99b1 100644 --- a/test/plausible_web/plugs/first_launch_plug_test.exs +++ b/test/plausible_web/plugs/first_launch_plug_test.exs @@ -1,5 +1,6 @@ defmodule PlausibleWeb.FirstLaunchPlugTest do use PlausibleWeb.ConnCase + @moduletag :small_build_only import Plug.Test alias PlausibleWeb.FirstLaunchPlug @@ -25,7 +26,6 @@ defmodule PlausibleWeb.FirstLaunchPlugTest do refute conn.halted # even when it's the first launch - patch_env(:is_selfhost, true) assert Release.should_be_first_launch?() conn = conn("GET", "/register") @@ -34,6 +34,7 @@ defmodule PlausibleWeb.FirstLaunchPlugTest do end test "no-op when not first launch" do + insert(:user) refute Release.should_be_first_launch?() conn = conn("GET", "/sites") conn = FirstLaunchPlug.call(conn, @opts) @@ -41,7 +42,6 @@ defmodule PlausibleWeb.FirstLaunchPlugTest do end test "redirects to :redirect_to when first launch" do - patch_env(:is_selfhost, true) assert Release.should_be_first_launch?() conn = conn("GET", "/sites") @@ -53,21 +53,10 @@ defmodule PlausibleWeb.FirstLaunchPlugTest do describe "first launch plug in :browser pipeline" do test "redirects to /register on first launch", %{conn: conn} do - patch_env(:is_selfhost, true) assert Release.should_be_first_launch?() conn = get(conn, "/") assert redirected_to(conn) == "/register" end - - test "no-op when not first launch", %{conn: conn} do - patch_env(:is_selfhost, false) - refute Release.should_be_first_launch?() - - # gets redirected to login by auth plugs - # "first launch" doesn't interfere - conn = get(conn, "/sites") - assert redirected_to(conn) == "/login" - end end end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 60c0d8200..a09926d59 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -19,6 +19,7 @@ defmodule PlausibleWeb.ConnCase do quote do # Import conveniences for testing with connections use Plausible.TestUtils + use Plausible import Plug.Conn import Phoenix.ConnTest alias PlausibleWeb.Router.Helpers, as: Routes diff --git a/test/test_helper.exs b/test/test_helper.exs index 68ecf5e1c..ed8c80428 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -6,7 +6,9 @@ FunWithFlags.enable(:window_time_on_page) Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual) if Mix.env() == :small_test do + IO.puts("Test mode: SMALL") ExUnit.configure(exclude: [:slow, :full_build_only]) else + IO.puts("Test mode: FULL") ExUnit.configure(exclude: [:slow, :small_build_only]) end