berrypod/test/berrypod_web/live/shop/home_test.exs
jamey 8ea77e5992
All checks were successful
deploy / deploy (push) Successful in 1m22s
fix content image double-suffix, clean up page defaults and editor UX
- Fix resolve_content_image returning base path (not full URL) so
  responsive_image doesn't double-append width/extension
- Remove legacy image fields (image_src, image_alt, image_url) from
  block settings schemas
- Remove demo/mockup fallbacks from renderer and defaults — blank
  fields stay blank instead of showing preview content
- Replace demo text in defaults with instructional placeholders that
  guide new shop owners
- Remove redundant X button from editor sidebar, add unsaved-changes
  confirmation to Done button
- Fix block card name overflow on mobile (display: block, flex-wrap)
- Add onboarding UX improvement plan (10 tasks)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 00:56:01 +00:00

102 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)
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