2

I am UI testing an application containing OpenLayers. Since OpenLayers is for the most part drawing an SVG, directly testing effects via DOM is not always possible.

I would like to get the map object to check if the variables within it are set correctly after clicking an element outside of the map.

For this I put the map object in window.mapInstance.

During a test, I try this:

someTest: client => {
  // regular Nightwatch testing omitted ...
  // and finally:
  client.execute(
    function () { return window },
    [],
    function (r) {
      console.log(r.value.mapInstance.getView().getZoom())
      client.end()
   }
  )
}

That throws me an error: Error while running .executeScript() protocol action: javascript error: circular reference

r.value is then set to the error object, and the whole thing fails.

What am I doing wrong?

quick_dough
  • 76
  • 1
  • 6
  • I have the same issue, did you manager to solve it? – Arst Sep 26 '19 at 02:00
  • I eventually circumvented it. The issue is - as far as I remember - that the scripts communicate with strings made by JSON.stringify, which fails on window and especially on OpenLayers objects. Solution was to just hand the needed variables down or up each time I need them and make sure JSON can stringify and parse everything I pass. – quick_dough Apr 22 '20 at 05:51

0 Answers0