Skip to content

Instantly share code, notes, and snippets.

@codeofsumit
Last active December 12, 2018 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeofsumit/190e2229b4737b2e10145d8347c77c47 to your computer and use it in GitHub Desktop.
Save codeofsumit/190e2229b4737b2e10145d8347c77c47 to your computer and use it in GitHub Desktop.
index.js inside cypress/support
import './commands';
beforeEach(() => {
// create the map
cy.visit('/index.html', {
onLoad: (contentWindow) => {
const { L } = contentWindow;
// OSM tiles
const tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
})
// create the map
const map = L.map('map')
.setView([51.505, -0.09], 13)
.addLayer(tiles);
contentWindow.map = map;
// add leaflet.pm toolbar
map.pm.addControls();
},
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment