Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for filling_in disabled field is misleading #1891

Closed
gerrywastaken opened this issue Jul 18, 2017 · 3 comments
Closed

Error for filling_in disabled field is misleading #1891

gerrywastaken opened this issue Jul 18, 2017 · 3 comments
Labels

Comments

@gerrywastaken
Copy link

gerrywastaken commented Jul 18, 2017

It tells you it can't find the field, when really the field is there, but it just happened to be disabled at the time. Debugging this is tricky when when dealing with a react component where the disabled state is so brief that you didn't even know it existed. I'm sure there are many other cases of this. It would be great if capybara told me what the real issue was.

Meta

Capybara Version:
2.14.0

Expected Behavior

"Field <selector_used> was disabled so could not be filled in"

OR (less ideal but still a LOT better)

"Unable to find field <selector_used>. It could be disabled or hidden."

Actual Behavior

"Unable to find field <selector_used>"

Steps to reproduce

<input type="input" id="foo" disabled />
fill_in('foo', with: 123)

Thank you for all your work btw. I love Capybara. :)

@twalpole
Copy link
Member

twalpole commented Jul 18, 2017

PRs are gladly considered - although it gets really tricky to generate a comprehensive error message when custom filters can be added to any selector (just a warning before you attempt a PR). Also, if the disabled state was really brief then you shouldn't have received an error since Capybara should have automatically retried and found the field to fill in.

@twalpole
Copy link
Member

@gerrywastaken One relatively easy thing that can be done is to ensure selector filters that have default options are considered in the error description. Please try the WIP ffilter_error_messages branch and see if that's better for you.

@gerrywastaken
Copy link
Author

@twalpole sorry that I have not come back to this issue till now. Thank you so much for this:
https://github.com/teamcapybara/capybara/pull/1892/files

I'm sure it will not just help me but also many others. You are awesome. :)

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants