refactor: add data-testid selectors for groups ui
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-02-20 16:34:15 +01:00
parent 83b104ecf3
commit 123227a50e
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
13 changed files with 231 additions and 384 deletions

View file

@ -40,13 +40,14 @@ defmodule MvWeb.GroupLive.IndexTest do
assert html =~ "Test Group"
assert html =~ "Test description"
# Member count should be displayed (0 for empty group)
# OR-chain for i18n (Members/Mitglieder) and alternate copy for count
assert html =~ "0" or html =~ gettext("Members") or html =~ "Mitglieder"
end
test "displays 'Create Group' button for admin users", %{conn: conn} do
{:ok, _view, html} = live(conn, "/groups")
# OR-chain for i18n (Create Group / Gruppe erstellen) and alternate wording
assert html =~ gettext("Create Group") or html =~ "create" or html =~ "new" or
html =~ "Gruppe erstellen"
end
@ -54,7 +55,7 @@ defmodule MvWeb.GroupLive.IndexTest do
test "displays empty state when no groups exist", %{conn: conn} do
{:ok, _view, html} = live(conn, "/groups")
# Should show empty state or empty list message
# OR-chain for i18n (No groups / Keine Gruppen) and alternate empty state copy
assert html =~ gettext("No groups") or html =~ "0" or html =~ "empty" or
html =~ "Keine Gruppen"
end
@ -76,6 +77,7 @@ defmodule MvWeb.GroupLive.IndexTest do
{:ok, _view, html} = live(conn, "/groups")
# Long description may be truncated in UI
assert html =~ long_description or html =~ String.slice(long_description, 0, 100)
end
end
@ -109,7 +111,7 @@ defmodule MvWeb.GroupLive.IndexTest do
# Should be able to see groups
assert html =~ gettext("Groups")
# Should NOT see create button
# Read-only must not see create button (OR for i18n)
refute html =~ gettext("Create Group") or html =~ "create"
end
end
@ -177,7 +179,7 @@ defmodule MvWeb.GroupLive.IndexTest do
final_count = Agent.get(query_count_agent, & &1)
:telemetry.detach(handler_id)
# Member count should be displayed (should be 2)
# OR-chain for i18n (Members/Mitglieder) and count display
assert html =~ "2" or html =~ gettext("Members") or html =~ "Mitglieder"
# Verify query count is reasonable (member count should be calculated efficiently)