Programming Phoenix LiveView B3.0 P276: Assertion in age group filter not working for me

Hi, I am not really sure, if it just an error injected by me somewhere, thus I marked this as question, not as erratum :slight_smile:

The assertion in the testing pipeline on page 276:

test "it filters by age group", %{conn: conn} do
  {:ok, view, _html} = live(conn, "/admin-dashboard")
  view
  |> element("#age-group-form")
  |> render_change(%{"age_group_filter" => "18 and under"})
  |> assert =~ "<title>2.00</title>"
end

seems to never fail for me, even if I put “abcdef” as pattern.

I can get assertion errors , when doing the test this way:

    test "it filters by age group", %{conn: conn} do
      {:ok, view, _html} = live(conn, "/admin-dashboard")
      html =
        view
        |> element("#age-group-form")
        |> render_change(%{"age_group_filter" => "18 and under"})

      assert html =~ "<title>abcdef</title>"
    end

Using a html |> assert =~ "<title>abcdef</title>" also does not fail. Strange, as a simple "Test" |> assert =~ "abc" yields the assertion error, that I would expect.

Edit:
"Test" |> assert =~ "abc" just fails in IEX, when importing ExUnit.Assertions, not when putting this into the live view test. There it gives a success.