Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrent Feature tests with Wallaby
Search
Chris Keathley
September 05, 2016
Programming
1.1k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Concurrent Feature tests with Wallaby
Chris Keathley
September 05, 2016
More Decks by Chris Keathley
See All by Chris Keathley
Solid code isn't flexible
keathley
5
1.1k
Building Adaptive Systems
keathley
44
3.1k
Contracts for building reliable systems
keathley
6
1.1k
Kafka, the hard parts
keathley
3
2k
Building Resilient Elixir Systems
keathley
7
2.5k
Consistent, Distributed Elixir
keathley
6
1.7k
Telling stories with data visualization
keathley
1
720
Easing into continuous deployment
keathley
2
460
Leveling up your git skills
keathley
0
860
Other Decks in Programming
See All in Programming
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.6k
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
180
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
1
420
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
430
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
140
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
170
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.3k
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
240
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
act1-costs.pdf
sumedhbala
0
170
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Building the Perfect Custom Keyboard
takai
2
810
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Balancing Empowerment & Direction
lara
6
1.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
Ethics towards AI in product and experience design
skipperchong
2
320
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
The untapped power of vector embeddings
frankvandijk
2
1.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
410
Transcript
Concurrent Feature Tests with Wallaby Chris Keathley / @ChrisKeathley /
[email protected]
Feature tests: Driving tests from the UI
Name email Password Sign Up
Name email Password Sign Up Fill in
Name email Password Sign Up Fill in Click
Thanks for signing up! Did this show up?
Feature Tests
Feature Tests Represent real users
Feature Tests Represent real users Provide Confidence in the System
Feature Tests Represent real users Provide Confidence in the System
Dark Side
Feature Tests Represent real users Provide Confidence in the System
Feature Tests Represent real users Provide Confidence in the System
(Sometimes)
Feature Tests Represent real users Provide Confidence in the System
(Sometimes) (When they aren’t randomly failing)
Happens
Feature Tests ARE Slow
Wallaby
Wallaby Manages multiple browsers Concurrent Assumes async Interfaces
Wallaby TL;DR
Name email Password Sign Up
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
Wallaby Phoenix EcTo Test Sessions
Wallaby Phoenix EcTo Test Sessions Browser
Wallaby Phoenix EcTo Test Sessions Browser Browser
Wallaby Phoenix EcTo Test Sessions Browser
setup tags do {:ok, session} = Wallaby.start_session([]) on_exit, fn ->
Wallaby.end_session(session) end {:ok, session: session} end
Browser Browser Phoenix Ecto
Browser Browser Phoenix Ecto
Browser Browser Phoenix Ecto
Browser Phoenix Ecto
Browser Phoenix Ecto Ownership Metadata
Browser Phoenix Ecto Ownership Metadata Transaction Ownership
setup tags do {:ok, session} = Wallaby.start_session([]) on_exit, fn ->
Wallaby.end_session(session) end {:ok, session: session} end
setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(YourApp.Repo) metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for( YourApp.Repo,
self()) {:ok, session} = Wallaby.start_session(metadata: metadata) on_exit, fn -> Wallaby.end_session(session) end {:ok, session: session} end
setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(YourApp.Repo) metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for( YourApp.Repo,
self()) {:ok, session} = Wallaby.start_session(metadata: metadata) on_exit, fn -> Wallaby.end_session(session) end {:ok, session: session} end
setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(YourApp.Repo) metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for( YourApp.Repo,
self()) {:ok, session} = Wallaby.start_session(metadata: metadata) on_exit, fn -> Wallaby.end_session(session) end {:ok, session: session} end
setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(YourApp.Repo) metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for( YourApp.Repo,
self()) {:ok, session} = Wallaby.start_session(metadata: metadata) on_exit, fn -> Wallaby.end_session(session) end {:ok, session: session} end
defmodule YourApp.Endpoint do use Phoenix.Endpoint, otp_app: :your_app if Application.get_env(:your_app, :sql_sandbox)
do plug Phoenix.Ecto.SQL.Sandbox end plug YourApp.Router end
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
Thanks for signing up!
Thanks for signing up! <div class="alert"> <span class=“msg"> Thanks for
signing up! </span> </div>
Thanks for signing up! <div class="alert"> <span class=“msg"> Thanks for
signing up! </span> </div> session |> find(“.alert")
Thanks for signing up! <div class="alert"> <span class=“msg"> Thanks for
signing up! </span> </div> session |> find(“.alert")
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session |> find(".user")
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session |> find(".user") Ambiguous
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session |> find(".user", count: 2)
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session |> find(".user", count: 2) |> Enum.map(& find(&1, ".name") )
<div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span
class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div> HTML Test - User Names session |> find(".user", count: 2) |> Enum.map(& find(&1, ".name") ) |> Enum.map(& text(&1) ) # => ["Grace Hopper", "Alan Turing"]
session HTML Test - Grace’s Email <div class="users"> <div class="user">
<span class=“name"> Grace Hopper </span> <span class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div>
session |> find(".user", text: "Grace Hopper") HTML Test - Grace’s
Email <div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div>
session |> find(".user", text: "Grace Hopper") |> find(".email") HTML Test
- Grace’s Email <div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div>
session |> find(".user", text: "Grace Hopper") |> find(".email") |> text
# => "
[email protected]
" HTML Test - Grace’s Email <div class="users"> <div class="user"> <span class=“name"> Grace Hopper </span> <span class=“email">
[email protected]
</span> </div> <div class="user"> <span class=“name"> Alan Turing </span> <span class=“email">
[email protected]
</span> </div> </div>
find(".user") ? Browser
find(".user") JS Browser
find(".user") JS Browser
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
defmodule YourApp.UserRegistrationTest do use YourApp.AcceptanceCase, async: true test "users can
register", %{session: session} do session |> visit("/users/new") |> find(".registration_form") |> fill_in("Full Name", with: "Grace Hopper") |> fill_in("Email", with: "
[email protected]
") |> fill_in("Password", with: "password") |> click("Register") msg_text = session |> find(".flash-message") |> text assert msg_text == "Welcome Grace Hopper" end end Sessions Queries actions
Name Sign Up
<form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button type=“submit">
Register </button> </form> HTML
HTML <form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button
type=“submit"> Register </button> </form>
<form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button type=“submit">
Register </button> </form> HTML Test session
<form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button type=“submit">
Register </button> </form> HTML Test session |> fill_in("Name", with: "Grace Hopper")
<form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button type=“submit">
Register </button> </form> HTML Test session |> fill_in("Name", with: "Grace Hopper") |> click_on("Register")
HTML Test session |> fill_in(“user_name", with: "Grace Hopper") |> click_on("Register")
<form> <label for=“user_name"> Name </label> <input type="text" name=“user_name"> <button type=“submit"> Register </button> </form>
HTML Test session |> fill_in(“user_name", with: "Grace Hopper") |> click_on("Register")
<form> <label for="user_name"> Name </label> <input type="text" name=“user_name"> <label> <input type="checkbox" value="true" name="save_login"> Save login </label> <button type="submit"> Register </button> </form>
HTML Test session |> fill_in(“user_name", with: "Grace Hopper”) |> check("Save
login") |> click_on("Register") <form> <label for="user_name"> Name </label> <input type="text" name=“user_name"> <label> <input type="checkbox" value="true" name="save_login"> Save login </label> <button type="submit"> Register </button> </form>
fill_in(session, "First Name", with: "Chris") choose(session, "Radio Button 1") check(session,
"Checkbox") uncheck(session, "Checkbox") select(session, "My Awesome Select", option: "Option 1") click_on(session, "Some Button") attach_file(session, "File", path: "path/to/file") Other Actions
Wallaby Sessions Queries Interactions
Still More work to do!
https://github.com/keathley/wallaby https://speakerdeck.com/keathley Getting Started
None
None
Lets Build awesome stuff Together!
THANKS Chris Keathley / @ChrisKeathley /
[email protected]