Error: "TypeError: window.location.toString is not a function"
See original GitHub issueThe issue has been reproduced here: https://github.com/jsnanigans/hammerhead_testcafe_error
What is your Test Scenario?
Speculation: A iframe is focused, the iframe sends a message to the main window, the main window closes the iframe before testcafe can focus the main window.
A Iframe is opened where the user enters some data and clicks on submit, then the iframe is redirected with 307 to where some javascript sends a postMessage to our host window which closes the iframe. After the iframe is closed and this error occurs something in the redux dispatch or in the react core breaks and the state is not updated/the app is not re-rendered. After some debugging we found that it might have something to do with hammerhead.js internals and some focus method. Important things to note here are that this happens if the iframe has a src (like in this example) or has no src attribute (like in our application)
What is the Current behavior?
error is thrown and prevents react from rendering
What is the Expected behavior?
the main window is focused in testcafe and continues as usual
What is your web application and your TestCafe test code?
The issue has been reproduced here: https://github.com/jsnanigans/hammerhead_testcafe_error
Steps to Reproduce:
- clone repo: https://github.com/jsnanigans/hammerhead_testcafe_error
- run npm install
- run npm start to start the local server on port 3000.
- run testcafe -c 1 chrome tests/Sample.ts --skip-js-errors to start testcafe.
- when the test stops for debugging, open the console in the browser, there you will see the error.
Your Environment details:
- testcafe version: 1.6.1
- node.js version: v12.11.1
- command-line arguments:
testcafe -c 1 chrome tests/Sample.ts --skip-js-errors
- browser name and version: Google Chrome Version 78.0.3904.87 (Official Build) (64-bit)
- platform and version: macOS 10.14.6 (18G103)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top GitHub Comments
https://github.com/DevExpress/testcafe-hammerhead/issues/2716#issuecomment-993247166
I’ve researched this issue and created a simplified example. The problem occurs when the focus method is called on some element from a removed iframe.