-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to test a redirect after form submission? #19
Comments
Mostly works, but I've run into a couple of issues: - [`CaseClauseError` when multiple matches in `assert_has`](germsvel/phoenix_test#18) - [No obvious way to follow redirects after a form submition](germsvel/phoenix_test#19)
Yeah, this is a great point @randycoulman. Forms should follow redirects. I'd like to write a test to capture this. Is this a form doing a |
Closes #19 What changed? ============ Our `Live` implementation doesn't handle form redirects, be they to another LiveView with `push_navigate/2` or to a static page via `redirect/2`. This commit updates the implementation to follow redirects the same way we follow redirects when we click on links. Testing note ----------- We also create a new describe block to encapsulate all the testing for `fill_form/3` + `click_button/2`.
@germsvel You've already addressed it, but yes: |
@germsvel 👌 Your changes worked great for my use case! I was able to fully port over to using PhoenixTest for my (still very small) app. Thanks for this library! Very nice to use! |
🎉 Thanks for porting your library to use PhoenixTest @randycoulman! And thanks for coming here when you find issues. |
I'm testing an app that renders a LiveView form and then navigates to another route after submission. How would I test this with PhoenixTest?
It seems like maybe
click_button
/submit_form
should also follow redirects likeclick_link
does, but I'm not sure what other implications that might have.The text was updated successfully, but these errors were encountered: