2021-07-06 14:52:35 -04:00
|
|
|
/* MAP */
|
|
|
|
|
|
|
|
// For some interactions, we need access to the underlying map
|
|
|
|
// Below adapted from https://github.com/codeforcologne/edelgard-map
|
|
|
|
Cypress.Commands.add('getMap', () => {
|
2021-07-23 08:52:34 -04:00
|
|
|
return cy.window().its('underlyingMap', {timeout: 10000});
|
2021-07-06 14:52:35 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
Cypress.Commands.add('waitForMove', (map) => {
|
|
|
|
return new Cypress.Promise((resolve) => {
|
|
|
|
map.on('moveend', resolve);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
Cypress.Commands.add('panTo', (map, lngLat) => {
|
|
|
|
map.panTo(lngLat);
|
|
|
|
cy.waitForMove(map);
|
|
|
|
});
|
|
|
|
|
|
|
|
Cypress.Commands.add('getMapCanvas', () => {
|
2021-07-07 15:04:00 -04:00
|
|
|
return cy.get('.maplibregl-canvas');
|
2021-07-06 14:52:35 -04:00
|
|
|
});
|
|
|
|
|
2021-07-09 10:56:38 -04:00
|
|
|
Cypress.Commands.add('waitForMapIdle', (map) => {
|
|
|
|
return new Cypress.Promise((resolve) => {
|
|
|
|
map.once('idle', resolve);
|
|
|
|
});
|
|
|
|
});
|