1

I'm using TestCafe for all my web tests and things were working fine until some configuration files were updated in the web project with some app cues to work. Most of the tests fail but not all which makes it really tricky to figure out what is the problem.

Here is the problem:

A function that specifies a selector can only return a DOM node, an array of nodes, NodeList, HTMLCollection, null or undefined. Use ClientFunction to return other values.

  Browser: Chrome 78.0.3904 / Mac OS X 10.14.6

     47 |    return Selector('div').withExactText('Project').nextSibling().find('div')
     48 |      .find(`${this.headLocator}.${Name}`);
     49 |  }
     50 |
     51 |  async BreakDownCount(Name) {
   > 52 |    return helper.getIntFromString(await this.BreakdownLocator(Name).textContent);

Here is the code:

    BreakdownLocator(Name) {
      return Selector('div').withExactText('Project').nextSibling().find('div')
      .find(`${this.headerLocator}.${Name}`);
  }
    async BreakDownCount(Name) {
    return helper.getIntFromString(await this.BreakdownLocator(Name).textContent);
  }

I have a feeling that it fails where I use async functions or promise as there are other tests that didn't fail but they don't have promise. I looked around and found this discussion but this didn't help. Any suggestions?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Psdet
  • 659
  • 9
  • 24
  • I couldn't see any problem in the code sample you provided. Can you create a simple project which we can use to reproduce the issue on our side? – aleks-pro Oct 30 '19 at 15:57
  • I'm not sure if I can really produce a small project to reproduce it. I know the main problem now and it is because `window.Appcues` which is a third party call is `undefined` even it seems `window` object is `undefined` as we tried to pass `null` into `window.Appcues` but it didn't work. – Psdet Oct 31 '19 at 13:39
  • This looks like a problem with TestCafe. If you can create a simple example that can be run locally, please create an issue in the TestCafe repository (https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md) and attach the example there. – mlosev Nov 01 '19 at 09:34

0 Answers0