Write Tests for a LiveView
LiveView, like Channels, provides test helpers that allow us to write meaningful tests for our LiveView module quickly. The
Phoenix.LiveViewTest module offers all the helpers we need to start writing tests.
Our LiveView is pretty simple because it doesn’t respond to front-end events. Our tests will be basic because of this. We’ll ensure that
ProductLiveView mounts and renders the correct HTML.
We’ll need to add a test dependency to our
mix.exs file to get started.
Floki to parse HTML, so let’s add that.