Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic demo test does not work on chrome (OK with firefox) #1810

Closed
luckylooke opened this issue Sep 23, 2017 · 8 comments
Closed

Basic demo test does not work on chrome (OK with firefox) #1810

luckylooke opened this issue Sep 23, 2017 · 8 comments
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.

Comments

@luckylooke
Copy link

luckylooke commented Sep 23, 2017

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

@luckylooke
Copy link
Author

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

@churkin
Copy link
Contributor

churkin commented Sep 24, 2017

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!

@AlexanderMoskovkin
Copy link
Contributor

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.

@luckylooke
Copy link
Author

@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. :/

@AndreyBelym
Copy link
Contributor

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

@luckylooke
Copy link
Author

luckylooke commented Sep 25, 2017

@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?

@AlexanderMoskovkin
Copy link
Contributor

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

@lock
Copy link

lock bot commented Mar 28, 2019

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.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.
Projects
None yet
Development

No branches or pull requests

4 participants