2

Setting up testcafe on a new version of SUSE OS. Running the testcafe getting started a test on SUSE using firefox:headless I get a long pause then the error :

testcafe firefox:headless test1.js --reporter=xunit

"ERROR The Firefox 66.0.0 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues."

Testcafe version: 0.23.3

Linux version: NAME="SUSE" VERSION="12 SP4" uname -a = "4.12.14-94.41-default"

Firefox version: 66.0.2

node.js version: v10.15.3

The same works fine with firefox if I don't run headless, the tests execute successfully without any error if I point the DISPLAY to ViewNow which allows X windows to DISPLAY the browser running on my PC, but I need headless for our automation framework.

Following the instructions on https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/ I can also use firefox -screenshot http://www.microfocus.com
which runs the browser in headless mode to access a Web page and captures a .png which shows the connection is successful so headless firefox can get to Web pages.

I have an older version of SUSE, testcafe, firefox which runs headless and works, so I know this used to work: Test cafe version: testcafe -v 0.18.6

Linux version: NAME="SUSE" VERSION="12 SP2" uname -a = "4.4.21-69-default"

Firefox version: 58.0.2

node.js version: v8.9.4

Expected result: Running tests in: - Firefox 66.0.0 / Linux 0.0.0

Getting Started ✓ My first test

1 passed (1s)

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Cuffy
  • 31
  • 6
  • 2
    Could you please try to connect Headless Firefox to TestCafe as a remote browser: https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#remote-browsers? You can start Firefox in a separate terminal window after executing the "testcafe remote ..." command. – Andrey Belym Apr 11 '19 at 12:37
  • I stated firefox in background pointing the DISPLAY to my PC as I don't have access to an X windows Display on the SUSE box. Ran testcafe remote firefox:headless test1.js --reporter=xunit Pasted the URL into the firefox browser and got : – Cuffy Apr 11 '19 at 14:48
  • Unable to connect Firefox cant establish a connection to the server at 10.120.79.52:41515. The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computers network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web. There is no firewall preventing access. – Cuffy Apr 11 '19 at 14:50
  • Perhaps this is something to do with the installation of Firefox on the SuSE Linux server. Although, as you say, having the DISPLAY set to your PC running an X server and not running in headless mode loads up the Firefox browser on your PC and the test script runs through ok. I came across this on Mozilla's site and wondering if it's the same problem of running in headless mode on Linux for which the bug report mentioned (bug 1372998) was raised - https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode#Troubleshooting_and_further_help (raised 2 years ago!) – nabeenj Apr 11 '19 at 22:48
  • Last entry in that bug was, a year ago, when Mozilla said "There are currently no immediate plans to work on this." What I don't understand is, if it is this issue, how come my older system of SUSE, firefox and Testcafe works? – Cuffy Apr 12 '19 at 09:16
  • Please try to perform the following steps: 1) Execute the `testcafe --hostname localhost --ports 9000,9001 remote test1.js` command in a remote session with your SUSE box. 2) Keep this session opened and start a new remote session. Execute `firefox -headless http://localhost:9000/browser/connect` in the new session. Collect and post here all terminal output produced by Firefox. – Andrey Belym Apr 18 '19 at 09:17
  • In session 1 I get: Using locally installed version of TestCafe. Connecting 1 remote browser(s)... Navigate to the following URL from each remote browser. Connect URL: http://localhost:9000/browser/connect CONNECTED Firefox 66.0.0 / Linux 0.0.0 Running tests in: - Firefox 66.0.0 / Linux 0.0.0 Getting Started – Cuffy Apr 30 '19 at 13:02
  • Then I connect with session 2, I get: *** You are running in headless mode. Then after about 5 minutes I get : [Parent 6837, Gecko_IOThread] WARNING: pipe error: Broken pipe: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 726 Killed – Cuffy Apr 30 '19 at 13:03
  • At which point session 1 recieves: ERROR The Firefox 66.0.0 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues. Type "testcafe -h" for help. – Cuffy Apr 30 '19 at 13:03
  • It looks like a problem with Marionette client that is used inside TestCafe to communicate with Firefox. Please try to reproduce the problem with the latest Firefox and TestCafe versions and inform us about your results. – mlosev May 02 '19 at 12:26
  • I am already using the latest testcafe and jsnode, (see above). The firefox is one version old 66.0.2 not 66.0.3, I'll install the latest and try again. – Cuffy May 02 '19 at 13:16
  • 1
    Problem solved. The installation I was using was not being updated because testcafe linked to an old .js Testcafe installed in /home1/hub/testbin/node-v10.15.3-linux-x64/bin/testcafe was a symbolic link to ../lib/node_modules/testcafe/bin/testcafe-with-v8-flag-filter.js* – Cuffy May 02 '19 at 15:49
  • 1
    This version never got updated from 0.0.23 when nmp install -g testcafe ran instead this was updated as /home1/hub/testbin/node-v10.15.3-linux-x64/lib/node_modules/testcafe/bin/testcafe.js but that never got execute permissions: -rwxr-xr-x 1 *** users 207 Oct 26 1985 testcafe-with-v8-flag-filter.js* -rw-r--r-- 1 *** users 59 Oct 26 1985 testcafe.js* (not sure why they are dated 1985 either??) I added execute permissions to testcafe.js and now testcafe -v gives 1.1.3 and headless is working. – Cuffy May 02 '19 at 15:49
  • Thanks for all of your help. – Cuffy May 02 '19 at 15:50
  • @Cuffy, Thank you for the update. I'm happy to hear that you have figured out how to resolve the issue. You might want to post your findings as an Answer to your own question, so other users may refer to it. – Alex Skorkin May 03 '19 at 10:43

1 Answers1

1

Testcafe installation issue caused older testcafe to be invoked after testcafe was updated: Testcafe installed in /home1/{id}/testbin/node-v10.15.3-linux-x64/bin/testcafe was a symbolic link to ../lib/node_modules/testcafe/bin/testcafe-with-v8-flag-filter.js* This version never got updated from 0.0.23 when nmp install -g testcafe ran instead this was updated as /home1/{id}/testbin/node-v10.15.3-linux-x64/lib/node_modules/testcafe/bin/testcafe.js but that never got execute permissions: -rwxr-xr-x 1 * users 207 Oct 26 1985 testcafe-with-v8-flag-filter.js* -rw-r--r-- 1 * users 59 Oct 26 1985 testcafe.js* (not sure why they are dated 1985 either??) I added execute permissions to testcafe.js and now testcafe -v gives 1.1.3 and headless is working.

Cuffy
  • 31
  • 6