Simulate Touch Events in browser or mobile?

Is there any way in enyo to trigger touch events like touch up, touch down, scrollby? I need to run some mocha tests for the app in the browser and it requires touch features like swipes, etc. Or is it possible to do it in selenium?


  • edited July 2014
    If you're using Chrome, you might be able to utilize the emulation features by launching Developer Tools, going to the Emulation tab, and selecting a Device that emits touch events. Will this work for your purposes? If not, you can always create them manually in pure JS:
  • edited July 2014
    Well the chrome touch events doesn't work as expected. I was thinking is it possible for me to trigger a tap/click on a button by using
    enyo.bubble('tap', ...) or within a component ?
  • edited July 2014
    Yep, you can bubble the event for the control which you want to simulate an event, i.e.
    this.$.myButton.bubble('ontap' <, event, sender>) (make sure to include the "on" prefix for event names). The event will be dispatched to the control and bubble upwards from there, assuming a handler along the way hasn't returned true to signify the event has been handled.
  • Thanks a lot.. now i can simulate swipe events by bubbling ondragstart, ondrag, ondragfinish events. It works great with mocha and selenium with wd test cases.
Sign In or Register to comment.