Skip to content

Instantly share code, notes, and snippets.

@mhanberg
Created November 30, 2020 19:44
Show Gist options
  • Save mhanberg/e668af5af1364fd4b532323b70b69711 to your computer and use it in GitHub Desktop.
Save mhanberg/e668af5af1364fd4b532323b70b69711 to your computer and use it in GitHub Desktop.
wallaby
defmodule BifrostWeb.FeatureCase do
use ExUnit.CaseTemplate
import Bifrost.AccountsFixtures
alias BifrostWeb.Router.Helpers, as: Routes
using do
quote do
use Wallaby.Feature
import Bifrost.AccountsFixtures
import Bifrost.HealthFixtures
alias Bifrost.Repo
alias BifrostWeb.Endpoint, as: Endpoint
alias BifrostWeb.Router.Helpers, as: Routes
import BifrostWeb.FeatureCase
def assert_text!(parent, text) do
parent
|> assert_text(text)
parent
end
end
end
def login(context) do
import Wallaby.Browser
import Wallaby.Query
user = user_fixture(password: "password123!")
context[:session]
|> visit("/")
|> fill_in(text_field("Email"), with: user.email)
|> fill_in(text_field("Password"), with: "password123!")
|> click(button("Log in"))
:ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment