JQuery trigger () not working in angular test runner script in end2end test

I know that binding to jquery events in the angular “controller” does not follow this framework philosophy, but it allows me to gradually translate views into the asp.net mvc project into angular. This works at runtime, but I cannot verify this. If I linked the jquery event "keydown" to the input field in the "controller", and I try to call () this event in my test script (I use angular -scenario.js), this event simply does not get in the "controller". "I I can’t use input (). Enter (), since this input is not part of the model (as I said at the beginning ...). Question: is it possible to trigger an event from the script? If not, should I use another test runner?

+1
source share
2 answers

You can look at AngularJS tests. They use browserTrigger(element, 'keydown'); to trigger DOM events on elements.

Here is an example from AngularJS source

0
source

the link above points to angular UT, not e2e, you can trigger the dom event in e2e through your api request, for example

  element('#something_id').query(function(el, done){ var evt = document.createEvent('Event'); evt.initEvent('focus', false, true); el[0].dispatchEvent(evt); done(); }); 
+2
source

Source: https://habr.com/ru/post/1483270/


All Articles