Created
November 30, 2020 19:44
-
-
Save mhanberg/e668af5af1364fd4b532323b70b69711 to your computer and use it in GitHub Desktop.
wallaby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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