improve setup UX: password field, setup hook, checklist banners, theme tweaks
All checks were successful
deploy / deploy (push) Successful in 1m31s
All checks were successful
deploy / deploy (push) Successful in 1m31s
- add password field and required shop name to setup wizard - extract SetupHook for DRY redirect to /setup when no admin exists - add ?from=checklist param to checklist hrefs with contextual banner on email settings and theme pages for easy return to dashboard - remove email warning banner from admin layout (checklist covers it) - make email a required checklist item (no longer optional) - add DevReset module for wiping dev data without restart - rename "Theme Studio" to "Theme", drop subtitle - lower theme editor side-by-side breakpoint from 64em to 48em - clean up login/registration pages (remove dead registration_open code) - fix settings.put_secret to invalidate cache after write Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -99,11 +99,10 @@ defmodule BerrypodWeb.Admin.DashboardTest do
|
||||
assert html =~ "4242 4242 4242 4242"
|
||||
end
|
||||
|
||||
test "shows email setup as optional", %{conn: conn} do
|
||||
test "shows email setup item", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, ~p"/admin")
|
||||
|
||||
assert html =~ "Set up email"
|
||||
assert html =~ "optional"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ defmodule BerrypodWeb.Admin.ThemeTest do
|
||||
test "renders theme editor page", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, ~p"/admin/theme")
|
||||
|
||||
assert html =~ "Theme Studio"
|
||||
assert html =~ "<h1 class=\"theme-title\">Theme</h1>"
|
||||
assert html =~ "preset"
|
||||
end
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
|
||||
describe "login page" do
|
||||
setup do
|
||||
user_fixture()
|
||||
Mailer.mark_email_verified()
|
||||
:ok
|
||||
end
|
||||
@@ -16,7 +17,6 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
{:ok, _lv, html} = live(conn, ~p"/users/log-in")
|
||||
|
||||
assert html =~ "Log in"
|
||||
assert html =~ "Set up your shop"
|
||||
assert html =~ "Log in with email"
|
||||
end
|
||||
end
|
||||
@@ -44,6 +44,8 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
end
|
||||
|
||||
test "does not disclose if user is registered", %{conn: conn} do
|
||||
user_fixture()
|
||||
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/log-in")
|
||||
|
||||
{:ok, _lv, html} =
|
||||
@@ -74,6 +76,8 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
test "redirects to login page with a flash error if credentials are invalid", %{
|
||||
conn: conn
|
||||
} do
|
||||
user_fixture()
|
||||
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/log-in")
|
||||
|
||||
form =
|
||||
@@ -107,6 +111,9 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
|
||||
describe "email configured and verified" do
|
||||
setup do
|
||||
# Create user before switching adapter (fixture sends a confirmation email)
|
||||
_user = user_fixture()
|
||||
|
||||
original = Application.get_env(:berrypod, Berrypod.Mailer)
|
||||
|
||||
Application.put_env(:berrypod, Berrypod.Mailer,
|
||||
@@ -154,17 +161,9 @@ defmodule BerrypodWeb.Auth.LoginTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe "login navigation" do
|
||||
test "redirects to setup page when the setup link is clicked", %{conn: conn} do
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/log-in")
|
||||
|
||||
{:ok, _setup_live, setup_html} =
|
||||
lv
|
||||
|> element("main a", "Set up your shop")
|
||||
|> render_click()
|
||||
|> follow_redirect(conn, ~p"/setup")
|
||||
|
||||
assert setup_html =~ "Set up your shop"
|
||||
describe "no admin exists" do
|
||||
test "redirects to setup", %{conn: conn} do
|
||||
assert {:error, {:redirect, %{to: "/setup"}}} = live(conn, ~p"/users/log-in")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -69,7 +69,13 @@ defmodule BerrypodWeb.Setup.OnboardingTest do
|
||||
{:ok, view, _html} = live(conn, ~p"/setup")
|
||||
|
||||
view
|
||||
|> form(~s(form[phx-submit="create_account"]), account: %{email: "admin@example.com"})
|
||||
|> form(~s(form[phx-submit="create_account"]),
|
||||
account: %{
|
||||
shop_name: "Test Shop",
|
||||
email: "admin@example.com",
|
||||
password: "valid_password_123"
|
||||
}
|
||||
)
|
||||
|> render_submit()
|
||||
|
||||
# The LiveView redirects to /setup/login/:token
|
||||
|
||||
@@ -17,6 +17,7 @@ defmodule BerrypodWeb.Shop.ComingSoonTest do
|
||||
end
|
||||
|
||||
test "displays the shop name", %{conn: conn} do
|
||||
user_fixture()
|
||||
Settings.put_setting("site_name", "My Test Shop", "string")
|
||||
|
||||
{:ok, _view, html} = live(conn, ~p"/coming-soon")
|
||||
|
||||
Reference in New Issue
Block a user