j40-cejst-2/client/cypress/support/commands.js
Nat Hillard 7b241795fa
Cypress tests are failing locally (#403)
* adding readme with debug instructions
* updating translation tests to pass
* fixes failing latlng url test
* localizing focus buttons
* updating map tests to pass
* temporarily setting to only flag critical+  accessibility errors. To be addressed with full accessibility audit later
2021-07-23 08:52:34 -04:00

28 lines
704 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', {timeout: 10000});
});
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');
});
Cypress.Commands.add('waitForMapIdle', (map) => {
return new Cypress.Promise((resolve) => {
map.once('idle', resolve);
});
});