profile
viewpoint

Ask questionsJavaScript error with Apollo on page change since upgrading from 1.1.0 -> 1.1.2

What is your Test Scenario?

  • For a given user, log in and view a page

What is the Current behavior?

A JavaScript error appears on the Testcafe CLI when run against Chrome even when --js-skip-errors flag is added

What is the Expected behavior?

No errors shown (can confirm there are no errors when repeating this workflow on a local instance repeating the exact same steps)

What is your web application and your TestCafe test code?

Unfortunately I do not have anything publicly accessible since this is my company's code but I can show you the error I am receiving:

   1) - Error while restoring configuration after Role switch -
      A JavaScript error occurred on "http://localhost:3000/error".
      At this moment, TestCafe tracks uncaught JavaScript errors on the page. Try to manually perform the test
      scenario.
      If this error still occurs then it means you site has uncaught JavaScript errors. To disable JavaScript error
      tracking you can turn the --skip-js-errors option on.
      If the error occurs only with TestCafe then it is a bug. Write a new issue about it at:
      "https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md".

      JavaScript error details:
      Invariant Violation: Could not find "client" in the context or passed in as a prop. Wrap the root component in
      an <ApolloProvider>, or pass an ApolloClient instance in via props.
          at new InvariantError (http://localhost:3000/static/js/2.chunk.js:231617:24)
          at invariant (http://localhost:3000/static/js/2.chunk.js:231630:11)
          at getClient (http://localhost:3000/static/js/2.chunk.js:231822:86)
          at new Query (http://localhost:3000/static/js/2.chunk.js:232036:20)
          at constructClassInstance (http://localhost:3000/static/js/2.chunk.js:251232:22)
          at updateClassComponent (http://localhost:3000/static/js/2.chunk.js:254710:9)
          at beginWork (http://localhost:3000/static/js/2.chunk.js:255710:20)
          at performUnitOfWork (http://localhost:3000/static/js/2.chunk.js:259730:16)
          at workLoop (http://localhost:3000/static/js/2.chunk.js:259771:28)
          at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/2.chunk.js:239621:18)
          at HTMLUnknownElement.dispatchEvent (http://192.168.1.135:56419/hammerhead.js:6:21481)
          at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/2.chunk.js:239670:20)
          at invokeGuardedCallback (http://localhost:3000/static/js/2.chunk.js:239724:35)
          at replayUnitOfWork (http://localhost:3000/static/js/2.chunk.js:258954:9)
          at renderRoot (http://localhost:3000/static/js/2.chunk.js:259884:17)
          at performWorkOnRoot (http://localhost:3000/static/js/2.chunk.js:260808:11)
          at performWork (http://localhost:3000/static/js/2.chunk.js:260718:11)
          at performSyncWork (http://localhost:3000/static/js/2.chunk.js:260692:7)
          at requestWork (http://localhost:3000/static/js/2.chunk.js:260547:9)
          at scheduleWork (http://localhost:3000/static/js/2.chunk.js:260360:9)
          at Object.enqueueForceUpdate (http://localhost:3000/static/js/2.chunk.js:251078:9)
          at Query.push../node_modules/react/cjs/react.development.js.Component.forceUpdate
      (http://localhost:3000/static/js/2.chunk.js:272163:20)
          at Query._this.updateCurrentData (http://localhost:3000/static/js/2.chunk.js:231944:35)
          at Object.error (http://localhost:3000/static/js/2.chunk.js:231926:17)
          at notifySubscription (http://localhost:3000/static/js/2.chunk.js:300275:18)
          at onNotify (http://localhost:3000/static/js/2.chunk.js:300314:3)
          at SubscriptionObserver.error (http://localhost:3000/static/js/2.chunk.js:300371:7)
          at http://localhost:3000/static/js/2.chunk.js:80353:35
          at Array.forEach (<anonymous>)
          at Object.error (http://localhost:3000/static/js/2.chunk.js:80352:25)
          at QueryManager.<anonymous> (http://localhost:3000/static/js/2.chunk.js:81163:30)
          at step (http://localhost:3000/static/js/2.chunk.js:294693:19)
          at Object.next (http://localhost:3000/static/js/2.chunk.js:294623:14)
          at http://localhost:3000/static/js/2.chunk.js:294598:67
          at new Promise (<anonymous>)
          at __awaiter (http://localhost:3000/static/js/2.chunk.js:294575:10)
          at http://localhost:3000/static/js/2.chunk.js:81136:69
          at http://localhost:3000/static/js/2.chunk.js:81587:9
          at Array.forEach (<anonymous>)
          at http://localhost:3000/static/js/2.chunk.js:81586:10
          at Map.forEach (<anonymous>)
          at QueryManager.broadcastQueries (http://localhost:3000/static/js/2.chunk.js:81582:18)
          at http://localhost:3000/static/js/2.chunk.js:81107:27

Your Environment details:

  • testcafe version: 1.1.2
  • node.js version: 10.15.3 LTS
  • command-line arguments: testcafe chrome test/e2e/tests/ --js-skip-errors
  • browser name and version: Chrome 73.0.3683
  • platform and version: macOS 10.14.4
  • other: This worked totally fine on 1.1.0. Only when upgrading to 1.1.2 did this issue start occurring.
DevExpress/testcafe

Answer questions acconrad

@AlexKamaev I just re-ran and my yarn.lock as well as package.json did indeed confirm version 1.1.2. I should also say this only happens in Chrome. Running this in Safari works as intended.