refactor: add data-testid selectors for groups ui
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
83b104ecf3
commit
123227a50e
13 changed files with 231 additions and 384 deletions
|
|
@ -19,6 +19,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
test "form renders with empty fields", %{conn: conn} do
|
||||
{:ok, view, html} = live(conn, "/groups/new")
|
||||
|
||||
# OR-chain for i18n (Create Group / Gruppe erstellen)
|
||||
assert html =~ gettext("Create Group") or html =~ "create" or html =~ "Gruppe erstellen"
|
||||
assert has_element?(view, "form")
|
||||
end
|
||||
|
|
@ -65,6 +66,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> form("#group-form", group: form_data)
|
||||
|> render_submit()
|
||||
|
||||
# OR-chain for i18n (required/erforderlich) and validation message wording
|
||||
assert html =~ gettext("required") or html =~ "name" or html =~ "error" or
|
||||
html =~ "erforderlich"
|
||||
end
|
||||
|
|
@ -80,6 +82,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> form("#group-form", group: form_data)
|
||||
|> render_submit()
|
||||
|
||||
# OR-chain for i18n (length/Länge) and validation message
|
||||
assert html =~ "100" or html =~ "length" or html =~ "error" or html =~ "Länge"
|
||||
end
|
||||
|
||||
|
|
@ -98,6 +101,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> form("#group-form", group: form_data)
|
||||
|> render_submit()
|
||||
|
||||
# OR-chain for i18n (length/Länge) and validation message
|
||||
assert html =~ "500" or html =~ "length" or html =~ "error" or html =~ "Länge"
|
||||
end
|
||||
|
||||
|
|
@ -116,6 +120,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> render_submit()
|
||||
|
||||
# Check for a validation error on the name field in a robust way
|
||||
# OR-chain for i18n and validation message (already taken)
|
||||
assert html =~ "name" or html =~ gettext("has already been taken")
|
||||
end
|
||||
|
||||
|
|
@ -131,6 +136,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> form("#group-form", group: form_data)
|
||||
|> render_submit()
|
||||
|
||||
# OR-chain for i18n (error/Fehler, invalid/ungültig)
|
||||
assert html =~ "error" or html =~ "invalid" or html =~ "Fehler" or html =~ "ungültig"
|
||||
end
|
||||
end
|
||||
|
|
@ -196,6 +202,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|> form("#group-form", group: form_data)
|
||||
|> render_submit()
|
||||
|
||||
# OR-chain for i18n (already taken / bereits vergeben) and validation wording
|
||||
assert html =~ "already" or html =~ "taken" or html =~ "exists" or html =~ "error" or
|
||||
html =~ "bereits" or html =~ "vergeben"
|
||||
end
|
||||
|
|
@ -205,7 +212,7 @@ defmodule MvWeb.GroupLive.FormTest do
|
|||
|
||||
{:ok, _view, html} = live(conn, "/groups/#{group.slug}/edit")
|
||||
|
||||
# Slug should not be in form (it's immutable)
|
||||
# Slug should not be in form (it's immutable); regex for input element
|
||||
refute html =~ ~r/slug.*input/i or html =~ ~r/input.*slug/i
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue