Testing Server-rendered HTML Applications
Explore testing techniques for server-rendered HTML endpoints in Phoenix applications. Learn to write controller tests that verify the rendering of HTML forms and user creation workflows, using Phoenix helpers and assertions with ExUnit. This lesson prepares you to ensure your server-rendered interfaces work correctly and maintain high test coverage.
We'll cover the following...
Testing server-rendered HTML endpoints is very similar to testing JSON endpoints, but the response is an HTML document instead of JSON.
Controller
We’ll write tests for the user controller that handles the server-rendered HTML endpoints. Let’s start by looking at the controller code that we’ll be testing:
This code is a controller that, under the hood, calls to the same context module as the JSON controller we’ve already tested. Our testing will focus on the two endpoints that call the new and create controller ...
...