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.

https://github.com/batteries-included/heyya

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:

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: https://www.batteriesincl.com/posts/heyya-one-point-zero
Github: https://github.com/batteries-included/heyya
Docs: https://hexdocs.pm/heyya/readme.html

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 Announcing Top

Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
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 49084 226
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement