README.md

# Heyya

`Heyya` is a utility to help with testing your [Phoenix](https://www.phoenixframework.org/) components and live view.

## Getting Started

Getting Started

To use Heyya in your Phoenix project, add it to your list of dependencies in mix.exs:

```elixir
def deps do
  [
    {:heyya, "~> 0.5.0"}
  ]
end
```

Then, run `mix deps.get` to install Heyya and its dependencies.

## Example Snapshot Usage

```
use Heyya.SnapshotTest

component_snapshot_test "Super Simple H1 Test" do
  assigns = %{}

  ~H"""
  <h1>Testing</h1>
  """
end
```

To run the snapshot tests, run `mix test` as usual. This will compare the snapshots to the current rendered output of the components and fail the tests if the snapshots do not match.

If you need to update the snapshots for any reason, you can run `HEYYA_OVERRIDE=true mix test` to reset the snapshot values to the current rendered output of the components.

Credit:

The initial snapshot code used [Snapshy](https://hex.pm/packages/snapshy). We have since moved on to inspect the html rather than using snapshy. Thank you to them for the initial implementation.

## Example Live View Test

```
use Heyya.LiveTest
use MyPhoenixWeb.ConnCase
test "widget list with new button", %{conn: conn} do
  start(conn, ~p|/widgets|)
  |> assert_html("Widgets List")
  |> click("a", "New Widgets")
  |> follow(~p|/widgets/new|)
end
```

## Contributing

We welcome contributions to Heyya! Please see the CONTRIBUTING.md file for guidelines on how to contribute.

## License

Heyya is released under the MIT License.