abramenal / cypress-file-upload

File upload testing made easy
https://npm.im/cypress-file-upload
MIT License
496 stars 89 forks source link

attachFile is not a function when using dropzone.js #353

Open dschulten opened 2 years ago

dschulten commented 2 years ago

Current behavior:

On a website that seems to use dropdown.js, I cannot find the element that supports attachFile(). The website is not under my control, so it is not easy to find out how they implemented their dropzone, but I can see that they import dropzone.js in html head using the URL https://dev.service-bw.de/serviceportal-theme/js/dropzone.js?t=1640100138000. I have put a breakpoint into the dragenter() function in line 730, which gets triggered when I drag a file onto the dropzone, therefore I believe that dropzone.js is in fact used here.

However, apparently they have heavily customized the drop zone, and they seem to activate it programmatically (no dropzone css class in the page).

All attempts to cy.get() the dropzone and call attachFile() on it lead to the error ".attachFile is not a function".

Desired behavior:

The dropzone should be supported

Steps to reproduce: (app code and test code)

Test code: https://github.com/dschulten/cypress-test-tiny/tree/feature/dropzonejs

The test attempts to determine an object with attachFile() function inside the dropzone on the page, see logs for failed attempts. The test itself does not fail because I wanted to show all the candidates I've tried.

App code: see visited application in test code

Versions

cypress-file-upload 5.0.8 Cypress 9.1.1 Windows Chrome