2

I use testcafe to run my E2E tests. Everything works when I run testcafe using command line. When tests are run by a build agent (a windows service) tests hang but only on Internet explorer (chrome and FF work). I managed to reproduce that issue on Win10 and WinServer2012. The problem seem to occur only when Internet Explorer is launched in so called session zero (GUI app launched by a windows service). I already tried different users (LOCALSYSTEM and a local account with admin rights) but always I get the same result - tests hang. Everything works when I run browser via login/psexec/runas. I already also tried to play with IE security settings, my firewall and anitvirus. But problem still persists. The last option that I tired was to use VS debugger to connect to the browser and check console for js errors - but no errors where shown.

Did anyone has this kind of problems before? I will appreciate any tips how to debug this issue - because I run out of any more ideas....

Log from testcafe:

 UnhandledPromiseRejectionWarning: Error: The IE 11.0.0 / Windows 10.0.0 browser disconnected. This problem may appear when a brwser hangs or is closed, or due to network issues.
    at Timeout.<anonymous> (C:\Users\xxx\source\repos\ClientPortalSmokeTests\node_modules\testcafe\lib\browser\connection\index.js:23:34)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
(node:23936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async funcion without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handld will terminate the Node.js process with a non-zero exit code.
Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47

2 Answers2

0

I can see two options.

First, try enabling the "Allow service to interact with desktop" option in your service properties under the LogOn tab.

If this does not help, try running your services in a non-zero session. The following thread may provide more details on how to accomplish this:

Creating a process in a non-zero session from a service in windows-2008-server?

Also, as far as I know, Microsoft's position is to avoid running UI applications from windows services. It is considered bad practice. Here is some advice on this matter: Visible UI testing using self-hosted Windows agents.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
  • I already tried that without any success. TestCafe does not use any drivers that need to interact with a browser windows (with the exception of tools used to take screenshots). Instead TC adds its own JS files to you application by exposing you application via proxy. – Marcin Chwedczuk Nov 28 '18 at 14:28
0

I encountered the similar problem . My tests hang on IE 11.

I deleted all temporary files from IE11(via Internet options -> Delete all temporary files) and my tests are run again. After a while tests start to hang again.

Danilo
  • 43
  • 4