From 4dc80cf7393a0ef4e1cb58ca2fa44b4e124d1384 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Sat, 25 Oct 2025 13:18:05 +0100 Subject: [PATCH] Make test actually work --- .../live/scrobbled_tracks_live/index_test.exs | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/test/music_library_web/live/scrobbled_tracks_live/index_test.exs b/test/music_library_web/live/scrobbled_tracks_live/index_test.exs index db5cf7a5..3099eec0 100644 --- a/test/music_library_web/live/scrobbled_tracks_live/index_test.exs +++ b/test/music_library_web/live/scrobbled_tracks_live/index_test.exs @@ -129,31 +129,20 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do end describe "Pagination" do - test "shows pagination when more than one page", %{conn: conn} do - # Create enough tracks to require pagination (more than 200) + test "navigates to next page", %{conn: conn} do create_test_tracks(201) {:ok, index_live, html} = live(conn, ~p"/scrobbled-tracks") - # Should show pagination component assert html =~ "Next" assert has_element?(index_live, "#bottom_pagination") - end - test "navigates to next page", %{conn: conn} do - create_test_tracks(201) + html = + index_live + |> element("a[href*='page=2']", "2") + |> render_click() - {: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 = - index_live - |> element("button[patch*='page=2']") - |> render_click() - - assert html =~ "Scrobbled Tracks" - end + assert html =~ "Scrobbled Tracks" end end