I've a problem only with trying out the sample from your readme page!
1) Error on page "http://devexpress.github.io/testcafe/example/":
Uncaught SyntaxError: Unexpected token )
and the error will be shown here
> 8 | .typeText('#input', 'Peter Parker')
I've used ChromeCanary for my test and I was running test cafe version 0.9.0 Do I need any specific Node version? I'm using 6.5.0 here on a MacOS system. Thanks!
Hi Jan,
I've checked some our examples in the documentation and they work properly in Chrome Canary. Could you please provide code of the example you've run?
I just tried the new example, but with the same result:
1) Error on page "http://devexpress.github.io/testcafe/example/":
Uncaught SyntaxError: Unexpected token )
Browser: Chrome 56.0.2905 / Mac OS X 10.12.1
3 |fixture `Example page`
4 | .page `https://devexpress.github.io/testcafe/example`;
5 |
6 |test('Emulate user actions and perform a verification', async t => {
7 | await t
> 8 | .setNativeDialogHandler(() => true)
9 | .click('#populate')
10 | .click('#submit-button');
11 |
12 | const location = await t.eval(() => window.location);
13 |
It looks like that it's a problem await. How is it running, with babel?
Update With Safari the example is running, but not with Chrome Canary.
Maybe it's because Chrome Canary is supporting ansync/await natively and the the polyfill is doing something different (https://www.chromestatus.com/features/5643236399906816)
I've tried to run this in Chrome Canary today at it was ok on my side. It maybe something wrong with babel modules. I'll try to investigate this tomorrow.
@janbaer, It seems I've reproduced the problem. But it's gone after I reinstalled testcafe. I uninstalled it locally and globally and then installed it again globally:
npm uninstall testcafe
sudo npm uninstall -g testcafe
npm install -g testcafe
Please try this on your side and notify me is the test works.
Unfortunately it hasn't helped, after reinstalling of testcafe I got the same error with ChromeCanary. Will try it with Chrome...
With a fresh installed Chrome it's also working.
Chrome 54.0.2840 / Mac OS X 10.12.1
only with ChromeCanary it's failing
Browser: Chrome 56.0.2905 / Mac OS X 10.12.1
Is it failed in ChromeCanary with Uncaught SyntaxError: Unexpected token ) error on the > 8 | .setNativeDialogHandler(() => true) line?
Yes, exactly this error I got! I also posted the complete error in a previous post and it's still the same. Can you reproduce it?
Unfortunately no. It works on my side with exactly the same configuration. I'll do some more investigation and notify you when a have some results.
@janbaer Could you please run the test in Chrome Canary in Incognito mode. To accomplish this open the browser in Incognito mode and run the test as described in the Remote Browsers article.
Unfortunately the result is the same...
I have the same problem in Chrome Version 54.0.2840.87 (64-bit) / Mac OS X.
If I try to run the example in firefox (testcafe firefox tests). Firefox nightly is started and then the cli-tool just "hangs" (nothing is happening) and if I open the dev tools in firefox I see the following error:
TypeError: Not allowed to define a non-configurable property on the WindowProxy object testcafe-core.js:1:7989
TypeError: C.default is undefined[Learn More] testcafe-ui.js:1:16328
TypeError: s.default is undefined[Learn More] testcafe-automation.js:1:1668
TypeError: u.default is undefined[Learn More] testcafe-driver.js:1:25145
TypeError: ClientDriver is not a constructor[Learn More]
Chrome canary and Safari are however working fine for me.
Hi @tjoskar,
Thanks for your report. It seems this is another problem. I've created a separate issue for the problem in Firefox #950
Guys, could you please check the initial issue with our new release version (it's with alpha tag now)? We've pushed some fixes that can help. To check it please run npm install testcafe@alpha
I still can't get it to work in chrome.
This is how I reproduce the error:
.1. Install testcafe@alpha
$ npm install testcafe@alpha
.2. Create a simple test case:
// testcafe/test.js
fixture `Example page`
.page `https://devexpress.github.io/testcafe/example`;
test('Do some test', async t => {
await t.click('#remote-testing');
});
.3. Execute the test case in Chrome:
$ node_modules/.bin/testcafe chrome testcafe
Running tests in:
- Chrome 54.0.2840 / Mac OS X 10.12.1
Example page
✖ Do some test
1) Error on page "http://devexpress.github.io/testcafe/example/":
Uncaught SyntaxError: Unexpected token )
Browser: Chrome 54.0.2840 / Mac OS X 10.12.1
1 |fixture `Example page`
2 | .page `https://devexpress.github.io/testcafe/example`;
3 |
4 |test('Do some test', async t => {
> 5 | await t.click('#remote-testing');
6 |});
7 |
at <anonymous> (testcafe/test.js:5:17)
at step
(node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at <anonymous>
(node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14)
at Promise.F [as null]
(node_modules/core-js/library/modules/_export.js:35:28)
at <anonymous>
(node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
at test (testcafe/test.js:6:42)
at tryCatch
(node_modules/regenerator-runtime/runtime.js:62:40)
at GeneratorFunctionPrototype.invoke [as _invoke]
(node_modules/regenerator-runtime/runtime.js:336:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next]
(node_modules/regenerator-runtime/runtime.js:95:21)
at step
(node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
1/1 failed (1s)
I'm using node v6.6.0.
Okey, I think I found the problem. I realised that it worked if I used Chrome in incognito mode so I started to disable all my addons and found that if I disable Augury the test completes successfully.
@tjoskar thanks for the detailed information. You are right, some addons can break TestСafe behavior.
Is there a way to start Chrome without any plugins? So this would be the fastest way to run the tests and without any side effects.
It's a good question. Can one pass arguments to the browser like --disable-extensions, --show-fps-counter and so on?
@tjoskar It will be possible soon, see: https://github.com/DevExpress/testcafe/issues/905
Currently there is some tricky (undocumented) way to specify browser parameters, @AndreyBelym could help.
Also, I guess we should automatically disable extensions like we going to do with wizards: https://github.com/DevExpress/testcafe-browser-tools/issues/102
Hello, currently you can pass a serialized JSON object with keys path and cmd to the path: provider, but you have to properly escape quotes, e.g. for bash:
testcafe path:\''{"path":"/usr/bin/chromium-browser","cmd":"--disable-extensions --no-first-run --new-window"}'\' test.js
I'm implementing a simplified syntax for it in this iteration, so it's going to be soon just
testcafe 'path:/usr/bin/chromium-browser --disable-extensions --no-first-run --new-window' test.js
I'm getting this problem out of the gate on an install with these version params:
testcafe chrome tests/test1.js
Running tests in:
- Chrome 57.0.2987 / Mac OS X 10.12.4
Getting Started
✖ My first test
1) Error on page "https://localhost:8091/login":
Uncaught SyntaxError: Unexpected token (
Browser: Chrome 57.0.2987 / Mac OS X 10.12.4
1/1 failed (7s)
TestCafe version 0.14.0
Test Code:
fixture `Login`
.page `http://localhost:8091`;
test('My first test', async t => {
});
With this command:
testcafe chrome tests/test1.js
Hi @eriklharper!
It's hard to determine the cause of the problem because we don't see your page markup. Could you please provide the page markup, or page url, if it's deployed ?
Here's the public URL of the website I'm trying to test: https://staging-edit.meridianapps.com/login
@eriklharper, thank you for information! I have reproduced problem and created separate issue, you can track it here,
As a temporary workaround you can use " --skip-js-errors" launch option:
testcafe --skip-js-errors chrome test.js
@georgiy-abbasov This worked for me, but what's strange is that in incognito mode I am not running any extensions already, on top of that my page is not throwing any errors whatsoever yet I would get this same error Uncaught SyntaxError: Unexpected token ) unless I skip the js errors.
I'm running:
testcafe: 0.17.0
chrome: 59.0.3071
@LanFeusT23 Have you tried to run it in any other browsers?
Yeah:
Chrome error:
Uncaught SyntaxError: Unexpected token )
Firefox error:
SyntaxError: expected expression, got ')'
Firefox was a brand new install so no extensions or anything on it, also running in incognito.
@LanFeusT23 From your description it seems there is a bug in our code. Is it possible to share a link to your page with us? With it we can reproduce and fix the problem. If your project is not public we can use ngrok. With it you can share a link to your local page. To be confident we can use email ([email protected]) to discuss it.
If these variants are not appropriate for you we'll ask you to provide us with the error callstack from the browser. To get it perform the following steps:
1) clone the testcafe-hammerhead repo (https://github.com/DevExpress/testcafe-hammerhead);
2) call npm install;
3) install gulp globally (if it's not installed on your machine);
4) run gulp playground --dev (a new browser window will be opened);
5) open dev tools in the browser and enter your page url into the input;
6) see it there a Uncaught SyntaxError: Unexpected token ) error in dev tools. If yes then provide us with its stack
Unfortunately I can't provide the code itself, but here's the stack after doing the gulp playground
Uncaught SyntaxError: Unexpected token )
at parse (hammerhead.js:1)
at t._onMessage (hammerhead.js:4)
at r (hammerhead.js:9)
at r (hammerhead.js:4)
at hammerhead.js:4
parse @ hammerhead.js:1
t._onMessage @ hammerhead.js:4
r @ hammerhead.js:9
r @ hammerhead.js:4
(anonymous) @ hammerhead.js:4
VM229:1 Uncaught SyntaxError: Unexpected token )
at parse (hammerhead.js:1)
at t._onWindowMessage (hammerhead.js:4)
at r (hammerhead.js:9)
at o (hammerhead.js:4)
at hammerhead.js:4
parse @ hammerhead.js:1
t._onWindowMessage @ hammerhead.js:4
r @ hammerhead.js:9
o @ hammerhead.js:4
(anonymous) @ hammerhead.js:4
It appears to throw on a parse function that tries to do: eval("("+text+")") where the text is an empty string:

/cc @churkin @miherlosev @LavrovArtem Guys, what do you think about it? Have you faced with such issue?
@LanFeusT23 thanks for your info but we need some more to try to identify the cause of the problem.
Could you please perform the following steps:
playground task again but with the --dev option now: gulp playground --dev;VM350:1 link (it's on your screenshot). A script should be opened in a new dev tools tab. Share the script content with us (via gist.github.com or privately);JS. Take a look at each script response. Is it started with the /*hammerhead|script|start*/ comment (excluded hammerhead.js, task.js, iframe-task.js)? If some script is not started with it please share its content with us (see - https://www.screencast.com/t/oiZgqFpY).The script content for VM350:1 is quite simple:
()
That's all. As for the only file not started with hammerhead, it's our vue.bundle.js file that webpack creates (non minified/optimized yet, but even the minified/optimized version has the same issue), I sent you an email with the link.
Thanks @LanFeusT23, I've got it. We'll investigate it
I've reproduced the problem and created a separate issue in our proxy repository - https://github.com/DevExpress/testcafe-hammerhead/issues/1260.
Still occurring for me.
https://github.com/DevExpress/testcafe/issues/1448#issuecomment-463527670
The TestCafe "Getting Started" sample works if you insert parentheses like so:
fixture ('Getting Started')
.page ('http://devexpress.github.io/testcafe/example');
Most helpful comment
@eriklharper, thank you for information! I have reproduced problem and created separate issue, you can track it here,
As a temporary workaround you can use " --skip-js-errors" launch option:
testcafe --skip-js-errors chrome test.js