Testcafe: Basic demo test does not work on chrome (OK with firefox)

Created on 23 Sep 2017  Â·  8Comments  Â·  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

bug

What is the current behavior?

demo test fails on chrome, it is OK on firefox

What is the expected behavior?

to be OK also on chrome

How would you reproduce the current behavior (if this is a bug)?

  • create test.js with demo code
  • write npm script in package.json
  • run the script from terminal: npm run test:e2e

Provide the test code and the tested page URL (if applicable)

Tested page URL:
"http://devexpress.github.io/testcafe/example/"

Test code

import { Selector } from 'testcafe'; // first import testcafe selectors

fixture `Getting Started`// declare the fixture
    .page `https://devexpress.github.io/testcafe/example`;  // specify the start page


//then create a test and place your code there
test('My first test', async t => {
    await t
        .typeText('#developer-name', 'John Smith')
        .click('#submit-button')

        // Use the assertion to check if the actual header text is equal to the expected one
        .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
});

package.json

...
"scripts": {
    ...
    "test:e2e": "testcafe chrome test/e2e/test.js"
    ...
  },
...

error message:

 Running tests in:
 - Chrome 61.0.3163 / Mac OS X 10.12.6

 Getting Started
 ✖ My first test

   1) Error on page "http://devexpress.github.io/testcafe/example/":

      Script error.

      Browser: Chrome 61.0.3163 / Mac OS X 10.12.6

          5 |
          6 |
          7 |//then create a test and place your code there
          8 |test('My first test', async t => {
          9 |    await t
       > 10 |        .typeText('#developer-name', 'John Smith')
         11 |        .click('#submit-button')
         12 |
         13 |        // Use the assertion to check if the actual header text is equal to the expected one
         14 |        .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
         15 |});

         at <anonymous> (/Users/.../test.js:10:10)
         at test (/Users/.../test.js:8:1)


   2) Error on page "http://devexpress.github.io/testcafe/example/":

      Script error.

      Browser: Chrome 61.0.3163 / Mac OS X 10.12.6



 1/1 failed (2s)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:e2e: `testcafe chrome test.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lucky/.npm/_logs/2017-09-23T17_29_49_628Z-debug.log

Specify your

  • operating system: Mac OS X 10.12.6
  • testcafe version: 0.17.2
  • node.js version: v6.11.3

Thanks

Auto-locked

Most helpful comment

Hello @luckylooke, there might be something with you profile, maybe some Chrome settings. I think so because chrome:headless uses a completely empty temporary profile and it works, but chrome --incognito doesn't. Until we are in process enabling empty profiles by default, you can use --user-data-dir=$SOME_DIR flag. E.g.:

mkdir /tmp/temp-chrome-profile
testcafe 'chrome --user-data-dir=/tmp/temp-chrome-profile' test.js

All 8 comments

I have just tested with safari, chrome --incognito and chrome:headless.
chrome --incognito fails same way, but chrome:headless is OK, safari OK

Hi @luckylooke,

I've tried to reproduce the problem, but to no avail. Test passes on my Mac. According to a report a js-error occurs on the page when typing text in the input. Please, use chrome dev-tools to try to catch this error and send us your results. It will be very useful for solving the problem.

Thanks!

I suppose some extension breaks TestCafe behavior in your Chrome. Please check whether some extensions are enabled in the incognito mode in your browser. Disable them and try to rerun the test.
Meanwhile, we are going to run tests with a clean browser profile by default since the [email protected] version (see #1792). It should resolve the problem.

@AlexanderMoskovkin I have some extensions but none of them is enabled in incognito mode.
@churkin no error in dev tools console. I was also trying to step through but it is overwhelming call stack and when I try to stop just on exceptions. There are plenty of handled exception. It is impossible to distinguish which one is the cause. :/

Hello @luckylooke, there might be something with you profile, maybe some Chrome settings. I think so because chrome:headless uses a completely empty temporary profile and it works, but chrome --incognito doesn't. Until we are in process enabling empty profiles by default, you can use --user-data-dir=$SOME_DIR flag. E.g.:

mkdir /tmp/temp-chrome-profile
testcafe 'chrome --user-data-dir=/tmp/temp-chrome-profile' test.js

@AndreyBelym your hack works.. maybe it is because I have multiple profiles in chrome? I don't know, but thanks, now I can test on chrome too ;) Should I close this? Or do you plan to fix it on your side?

@luckylooke, Great! Since the issue is resolved I close it in favor of #1623.

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jvanoostveen picture jvanoostveen  Â·  4Comments

multivoltage picture multivoltage  Â·  3Comments

devmondo picture devmondo  Â·  3Comments

Turkirafaa picture Turkirafaa  Â·  3Comments

Lukas-Kullmann picture Lukas-Kullmann  Â·  3Comments