When a textfield has been marked 'readonly' and you call e.g. fill_in('text_field_id', with: value), it fails silently. Capybara::RackTest::Node#set simply does not execute the set, because of an unless self[:readonly]. Please raise an error if this is attempted: it would have saved me quite some time searching for why the set didn't work. I'm sure others have been surprised by this as well.
fill_in('text_field_id', with: value)
I'm not sure what happens if you try to do this with another driver, mostly with Selenium. The behaviour should be consistent, so we should adapt to what they do. This does make sense to me, so if you can work it up, please provide a pull request!
Since it seems like we have tested the current behaviour, that means we can't change it without doing a major version bump, which will probably take a while.
It would be handy to be able to force set the field if needed. We are using datepicker that is 'readonly' so people are forced to pick and not fill it in but in the tests it is handy to just fill it in. I have just updated the version of capybara today and hit the same problem where setting a 'readonly' field gives you no warning.
Forcing can be done by using execute_script if needed. Since capybara aims to replicate user interaction generally it won't be allowing for forcing the setting of values on readonly elements.
Clsing this now since attempting to set a readonly element will issue a warning in master now (2.4 to be released soon), it will raise an error whenever we move to v3