testcafe: Testcafe browser window launches to 'about:blank' with console errors
What is your Test Scenario?
Every test is unable to start as expected in Chrome or Firefox (functional when running tests via docker).
What is the Current behavior?
Browser launches to a Testcafe page w/ ‘about:blank’ and various JS errors in console, doesn’t move from this page.
What is the Expected behavior?
Getting past initial page load and continuing to run the tests.
Workaround
Found by @kyle-johnson. Use localhost
or 127.0.0.1
as a hostname:
testcafe --hostname localhost
createTestCafe('localhost')
createTestCafe({ hostname: 'localhost' })
References
https://github.com/nodejs/node/issues/38709
What is your web application and your TestCafe test code?
Your complete test code (or attach your test files):
import { t } from 'testcafe'
fixture('About Blank')
test('Go to URL', async () => {
await t.navigateTo('https://www.github.com')
})
Steps to Reproduce:
- Run any TestCafe test
- See page load to
http://192.168.1.167:53023/do7j2zBCU*c1hyXyWs7/about:blank
- Inspect console for following logs
Chrome:
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE // :60901/ testcafe-automation.js:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE // testcafe-driver.js:1
Uncaught TypeError: ClientDriver is not a constructor // task.js:48
at task.js:48
at task.js:69
at task.js:71
Firefox:
Uncaught SyntaxError: expected expression, got '}' // testcafe-automation.js:1:37
Uncaught SyntaxError: expected expression, got ')' // testcafe-driver.js:1
Uncaught TypeError: ClientDriver is not a constructor // task.js:48:24
<anonymous> http://192.168.1.167:53023/task.js:48
<anonymous> http://192.168.1.167:53023/task.js:69
<anonymous> http://192.168.1.167:53023/task.js:71
Your Environment details:
- testcafe version: 1.14.2
- node.js version: v14.17.0
- command-line arguments: testcafe chrome test.js OR testcafe firefox test.js
- browser name and version: Chrome - 90.0.4430.212, Firefox - 88.0
- platform and version: macOS 11.3.1
- other: If left idle for two minutes the window will close and re-open to the same ‘about:blank’ URL. Testcafe logging states it is running in {Browser} / macOS 10.15, but I am on macOS 11.3.1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 17 (6 by maintainers)
Adding
--hostname localhost
on Big Sur seems to fix this issue for me.I’ve been having the same issue, it’s been driving me crazy. It started happening right after the last macOS Big Sur update, with a Testcafe version and codebase that have been working successfully for over several months now.
It seems that the new macOS update breaks TestCafe. Everything works as expected with my macOS 11.2.3. I will try to reproduce it again after updating macOS to the latest version, and post my results here.