Add Zoom/Lat/Lng to the URL (#293)

* mandatory eslint fix
* Addresses #286 - Adding lat/lng to the URL
* setting zoom on map load
* adding integration tests for zoom
This commit is contained in:
Nat Hillard 2021-07-06 14:52:35 -04:00 committed by GitHub
commit 27d9472326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 27 deletions

View file

@ -1,27 +1,23 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'},
// (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'},
// (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
/* 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('mapboxGlMap');
});
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('.mapboxgl-canvas');
});