2026-02-18 21:23:15 +00:00
|
|
|
defmodule BerrypodWeb.Shop.ContentTest do
|
|
|
|
|
use BerrypodWeb.ConnCase, async: false
|
2026-02-08 10:47:54 +00:00
|
|
|
|
|
|
|
|
import Phoenix.LiveViewTest
|
2026-02-18 21:23:15 +00:00
|
|
|
import Berrypod.AccountsFixtures
|
2026-02-12 14:40:58 +00:00
|
|
|
|
|
|
|
|
setup do
|
|
|
|
|
user_fixture()
|
2026-02-18 21:23:15 +00:00
|
|
|
{:ok, _} = Berrypod.Settings.set_site_live(true)
|
2026-02-12 14:40:58 +00:00
|
|
|
:ok
|
|
|
|
|
end
|
2026-02-08 10:47:54 +00:00
|
|
|
|
|
|
|
|
describe "About page" do
|
|
|
|
|
test "renders about page", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/about")
|
|
|
|
|
|
|
|
|
|
assert html =~ "About the studio"
|
|
|
|
|
assert html =~ "sample about page"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "displays about image", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/about")
|
|
|
|
|
|
|
|
|
|
assert html =~ "night-sky-blanket"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "Delivery page" do
|
|
|
|
|
test "renders delivery page", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/delivery")
|
|
|
|
|
|
|
|
|
|
assert html =~ "Delivery & returns"
|
|
|
|
|
assert html =~ "shipping and returns"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "displays delivery content", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/delivery")
|
|
|
|
|
|
2026-02-24 13:48:49 +00:00
|
|
|
assert html =~ "Production time"
|
2026-02-08 10:47:54 +00:00
|
|
|
assert html =~ "Returns & exchanges"
|
|
|
|
|
assert html =~ "Cancellations"
|
|
|
|
|
end
|
|
|
|
|
|
2026-02-24 13:48:49 +00:00
|
|
|
test "displays shipping fallback when no rates are configured", %{conn: conn} do
|
2026-02-08 10:47:54 +00:00
|
|
|
{:ok, _view, html} = live(conn, ~p"/delivery")
|
|
|
|
|
|
2026-02-24 13:48:49 +00:00
|
|
|
assert html =~ "worldwide"
|
2026-02-08 10:47:54 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "Privacy page" do
|
|
|
|
|
test "renders privacy page", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/privacy")
|
|
|
|
|
|
|
|
|
|
assert html =~ "Privacy policy"
|
|
|
|
|
assert html =~ "personal information"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "displays privacy content", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/privacy")
|
|
|
|
|
|
|
|
|
|
assert html =~ "What we collect"
|
|
|
|
|
assert html =~ "Cookies"
|
|
|
|
|
assert html =~ "Your rights"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "Terms page" do
|
|
|
|
|
test "renders terms page", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/terms")
|
|
|
|
|
|
|
|
|
|
assert html =~ "Terms of service"
|
|
|
|
|
assert html =~ "The legal bits"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "displays terms content", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/terms")
|
|
|
|
|
|
|
|
|
|
assert html =~ "Products"
|
2026-02-24 13:48:49 +00:00
|
|
|
assert html =~ "Payment"
|
2026-02-08 10:47:54 +00:00
|
|
|
assert html =~ "Intellectual property"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "Footer links" do
|
|
|
|
|
test "footer contains policy page links", %{conn: conn} do
|
|
|
|
|
{:ok, _view, html} = live(conn, ~p"/about")
|
|
|
|
|
|
|
|
|
|
assert html =~ ~s(href="/delivery")
|
|
|
|
|
assert html =~ ~s(href="/privacy")
|
|
|
|
|
assert html =~ ~s(href="/terms")
|
|
|
|
|
assert html =~ ~s(href="/contact")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|