abramenal / cypress-file-upload

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

[Bug] Files can be attached to disabled inputs without force:true #321

Open devnev opened 2 years ago

devnev commented 2 years ago

Current behavior:

An element <input type=file disabled> can have a file attached to it using this plugin without specifiying force: true.

Desired behavior:

Attaching a file to a disabled input should fail as the user would be unable to do so.

The documentation for cypress-file-upload specifies:

{boolean} force - same as for cy.trigger, it enforces the event triggers on HTML subject element. Usually this is necessary when you use hidden HTML controls for your file upload. Defaults to false

But for cy.trigger and other actions, actionability is documented to exclude disabled elements: https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Actionability

Steps to reproduce: (app code and test code)

https://github.com/devnev/cypress-test-tiny/commit/20859a5906f1845783f6fb8c3652ed48b5bb5e61

Versions

Using Chrome on Mac, originally encountered in version 3.5.3, reproduced on 5.0.8