2
votes

I want to simulate multiple keypress(ctrl+alt, alt+enter, alt+uparrow etc) events for my acceptance test cases.

Ember test documentation has given an abstract syntax for the triggerEvent method. It's still unclear how to use it for multiple keypress events simulation.

edit: adding the code after the suggestion from comments.

let keytrigger = testSelector('random-id', "1");

triggerEvent(keytrigger, "keypress",{17,38});

Please help!

1
It would be awesome if you could share some code. We need to see what you have tried so far. :) - Badacadabra
Sure. var keytrigger = testSelector('random-id', "1"); triggerEvent(keytrigger, "keypress",{17,38}); Also, I looked into keyEvent which in turn calls triggerEvent Need help on how to get my task done. - Karthikeyan Malaisamy
I suggest you to put the code in your question. You can edit it. ;) - Badacadabra
@KarthikeyanMalaisamy did not the answer I had provided work for you? - feanor07
that is great, good luck! - feanor07

1 Answers

0
votes

It must be something like

triggerEvent('.myInputElement', 'keydown', {
  keyCode: 38,   // up arrow
  altKey: true,
  ctrlKey: true

});

for simulating ctrl+alt+up arrow simultaneously. For other properties to pass to keyboard event you can take a look at here I guess.