1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/test/features/registration_test.exs
Dan Barber bedd6605ef
Redesign whole site in B&W
* Forms and board tweaks for small screen sizes
* Re-style game status indicators
* Re-style viewing/offline indicator
* Better eyecons 👁
* Re-organise CSS according to ITCSS principles
* Pick new font from Google Fonts
* Fix up tests
* Move some things into partials
2018-09-16 14:02:52 -04:00

60 lines
1.7 KiB
Elixir

defmodule Chess.Features.RegistrationTest do
use ChessWeb.FeatureCase
import Wallaby.Query
test "user can register", %{session: session} do
session
|> visit("/")
|> click(css(".header__user-nav a", text: "Register"))
|> fill_in(text_field("Name"), with: "Link")
|> fill_in(text_field("Email"), with: "link@example.com")
|> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Register"))
assert session |> has_text?("Registered successfully")
end
test "user cannot register without a name", %{session: session} do
session
|> visit("/")
|> click(css(".header__user-nav a", text: "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(css(".header__user-nav a", text: "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(css(".header__user-nav a", text: "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