Using ReactTestUtils in a browser console - reactjs

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!

Related

Electron-React error: I keep getting undefined error while reading 'ipcRenderer'

I am trying to create a desktop application using Electron and React.
I set the basic settings using electron-react-boilerplate.
https://github.com/electron-react-boilerplate/electron-react-boilerplate
However, I continued to receive can't resolve fs module not found error.
To solve this error, I performed the method suggested in document https://electron-react-boilerplate.js.org/docs/native-modules/#native-modules-in-electron-react-boilerplate. (activate node integration)
Then I got an error Uncaught TypeError: Cannot read properties of undefined (reading 'ipcRenderer'). but strangely, an error warning window appears, but the app runs normally.
How can I get rid of this error?
currently, i comment all of following code in src/renderer/index.tsx
// calling IPC exposed from preload script
window.electron.ipcRenderer.once('ipc-example', (arg) => {
// eslint-disable-next-line no-console
console.log(arg);
});
window.electron.ipcRenderer.myPing();

Sencha: Right-hand side of 'instanceof' is not an object

I encountered an error Uncaught TypeError: Right-hand side of 'instanceof' is not an object on my console.
This error is from Ext.toolbar.Toolbar class located on node_modules/Toolbar.js of my universal app. I use open tooling to generate my app.
Upon checking the Toolbar.js, the Ext.toolbar.Separator is in the uses property. Supposed to be the ext classes shouldn't be modified and I don't know why this error suddenly occurred.
I build the app using sencha app build dev/testing mode and it succeeds but it has the console error above. When building on production, it fails also and outputs the same error above.
From sencha app build --prod output:
TypeError: undefined is not a valid argument for '''instanceof''' (evaluating '''component instanceof Ext.toolbar.Separator''')
Can somebody explain why this error occurs? Any help will be appreciated. Thanks
Change your code to:
if (component.xtype === 'tbseparator') {
...

AngularJS 1.5 websocket library installation problem

I have installed the following library
https://github.com/gdi2290/angular-websocket
in my AngularJS 1.5 application. When i go to run I get the following
Uncaught TypeError: Cannot read property 'noop' of undefined
at angular-websocket.js:46
at angular-websocket.js:10
at angular-websocket.js:13
Line 46: var noop = _angular2.default.noop;
Any ideas

Uncaught SyntaxError: Use of const in strict mode in chrome 40

Our ReactJS application created using create-react-app is not getting indexed in google. Upon investigation, found out that google crawler is using Chrome v40 engine to parse client side apps. So I got hold of Chrome 40 and tried to load the page. I got an error in console saying
Loading chunk 13 failed. Uncaught SyntaxError: Use of const in strict
mode.
I tried to apply polyfill (babel polyfill as well as some others) but this error is not going away.
Any advise? Is there anything I can do to make create-react-app to correctly transpile the code to Chrome 40 compatible ?
The issue happened because i was using a component which was not compatible. https://github.com/yahoo/react-stickynode. It worked perfectly after i removed this.

I am getting the following error while accessing an angularJS app with casperjs: "Can't find variable: angular"

Here is the complete error text:
Page error: TypeError: 'undefined' is not a function (evaluating 'ModuleStore.register.bind(ModuleStore)')
Page error: ReferenceError: Can't find variable: angular
I am using phantomJS 2.0 with casperjs 1.1-beta3
UPDATE: I had multiple phantomjs versions installed. When using phantomjs -v command, it was showing me 2.0.0 but when I used casperjs command, it showed me that casperjs is using different version.

Resources