1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

Add log in link and fix game tests

This commit is contained in:
Daniel Barber 2018-01-26 11:59:44 -05:00
parent 558b4a5ff9
commit 9fb960fa5e
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
3 changed files with 10 additions and 5 deletions

View File

@ -16,6 +16,8 @@
<header role="banner"> <header role="banner">
<nav role="user"> <nav role="user">
<%= link("Register", to: registration_path(@conn, :new)) %> <%= link("Register", to: registration_path(@conn, :new)) %>
|
<%= link("Log in", to: session_path(@conn, :new)) %>
</nav> </nav>
<h1>Chess</h1> <h1>Chess</h1>
</header> </header>

View File

@ -32,7 +32,7 @@ defmodule Chess.GamesTest do
defp create_game(session) do defp create_game(session) do
session session
|> visit("/") |> visit("/games")
|> click(button("Create game")) |> click(button("Create game"))
end end

View File

@ -3,13 +3,14 @@ defmodule Chess.SessionTest do
alias Chess.Auth.User alias Chess.Auth.User
import Wallaby.Query, only: [text_field: 1, button: 1] import Wallaby.Query, only: [text_field: 1, link: 1, button: 1]
test "user cannot sign in with incorrect username", %{session: session} do test "user cannot sign in with incorrect username", %{session: session} do
create_user() create_user()
session session
|> visit("/session/new") |> visit("/")
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@example.com") |> fill_in(text_field("Username"), with: "link@example.com")
|> fill_in(text_field("Password"), with: "ilovezelda") |> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in")) |> click(button("Sign in"))
@ -21,7 +22,8 @@ defmodule Chess.SessionTest do
create_user() create_user()
session session
|> visit("/session/new") |> visit("/")
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom") |> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "calamityganon") |> fill_in(text_field("Password"), with: "calamityganon")
|> click(button("Sign in")) |> click(button("Sign in"))
@ -33,7 +35,8 @@ defmodule Chess.SessionTest do
create_user() create_user()
session session
|> visit("/session/new") |> visit("/")
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom") |> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "ilovezelda") |> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in")) |> click(button("Sign in"))