eclark

eclark

Heyya -- Snapshot testing for Phoenix Components

Heyya is a library to help with testing your Phoenix components. It allows for writing fast tests that assert your HTML is consistent and correct. Specifically, Heyya is designed to work with many functional components and the latest Phoenix and LiveView releases. As your code changes and mutates, tests can change quickly without writing new assertions each time.

There’s a blog post up with example code and integration help here:

https://www.batteriesincl.com/posts/heyya-snapshot-testing

Hex Docs are here:

https://hexdocs.pm/heyya/readme.html

If you’ve ever used React snapshot testing, Heyya will feel very similar.

Most Liked

eclark

eclark

We are releasing Heyya 1.0.0 which includes the following:

  • Stateless component snapshot testing
  • Easier to use LiveView pipe-based view testing
  • LiveComponent testing with automatic view hosting
  • LiveView snapshot testing

When combined, these tools allow for fast testing of Phoenix UIs that are easy to maintain and easy to read.

Blog Post: Heyya Testing Library Reaches Version 1.0.0 — Batteries Included
Github: GitHub - batteries-included/heyya: Heyya the snapshot testing utility for Phoenix framework components
Docs: Heyya — heyya v1.0.0

The newest LiveView snapshot testing feature allows developers to interact with a Phoenix live view and easily assert that some portion of the DOM matches the previous expectations.

For example, here’s an excerpt taken from the example project

defmodule ExampleWeb.NumbersLiveTest do
  use Heyya.LiveCase
  use ExampleWeb.ConnCase

  test "/numbers renders the live_view", %{conn: conn} do
    conn
    |> start(~p"/numbers")
    |> assert_matches_snapshot(name: "full_view", selector: "main")
  end
end

Where Next?

Popular in Libraries Top

devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: https://github.com/devonestes/assertions ...
New
sabiwara
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code. You can try it out using this basic Elixir playground made ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
wmnnd
Hi there, for my project DBLSQD, I needed a file storage solution that is a bit more flexible than Arc. Because I thought others might f...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Sub Categories:

We're in Beta

About us Mission Statement