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-#{identification.id} 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} =
index_live
|> 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"
end
The line assert index_live |> element("#identification-#{identification.id} 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.