David Oz
David Oz

Reputation: 83

Zoom out by scrolling in a testcafe test

I have a map in my angular application OpenLayers map. During the test using testcafe, I have to zoom out, but I have no way how to do that. I only have to put my mouse at the center of the screen, and then scroll down to zoom out. Already tried using ClientFunction with scrollBy and etc but nothing happens in map. Thank you

Upvotes: 0

Views: 395

Answers (1)

Ilya Afanasenko
Ilya Afanasenko

Reputation: 527

Find out on which element the handler you need hangs and what event it listens to. This is most likely a 'mousewheel' event. This should help you:

const zoom = ClientFunction(zoomSize => {
    const event = new WheelEvent('wheel', { deltaY: zoomSize });
    document.querySelector('#zommed-element').dispatchEvent(event);
});

Upvotes: 1

Related Questions