j40-cejst-2/client/cypress/support/commands.js
Nat Hillard 2257627938
Use MapLibre for Map Visualization (#300)
* switching to MapLibre (see more at https://github.com/usds/justice40-tool/issues/299)
* Removing traces of OpenLayers
* Review comments - removing unused properties, component
This is a pre-requisite for addressing issue #280 and other similar control-related tickets
2021-07-07 15:04:00 -04:00

23 lines
551 B
JavaScript

/* MAP */
// For some interactions, we need access to the underlying map
// Below adapted from https://github.com/codeforcologne/edelgard-map
Cypress.Commands.add('getMap', () => {
return cy.window().its('underlyingMap');
});
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', () => {
return cy.get('.maplibregl-canvas');
});