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:
parent
558b4a5ff9
commit
9fb960fa5e
@ -16,6 +16,8 @@
|
||||
<header role="banner">
|
||||
<nav role="user">
|
||||
<%= link("Register", to: registration_path(@conn, :new)) %>
|
||||
|
|
||||
<%= link("Log in", to: session_path(@conn, :new)) %>
|
||||
</nav>
|
||||
<h1>Chess</h1>
|
||||
</header>
|
||||
|
||||
@ -32,7 +32,7 @@ defmodule Chess.GamesTest do
|
||||
|
||||
defp create_game(session) do
|
||||
session
|
||||
|> visit("/")
|
||||
|> visit("/games")
|
||||
|> click(button("Create game"))
|
||||
end
|
||||
|
||||
|
||||
@ -3,13 +3,14 @@ defmodule Chess.SessionTest do
|
||||
|
||||
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
|
||||
create_user()
|
||||
|
||||
session
|
||||
|> visit("/session/new")
|
||||
|> visit("/")
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@example.com")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
@ -21,7 +22,8 @@ defmodule Chess.SessionTest do
|
||||
create_user()
|
||||
|
||||
session
|
||||
|> visit("/session/new")
|
||||
|> visit("/")
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "calamityganon")
|
||||
|> click(button("Sign in"))
|
||||
@ -33,7 +35,8 @@ defmodule Chess.SessionTest do
|
||||
create_user()
|
||||
|
||||
session
|
||||
|> visit("/session/new")
|
||||
|> visit("/")
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user