1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/test/features/password_test.exs
Dan Barber bc5c6c4f04
Add profile page to update name and email
* Also add ability to change password
2018-08-13 22:12:32 -04:00

49 lines
1.1 KiB
Elixir

defmodule Chess.Features.PasswordTest do
use ChessWeb.FeatureCase
import Wallaby.Query
import Chess.Factory
import Chess.AuthenticationHelpers
test "user can change their password", %{session: session} do
user = insert(:user, %{
name: "Link",
email: "link@hyrule.com",
password: "ilovezelda"
})
session
|> login(user.email, "ilovezelda")
session
|> click(link(user.name))
|> click(link("Change password"))
|> fill_in(text_field("Password"), with: "ganonsucks")
|> click(button("Update Password"))
assert session |> has_text?("Password updated successfully")
end
test "password cannot be blank", %{session: session} do
user = insert(:user, %{
name: "Link",
email: "link@hyrule.com",
password: "ilovezelda"
})
session
|> login(user.email, "ilovezelda")
session
|> click(link(user.name))
|> click(link("Change password"))
|> click(button("Update Password"))
session
|> assert_has(
css("[data-role='password-error']", text: "can't be blank")
)
end
end