germsvel / phoenix_test

PhoenixTest provides a unified way of writing feature tests -- regardless of whether you're testing LiveView pages or static (non-LiveView) pages.
https://hex.pm/packages/phoenix_test
MIT License
181 stars 23 forks source link

Follow redirects on `PhoenixTest.visit/2` #42

Closed germsvel closed 8 months ago

germsvel commented 8 months ago

Closes #41

What changed?

Currently, PhoenixTest.visit/2 doesn't follow redirects. That's a helpful feature to have since (a) other links, buttons, etc. follow redirects (so it's expected), and (b) for scenarios like testing authentication in an app (imagine testing that you visit a page and you are redirected to a different page).

This commit adds redirection and tests it from both the Static and Live implementations -- even though the implementation is the same for both. It all happens in PhoenixTest.visit/2.