How can I access the window object in Nightwatch while the test is running?
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?