mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Add some tests for unsuccessful registration
This commit is contained in:
parent
155284139e
commit
e9cf51e57f
@ -1,7 +1,7 @@
|
||||
defmodule Chess.RegistrationTest do
|
||||
use ChessWeb.FeatureCase
|
||||
|
||||
import Wallaby.Query, only: [text_field: 1, link: 1, button: 1]
|
||||
import Wallaby.Query
|
||||
|
||||
test "user can register", %{session: session} do
|
||||
session
|
||||
@ -14,4 +14,46 @@ defmodule Chess.RegistrationTest do
|
||||
|
||||
assert session |> has_text?("Registered successfully")
|
||||
end
|
||||
|
||||
test "user cannot register without a name", %{session: session} do
|
||||
session
|
||||
|> visit("/")
|
||||
|> click(link("Register"))
|
||||
|> fill_in(text_field("Email"), with: "link@example.com")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Register"))
|
||||
|
||||
session
|
||||
|> assert_has(
|
||||
css("[data-role='name-error']", text: "can't be blank")
|
||||
)
|
||||
end
|
||||
|
||||
test "user cannot register without an email", %{session: session} do
|
||||
session
|
||||
|> visit("/")
|
||||
|> click(link("Register"))
|
||||
|> fill_in(text_field("Name"), with: "Link")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Register"))
|
||||
|
||||
session
|
||||
|> assert_has(
|
||||
css("[data-role='email-error']", text: "can't be blank")
|
||||
)
|
||||
end
|
||||
|
||||
test "user cannot register without a password", %{session: session} do
|
||||
session
|
||||
|> visit("/")
|
||||
|> click(link("Register"))
|
||||
|> fill_in(text_field("Name"), with: "Link")
|
||||
|> fill_in(text_field("Email"), with: "link@example.com")
|
||||
|> click(button("Register"))
|
||||
|
||||
session
|
||||
|> assert_has(
|
||||
css("[data-role='password-error']", text: "can't be blank")
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user