I have a Rails project using Cucumber and Capybara for tests. I have a file upload page using Dropzone.js.
My uploads work great using the dialog box or drag and drop. Testing is another matter.
I have the following field in my form:
<input id="photo_image" multiple="multiple" name="image" type="hidden">
However, in the step definitions, I've tried a few methods of finding and attaching the file data, but none of them work.
I've tried fill_in:
fill_in "photo_image", with: photo
I've tried find with css selectors:
find('#photo_image').set photo
I've tried find with xpath:
find(:xpath, "//input[@id='photo_image']").set photo
But none of them see the hidden field.
Unable to find css "#photo_image" (Capybara::ElementNotFound)
Unable to find xpath "//input[@id='photo_image']" (Capybara::ElementNotFound)
Unable to find field "photo_image" (Capybara::ElementNotFound)
Is there any testing method that can handle the upload using Dropzone.js or is it hopeless?