Minor test refactoring to improve on performance closes #383 #384
2 changed files with 9 additions and 9 deletions
|
|
@ -124,7 +124,8 @@ defmodule MvWeb.UserLive.FormTest do
|
||||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||||
updated_user = Ash.reload!(user, domain: Mv.Accounts, actor: system_actor)
|
updated_user = Ash.reload!(user, domain: Mv.Accounts, actor: system_actor)
|
||||||
assert updated_user.hashed_password != original_password
|
assert updated_user.hashed_password != original_password
|
||||||
assert String.starts_with?(updated_user.hashed_password, "$2b$")
|
assert not is_nil(updated_user.hashed_password)
|
||||||
|
assert updated_user.hashed_password != ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,12 @@ defmodule MvWeb.UserLive.IndexTest do
|
||||||
|> has_element?()
|
|> has_element?()
|
||||||
|
|
||||||
# Select second user
|
# Select second user
|
||||||
html = view |> element("input[type='checkbox'][name='#{user2.id}']") |> render_click()
|
view |> element("input[type='checkbox'][name='#{user2.id}']") |> render_click()
|
||||||
|
|
||||||
# Now select all should be automatically checked (all individual users are selected)
|
# Now select all should be automatically checked (all individual users are selected)
|
||||||
# Note: This test might need adjustment based on actual implementation
|
assert view
|
||||||
# The logic depends on whether authenticated user is included in the count
|
|> element("input[type='checkbox'][name='select_all'][checked]")
|
||||||
assert html =~ "Email"
|
|> has_element?()
|
||||||
assert html =~ to_string(user1.email)
|
|
||||||
assert html =~ to_string(user2.email)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -118,11 +116,12 @@ defmodule MvWeb.UserLive.IndexTest do
|
||||||
# Confirm user is displayed
|
# Confirm user is displayed
|
||||||
assert render(view) =~ "delete-me@example.com"
|
assert render(view) =~ "delete-me@example.com"
|
||||||
|
|
||||||
# Click the first delete button to test the functionality
|
# Click the delete button (phx-click="delete" event)
|
||||||
view |> element("tbody tr:first-child a[data-confirm]") |> render_click()
|
view |> element("tbody tr:first-child a[data-confirm]") |> render_click()
|
||||||
|
|
||||||
# The page should still render (basic functionality test)
|
# Verify user was actually deleted (should not appear in HTML anymore)
|
||||||
html = render(view)
|
html = render(view)
|
||||||
|
refute html =~ "delete-me@example.com"
|
||||||
# Table header should still be there
|
# Table header should still be there
|
||||||
assert html =~ "Email"
|
assert html =~ "Email"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue