5

I have a suite of tests that, when running without concurrency, all pass fine. When I start running them with concurrency, they start to fall apart. I do not believe that the tests have inter-dependencies that are making them fail. When the test fails, it looks like this:

1) A JavaScript error occurred on
  "https://advancedaccount.wistia.io/stats/medias/lz45f2dspl#social".
     Repeat test actions in the browser and check the console for errors.
     If you see this error, it means that the tested website caused it. You can fix it or disable tracking JavaScript errors in TestCafe. To do the latter, enable the
  "--skip-js-errors" option.
     If this error does not occur, please write a new issue at:
     "https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md".

     JavaScript error details:
     undefined:
         No stack trace available

     Browser: Chrome 73.0.3683 / Linux 0.0.0
     Screenshot: /mnt/artifacts/screenshots/Media - Social Stats/142_errors/1.png

        497 |      .expect(socialStatsPage.youtube.likes.textContent).contains('5')
        498 |      .expect(socialStatsPage.youtube.shares.textContent).contains('100')
        499 |      .expect(socialStatsPage.youtube.views.textContent).contains('20')
        500 |      .expect(socialStatsPage.cardError.withProps('vendorName',
  'facebook').exists).ok()
        501 |      .expect(socialStatsPage.cardError.withProps('vendorName',
  'facebook').textContent).contains('It looks like your credentials might be outdated')
      > 502 |      .click(socialStatsPage.reauthorizeAccountLink)
        503 |      .expect(getLocation()).contains('www.facebook.com');
        504 |  });
        505 |
        506 |test
        507 |  .requestHooks(mockFacebookExpired)('Non-account owner expired token', async (t)
  => {

        at click (/usr/src/app/testcafe/tests/media/socialStats.js:502:8)

  2) Unhandled promise rejection:

     { code: 'E1', isTestCafeError: true, callsite: CallsiteRecord { filename:
  '/usr/src/app/testcafe/tests/media/socialStats.js', lineNum: 501, callsiteFrameIdx: 6,
  stackFrames: [ [CallSite], [CallSite], [CallSite], [CallSite], [CallSite], [CallSite],
  [CallSite], CallSite {}, [CallSite], [CallSite], [CallSite], [CallSite] ], isV8Frames: true
  }, errStack: 'undefined:\n    No stack trace available', pageDestUrl:
  'https://advancedaccount.wistia.io/stats/medias/lz45f2dspl#social' }

     Browser: Chrome 73.0.3683 / Linux 0.0.0

It also seems like when this happens, many if not all of the other concurrent browsers also crash with just the same Unhandled promise rejection failure diagnostic and nothing related to the test at all.

I have no idea where to start with debugging this. Any help would be great because I would like to get concurrency working. This occurs locally on my mac as well as in our CI setup.

What's also really odd is that when I look at the screenshot for the test failure, everything looks fine, so I can't figure out why it failed in the first place. Like I said, this test (and all the other ones) pass just fine if there is no concurrency flag.

Any tips would be much appreciated. I am using TestCafé v1.2.1.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
  • It looks like something within the `requestHooks()` function might have a race condition. What is the parameter you are passing named `mockFacebookExpired`. Maybe you are trying to obtain/get/collect/write some value inside of the requestHook and it is causing the error... The 2nd error (I believe) is a result of the first error. – TallKU Jun 24 '19 at 12:48
  • `mockFacebookExpired` is a mock following the recipe in the doc: `const mockFacebookExpired = RequestMock() .onRequestTo('https://advancedaccount.wistia.io/social_media_posts/11/stats.json') .respond({ error: { error_code: 'token_expired', message: 'Token is expired' } }) .onRequestTo('https://advancedaccount.wistia.io/social_media_posts/12/stats.json') .respond({ likes: 5, views: 20, shares: 100, comments: 0, });` That's in a completely separate test case than the one that is supposedly failing, though. – Samantha Blasbalg Jun 24 '19 at 14:29
  • Sorry about the badly formatted code above, you apparently can't put nice comment blocks in comments. To finish what I was saying, I don't see how line 507 is related to the failure on line 501. It does seem suspicious though that these are my only tests with mocks, and these are the only ones that are blowing up when I turn on the concurrency flag. – Samantha Blasbalg Jun 24 '19 at 14:32
  • 1
    Thank you for providing these details. But I'm afraid we can't come up with any ideas about the reasons for this behavior without a reproducible example. Could you please provide us with minimum set of testing files and the command/file that you use to start testing so that we'll be able to reproduce this problem on our side? – Helen Dikareva Jun 24 '19 at 16:36

0 Answers0