<commit_before>const getMapDiv = () => cy.get('div.leaflet-container', {log: false})
const getMap = (): Cypress.Chainable<L.Map> =>
  cy.window({log: false}).its('LeafletMap', {log: false})

// Reusable command for getting the map container
Cypress.Commands.add('getMapDiv', getMapDiv)
Cypress.Commands.add('getLeafletMap', getMap)

const waitDuration = 10
const minZoom = 12
Cypress.Commands.add('clickMapAtCoord', (coord: L.LatLngTuple, zoom = 18) => {
  if (zoom < minZoom)
    throw new Error(`Minimum clickMapAtCoord zoom is ${minZoom}`)
  cy.centerMapOn(coord, zoom)
  cy.getLeafletMap().then((map) => {
    Cypress.log({
      displayName: 'clickMapAtCoord',
      message: `([${coord[0]}, ${coord[1]}], ${zoom})`
    })
    const point = map.latLngToContainerPoint(coord)
    getMapDiv().click(point.x, point.y, {log: false})
    cy.wait(waitDuration, {log: false}) // eslint-disable-line
  })
})

Cypress.Commands.add('waitForMapToLoad', () => {
  Cypress.log({displayName: 'waitForMapToLoad'})
  getMap().waitUntil(
    (map: L.Map) => new Promise((resolve) => map.whenReady(resolve))
  )
  return getMap()
})

Cypress.Commands.add(
  'mapCenteredOn',
  (latlng: L.LatLngTuple, tolerance: number) =>
    cy
      .getLeafletMap()
      .then((map) =><commit_msg>Increase the delay between map clicks<commit_after>const getMapDiv = () => cy.get('div.leaflet-container', {log: false})
const getMap = (): Cypress.Chainable<L.Map> =>
  cy.window({log: false}).its('LeafletMap', {log: false})

// Reusable command for getting the map container
Cypress.Commands.add('getMapDiv', getMapDiv)
Cypress.Commands.add('getLeafletMap', getMap)

const waitDuration = 100
const minZoom = 12

Cypress.Commands.add('clickMapAtCoord', (coord: L.LatLngTuple, zoom = 18) => {
  if (zoom < minZoom)
    throw new Error(`Minimum clickMapAtCoord zoom is ${minZoom}`)
  cy.centerMapOn(coord, zoom)
  cy.getLeafletMap().then((map) => {
    Cypress.log({
      displayName: 'clickMapAtCoord',
      message: `([${coord[0]}, ${coord[1]}], ${zoom})`
    })
    const point = map.latLngToContainerPoint(coord)
    getMapDiv().click(point.x, point.y, {log: false})
    cy.wait(waitDuration, {log: false}) // eslint-disable-line
  })
})

Cypress.Commands.add('waitForMapToLoad', () => {
  Cypress.log({displayName: 'waitForMapToLoad'})
  getMap().waitUntil(
    (map: L.Map) => new Promise((resolve) => map.whenReady(resolve))
  )
  return getMap()
})

Cypress.Commands.add(
  'mapCenteredOn',
  (latlng: L.LatLngTuple, tolerance: number) =>
    cy
      .getLeafletMap()
      .then((map) =>
{'fraction_non_alphanumeric': 0.17821011673151751, 'fraction_numerical': 0.006614785992217899, 'mean_word_length': 4.389937106918239, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721082', 'n_tokens_mistral': 941, 'n_tokens_neox': 935, 'n_words': 175}