Make test actually work

This commit is contained in:
Claudio Ortolina
2025-10-25 13:18:05 +01:00
parent 49b5075222
commit 4dc80cf739
@@ -129,33 +129,22 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do
end end
describe "Pagination" do describe "Pagination" do
test "shows pagination when more than one page", %{conn: conn} do test "navigates to next page", %{conn: conn} do
# Create enough tracks to require pagination (more than 200)
create_test_tracks(201) create_test_tracks(201)
{:ok, index_live, html} = live(conn, ~p"/scrobbled-tracks") {:ok, index_live, html} = live(conn, ~p"/scrobbled-tracks")
# Should show pagination component
assert html =~ "Next" assert html =~ "Next"
assert has_element?(index_live, "#bottom_pagination") assert has_element?(index_live, "#bottom_pagination")
end
test "navigates to next page", %{conn: conn} do
create_test_tracks(201)
{:ok, index_live, _html} = live(conn, ~p"/scrobbled-tracks")
# Click next page button (if visible)
if has_element?(index_live, "button[patch*='page=2']") do
html = html =
index_live index_live
|> element("button[patch*='page=2']") |> element("a[href*='page=2']", "2")
|> render_click() |> render_click()
assert html =~ "Scrobbled Tracks" assert html =~ "Scrobbled Tracks"
end end
end end
end
describe "URL parameter handling" do describe "URL parameter handling" do
test "handles query parameter", %{conn: conn} do test "handles query parameter", %{conn: conn} do