Handle submitting forms in tests better

This should provide far more useful output when something goes wrong.