I have Hammer listener on a div, listening for tap and press. I'm writing tests with Cypress and I'm having a deal of trouble to simulate the tap. I'm fiddling with trigger()
. I've tried trigger('tap')
, trigger('mousedown').trigger(mouseup')
, and trigger('touchstart').trigger('touchend')
, with no success. Is anyone successfully producing Hammer taps with Cypress ?
The tap calls a function, which sets window.location = new-page.html
, like this...
function changePage(id) {
window.location.href = "FraisEnListe.aspx?idnote=" + id;
}
Unfortunately, if I call the function directly from Cypress, like this...
cy.window().then((win) => {
win.changePage(29312);
})
the Cypress url stem is taken as the base url, not the current location in the application being tested, and I get a steaming 404. This seems very tricky.
Try to add property type: 'touch' , to event trigger
In my case I have to press or tap the corners: