I'm trying to use Nightwatch to test a React application. I'm using React-Router with it.
When running my test with Nightwatch window
is undefined.
React uses the following snippet to test if the DOM is available:
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
From React.js source: ExecutionEnvironment.js#L16
React-Router expects
canUseDOM
to be true, otherwise it throws an error.
So my test fails because window
is undefined when running Nightwatch.
Shouldn't window
be present with selenium webdriver?
How can I make window
available?