Hi guys, I’m running into a challenge with writing an acceptance test for form submission via the Enter key.
Context : In our app, we have many forms where users can fill in input fields and press Enter to submit.
Problem : I’m now writing an acceptance test in Ember to verify this behavior — specifically:
Fill in the form ➡️ press Enter ➡️ form should be submitted.
But here’s the catch:
In the test environment, triggerKeyEvent(..., 'keydown', 'Enter') doesn't trigger form submission.
That’s because the test runner expects a keydown handler to be explicitly wired (which we don’t do, because the form uses the standard HTML 'structure submit button inside the form')
Adding key event listeners to every form just for the sake of testing would be redundant and hard to maintain — especially in a large-scale app.
I have attached the simple example for the above issue.