All modules, configs, paths, and references updated. 836 tests pass, zero warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
102 lines
2.6 KiB
Elixir
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 =~ "Original designs, printed on demand"
|
|
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 =~ "Made with passion, printed with care"
|
|
assert html =~ "Learn more about the studio"
|
|
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
|