LiveViewTest not adding creating elements and returning empty HTML

Hello all! New to the elixir forum and needing some help or guidance with LiveView tests. I am running into this error ** (ArgumentError) selector "#identification-7 a" did not return any element within: when attempting this test:

    test "updates identification in listing", %{conn: conn, identification: identification} do
      {:ok, index_live, _html} = live(conn, Routes.identification_index_path(conn, :index))

      assert index_live |> element("#identification-#{} a", "Edit") |> render_click() =~
               "Edit Identification"

      assert_patch(index_live, Routes.identification_index_path(conn, :edit, identification))

      assert index_live
             |> form("#identification-form", identification: @invalid_attrs)
             |> render_change() =~ "can't be blank"

      {:ok, _, html} =
        |> form("#identification-form", identification: @update_attrs)
        |> render_submit()
        |> follow_redirect(conn, Routes.identification_index_path(conn, :index))

      assert html =~ "Identification updated successfully"
      assert html =~ "some updated expiration_date"

The line assert index_live |> element("#identification-#{} a", "Edit") |> render_click() =~ "Edit Identification"
is where things are giving that error. The HTML output shows that there are no elements in the table so it looks as if the test isn’t properly adding elements.

the identication schema that it is using has an association to a users table but the @update_attrs and @invalid_attrs correctly match the definitions.

Am i missing something? Any help would be appreciated.

Update: I found out that I introduced a new object to the assigns and the live_modal opts. When the user goes to the /index route I take their user token and add it as a new key in the assigns so that I could add a link that takes the user to the /status live route. I wanted it to render all the status from that specific user but the test doesn’t see that new key I added to the assigns which is why it won’t populate the table elements.

Hopefully this is helpful context

What does the test setup look like?

  @create_attrs %{expiration_date: "01/01/2025", number: 42, state: "some state", user_id: 1, image_upload: ""}
  @update_attrs %{expiration_date: "01/01/2025", number: 43, state: "some updated state", user_id: 1, image_upload: ""}
  @invalid_attrs %{expiration_date: nil, number: nil, state: nil, user_id: 1, image_upload: ""}

  defp fixture(:identification) do
    {:ok, identification} = Account.create_identification(@create_attrs)

  defp create_identification(_) do
    identification = fixture(:identification)
    %{identification: identification}

  defp create_socket(_) do
    %{socket: %Phoenix.LiveView.Socket{}}

  defp list_identifications(id) do
    query =
      from i in Identification,
      where: i.user_id == ^id


  describe "Index" do
    setup :register_and_log_in_user
    setup [:create_identification, :create_socket]

the create_socket function probably isnt needed but for whatever reason i cant get this items to load in test