For example, i have this html-code of application:
<div class="swipe-cover" ng-swipe-left="func()"></div>
and such test:
it('test', function() {
browser.executeScript( 'angular.element(".swipe-cover").triggerHandler("swipeleft")' );
});
but it doesn't work.
If i use 'click' insteaf of 'swipeleft', it works.
How can i trigger 'swipeleft' event for e2e tests?
Simulating a gesture work better using a serie of actions:
driver.actions()
.mouseDown(element(by.css('.filter-editorial-rating .ngrs-handle-max')))
.mouseMove({x: -50, y: 0}) // try different value of x
.mouseUp()
.perform();
See https://github.com/angular/angular.js/blob/master/src/ngTouch/directive/ngSwipe.js#L74 to help tou figure out the right value if -50 does work out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With