All checks were successful
deploy / deploy (push) Successful in 3m27s
- Add header and footer nav editors to Site tab with drag-to-reorder, add/remove items, and destination picker (pages, collections, external) - Live preview updates as you edit nav items - Remove legacy /admin/navigation page and controller (was saving to Settings table, now uses nav_items table) - Update error_html.ex and pages/editor.ex to load nav from nav_items table - Update link_scanner to read from nav_items table, edit path now /?edit=site - Add Site.default_header_nav/0 and default_footer_nav/0 for previews/errors - Remove fallback logic from theme_hook.ex (database is now source of truth) - Seed default nav items and social links during setup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
103 lines
2.6 KiB
Elixir
103 lines
2.6 KiB
Elixir
defmodule BerrypodWeb.Shop.HomeTest do
|
|
use BerrypodWeb.ConnCase, async: false
|
|
|
|
import Phoenix.LiveViewTest
|
|
import Berrypod.AccountsFixtures
|
|
import Berrypod.ProductsFixtures
|
|
|
|
setup do
|
|
user_fixture()
|
|
{:ok, _} = Berrypod.Settings.set_site_live(true)
|
|
Berrypod.Site.seed_defaults()
|
|
|
|
conn = provider_connection_fixture()
|
|
|
|
product =
|
|
product_fixture(%{
|
|
provider_connection: conn,
|
|
title: "Mountain Sunrise Print",
|
|
category: "Art Prints"
|
|
})
|
|
|
|
product_variant_fixture(%{product: product, title: "8x10", price: 1999})
|
|
|
|
# Recompute so cheapest_price is set
|
|
Berrypod.Products.recompute_cached_fields(product)
|
|
|
|
%{product: product}
|
|
end
|
|
|
|
describe "Home page" do
|
|
test "renders the home page", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Your headline goes here"
|
|
end
|
|
|
|
test "renders hero section with CTA", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Shop the collection"
|
|
end
|
|
|
|
test "renders category navigation with real categories", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Art Prints"
|
|
end
|
|
|
|
test "renders featured products section", %{conn: conn, product: product} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Featured products"
|
|
assert html =~ product.title
|
|
end
|
|
|
|
test "renders image and text section", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Your story in a nutshell"
|
|
assert html =~ "Read more about us"
|
|
end
|
|
|
|
test "renders header with shop name", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ "Store Name"
|
|
end
|
|
|
|
test "renders footer with links", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ ~s(href="/about")
|
|
assert html =~ ~s(href="/contact")
|
|
end
|
|
end
|
|
|
|
describe "Navigation links" do
|
|
test "category links point to collections", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ ~s(href="/collections/)
|
|
end
|
|
|
|
test "product links point to product pages", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ ~s(href="/products/)
|
|
end
|
|
|
|
test "hero CTA links to collections", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ ~s(href="/collections/all")
|
|
end
|
|
|
|
test "about link in image section", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/")
|
|
|
|
assert html =~ ~s(href="/about")
|
|
end
|
|
end
|
|
end
|