         .should.notify(done)
   describe 'Test embedding', ->
     embedUrl = baseUrl + '/embed'
+    # Helper function to get js string to be evaluated with
+    # asserters.jsCondition
+    isNearMapCenter = (location, delta = 1e-4) ->
+      INITIAL_CENTER = 'app.getRegion("map").currentView.map._initialCenter'
+      initialCenter =
+        lat: INITIAL_CENTER + '.lat'
+        lng: INITIAL_CENTER + '.lng'
+      isNear = (x) =>
+        'Math.abs(' + x + ') < ' + delta
+      subLat = initialCenter.lat + ' - ' + location.lat
+      latIsNear = isNear subLat
+      subLng = initialCenter.lng + ' - ' + location.lng
+      lngIsNear = isNear subLng
+      return "#{latIsNear} && #{lngIsNear}"
     describe 'Test embedded addresses', ->
       embeds = [
         {

            browser
              .waitForElementsByCssSelector('.leaflet-marker-pane > .leaflet-marker-icon', asserters.isDisplayed, delay, pollFreq)
              .should.notify done

              )
              .should.notify(done)

          it 'Should be centered to the address', (done) ->
            browser
              .waitFor(
                asserters.jsCondition(isNearMapCenter(embed.location),
                delay, pollFreq))
                .should.notify(done)
        return

    describe 'Test embedded units', ->
      embeds = [
        {
          path: '/unit/41047'
          name: 'Uimastadion / Maauimala'
          location:
            lat: 60.188812
            lng: 24.930822
        }
      ]

