germsvel / phoenix_test

MIT License
144 stars 20 forks source link

Handle redirects that immediately push_patch #55

Closed mattwynne closed 5 months ago

mattwynne commented 5 months ago

We tried to test a link that goes into a page that immediately does a push_patch to set a default querystring parameter.

We found we got this error:

  6) <redacted>
     <redacted>:44
     ** (MatchError) no match of right hand side value: {:error, {:live_redirect, %{to: "/some=url/?date=2024-04-08", flash: %{}}}}
     code: |> click_link("<redacted>")
     stacktrace:
       (phoenix_test 0.2.10) lib/phoenix_test/live.ex:241: PhoenixTest.Driver.PhoenixTest.Live.maybe_redirect/2
       test/<redacted>/live_test.exs:47: (test)
germsvel commented 5 months ago

Thanks for opening this issue! I think this should be easy to resolve. I'm guessing we're trying to do multiple redirects in Live's maybe_redirect implementation.