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:
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