2026-02-18 21:23:15 +00:00
|
|
|
defmodule BerrypodWeb.Auth.RegistrationTest do
|
|
|
|
|
use BerrypodWeb.ConnCase
|
2025-12-30 12:26:46 +00:00
|
|
|
|
|
|
|
|
import Phoenix.LiveViewTest
|
2026-02-18 21:23:15 +00:00
|
|
|
import Berrypod.AccountsFixtures
|
2025-12-30 12:26:46 +00:00
|
|
|
|
|
|
|
|
describe "Registration page" do
|
add setup onboarding page, dashboard launch checklist, provider registry
- new /setup page with three-section onboarding (account, provider, payments)
- dashboard launch checklist with progress bar, go-live, dismiss
- provider registry on Provider module (single source of truth for metadata)
- payments registry for Stripe
- setup context made provider-agnostic (provider_connected, theme_customised, etc.)
- admin provider pages now fully registry-driven (no hardcoded provider names)
- auth flow: fresh installs redirect to /setup, signed_in_path respects setup state
- removed old /admin/setup wizard
- 840 tests, 0 failures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:34:06 +00:00
|
|
|
test "redirects to setup when no admin exists (fresh install)", %{conn: conn} do
|
|
|
|
|
assert {:error, {:redirect, %{to: "/setup"}}} = live(conn, ~p"/users/register")
|
2025-12-30 12:26:46 +00:00
|
|
|
end
|
|
|
|
|
|
2026-02-11 22:58:58 +00:00
|
|
|
test "redirects to login when admin already exists", %{conn: conn} do
|
|
|
|
|
user_fixture()
|
|
|
|
|
|
|
|
|
|
assert {:error,
|
|
|
|
|
{:redirect, %{to: "/users/log-in", flash: %{"error" => "Registration is closed"}}}} =
|
|
|
|
|
live(conn, ~p"/users/register")
|
|
|
|
|
end
|
|
|
|
|
|
2025-12-30 12:26:46 +00:00
|
|
|
test "redirects if already logged in", %{conn: conn} do
|
|
|
|
|
result =
|
|
|
|
|
conn
|
|
|
|
|
|> log_in_user(user_fixture())
|
|
|
|
|
|> live(~p"/users/register")
|
add setup onboarding page, dashboard launch checklist, provider registry
- new /setup page with three-section onboarding (account, provider, payments)
- dashboard launch checklist with progress bar, go-live, dismiss
- provider registry on Provider module (single source of truth for metadata)
- payments registry for Stripe
- setup context made provider-agnostic (provider_connected, theme_customised, etc.)
- admin provider pages now fully registry-driven (no hardcoded provider names)
- auth flow: fresh installs redirect to /setup, signed_in_path respects setup state
- removed old /admin/setup wizard
- 840 tests, 0 failures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:34:06 +00:00
|
|
|
|> follow_redirect(conn, ~p"/setup")
|
2025-12-30 12:26:46 +00:00
|
|
|
|
|
|
|
|
assert {:ok, _conn} = result
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|