Simulate a Tap Event for Functional Tests


#1

We’d like to simulate a button tap event in order to run functional tests in an Ionic/Cordova app. It appears click events work on the buttons, but when the event is triggered by a tap (which we consider better UX), we’re unable to simulate the event with our test code.

Here’s our Ionic button:

<button id="loginBtn" ion-button block (tap)="login()">LOGIN</button>

Here’s how we trigger click events:

document.getElementById('loginBtn').click();

How can we do this for Ionic tap events?