xolvio / qualityfaster

An example project showing how to create robust and maintainable acceptance tests
262 stars 58 forks source link

Chrome or firefox can't find selenium on second time run #64

Closed Desperado closed 7 years ago

Desperado commented 7 years ago

Hello, this problem happens for me while running chimp e2e tests second, third or any other time, while on headless linux host, freshly built on docker. First time after image is built test runs well.

What should I do to forgot about this trouble? Why it looses to find the screen and open display?

[chimp][helper] setupBrowserAndDDP had error
{ [Error: Unable to connect to host localhost on port 7055 after 45000 ms. Firefox console output:
Error: cannot open display: :99
]
  message: 'Unable to connect to host localhost on port 7055 after 45000 ms. Firefox console output:\nError: cannot open display: :99\n',
  type: 'RuntimeError',
  seleniumStack: 
   { status: 13,
     type: 'UnknownError',
     message: 'An unknown server-side error occurred while processing the command.',
     orgStatusMessage: 'Unable to connect to host localhost on port 7055 after 45000 ms. Firefox console output:\nError: cannot open display: :99\n' } }
Error: Unable to connect to host localhost on port 7055 after 45000 ms. Firefox console output:
    at Object.Future.wait (/jenkins/workspace/docker_selenium/node_modules/chimp/node_modules/xolvio-sync-webdriverio/node_modules/fibers/future.js:449:15)
    at Object.<anonymous> (/jenkins/workspace/docker_selenium/node_modules/chimp/node_modules/xolvio-sync-webdriverio/node_modules/wdio-sync/build/index.js:345:27)
    at initBrowser (/jenkins/workspace/docker_selenium/node_modules/chimp/dist/lib/chimp-helper.js:161:17)
    at Object.setupBrowserAndDDP (/jenkins/workspace/docker_selenium/node_modules/chimp/dist/lib/chimp-helper.js:215:7)
    at /jenkins/workspace/docker_selenium/node_modules/chimp/dist/lib/cucumberjs/hooks.js:21:24
    at /jenkins/workspace/docker_selenium/node_modules/chimp/node_modules/meteor-promise/fiber_pool.js:32:39
    - - - - -
Error: cannot open display: :99

Here is also my xvfb start-stop script

XVFB=/usr/bin/Xvfb
XVFBARGS=":99 -screen 0 1600x1200x24 -fbdir /var/run -ac -nolisten tcp"
PIDFILE=/var/run/xvfb.pid
case "$1" in
  start)
    echo -n "Starting virtual X frame buffer: Xvfb"
    start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
    echo "."
    ;;
  stop)
    echo -n "Stopping virtual X frame buffer: Xvfb"
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
    echo "."
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
        echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
        exit 1
esac

exit 0
samhatoum commented 7 years ago

Seen this?

http://stackoverflow.com/questions/32151043/xvfb-docker-cannot-open-display

Also, you might have some luck deleting the tmp lock files that Xvfb leaves. See this search: https://www.google.com/#q=xvfb+tmp+lock+%22cannot+open+display%22

Desperado commented 7 years ago

Hi @samhatoum. Thanks. It seems I have fixed this particular error with downgrading FF to 47.0.1 http://seleniumsimplified.com/2016/06/use_selenium_webdriver_jar_locally/

But currently it fails just with this with no other information. [Error: Unable to connect to selenium] Can you provide some hints how to get more information what is getting there or maybe how to start selenium-standalone with debug mode over chimpJS? Thanks in advance

Desperado commented 7 years ago

@samhatoum I have resolved this problem. Basically after any chimp/selenium run in /tmp folder I have following directories:

.X11-unix 
hsperfdata_root
npm-3799-222f1b69

And they are there after xvfb stop as well. Only cleaning them together with cleaning /node_modules/chimp will make path to test successfully running again and connect to selenium on the same environment. Thanks for hints. Also, maybe not really related question, but how can I make only selenium-standalone module installed after deletion?

samhatoum commented 7 years ago

how can I make only selenium-standalone module installed after deletion?

I don't understand the question :)

Desperado commented 7 years ago

@samhatoum nevermind. Actually my problem is described here https://github.com/xolvio/chimp/issues/469. I often receive phantomjs2 installation error, which is part of the chimp, though I don't really use it. PhantomJS tar seems to be placed on some remote repo, and sometimes disconnection happen and installation fails. And it's like 30% chance of failing, especially during PDT daytime

samhatoum commented 7 years ago

ok, closing this. thanks

Desperado commented 7 years ago

thanks