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

Support file input with plug upload #15

Closed Nilsonn closed 8 months ago

Nilsonn commented 9 months ago

When using an input field for a file, the validate_expected_fields function raises, since Plug.Upload is not supported. The docs for File Uploads in Phoenix describe how the file upload can be used.

This PR solves this issue but includes Plug.Upload pattern matches in some functions. I was not quite sure whether this is a good approach but wanted to suggest the solution anyway.

germsvel commented 9 months ago

@Nilsonn thanks so much for the PR! I haven't had time to think about how to support file uploads yet 😅 so this is great!

Before I merge it, I want to think a little about the API for testing uploads since we have to support both LiveView and static pages. Until then, I'm going to hold off on merging this. I want to test a few things and see what would be good.

And, of course, I'm always open to suggestions. Do you have any thoughts on how to support uploads nicely for both LiveView and static pages?

germsvel commented 8 months ago

@Nilsonn this has gotten a bit stale, so I'm going to close this.

I haven't had time to dig into how to support uploads really well. I'd like to make it a nice experience for both LiveView and non-LiveView.

If you have ideas/suggestions/insights, please let me know! I'd love to move this forward in some fashion.