Using ReactTestUtils in a browser console

Viewed 21

I'm trying to setup some automation using the ReactTestUtils, and while I was playing around in the browser's console, I got the following errors:

Attempt 1:

var TestUtils = React.addons.TestUtils
Uncaught TypeError: React.addons is undefined
    <anonymous> debugger eval code:1
debugger eval code:1:17

Attempt 2:

var TestUtils = React.import ReactTestUtils from 'react-dom/test-utils';
Uncaught SyntaxError: unexpected token: identifier

According to The Guide to Test Automation of ReactJS Apps:

To use it in the web browser and scripts of the Selenium testing framework we have to set its reference into a root window object.

How exactly can one set up a root window object in Firefox, Chrome, or Selenium WebDriver?

Another solution given here is to set config.react.addons = true in the config/application.rb, but I'm not sure that's available in a Python-Dash project. I've also installed an extension, but it looks like something related to profiling. Thanks in advance for any insight!

0 Answers
Related