Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
RackTest extension for submitting a form without a button #529
Please add my name to the list of people requesting this feature.
BTW, I welcome tools that encourage good practices but I would respectfully disagree when they force these practices down everybody's throat.
It unwise to assume that all webapps are designed to be used by everybody or to be compatible with all browsers; in some cases, webapps may fall outside the norm, can be specialised for a very few specific users or to run only on a small set of chosen browsers.
Well, the problem is that we can't implement it in any meaningful way. It's illogical to expect all drivers to implement something which does not work in many browsers. Conceptually it just doesn't make sense. What kind of user action is "submit_form" equivalent to? Hitting enter? What if the user has attached a keydown event handler to this form? It just doesn't make any sense.
Just add the damn button, hide it if you need to (though you probably really shouldn't) and be done with it. It'd be much more interesting to add a send_keys method, and we have had discussions to that effect, but again, the problem was cross-driver compatibility.
Thanks for the reply; I understand better the objection.
My use case is testing an implementation of heroku Add-ons SSO. My page contents look something like this:
If I were using a backend more advanced than rack:test then I wouldn't have to submit the form. But in this case I see no other choice but to monkey patch Capybara. Adding a submit button would make it appear to the user. I suppose I could render a submit button only in test, but that feels like a worse Hack, no?