OnetapInc / chromy

Chromy is a library for operating headless chrome. 🍺🍺🍺
MIT License
606 stars 41 forks source link

Unable to connect to Chromy port via Jenkins CI #83

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am working on a testing project that requires me to access multiple Chromy instances on various local ports, open a URL and take screenshots. I am able to do this successfully on my local machine, but not on Jenkins. Please help.

{ Error: connect ECONNREFUSED 127.0.0.1:9011
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1185:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 9011 }

I have debugged using this file - https://raw.githubusercontent.com/OnetapInc/chromy/master/examples/screenshot.js and have attached my findings.

I am using chromy 0.5.6 with google-chrome v62.0.3202.75, node v8.8.1 and npm 5.4.2 on Ubuntu 14.04.5

Chromy Connection Error Log.txt

dotneet commented 6 years ago

what user executes node process with jenkins? can the user access and execute chrome? at first, I recommend you to check the permissions and PATH environment variable.

ghost commented 6 years ago

what user executes node process with jenkins?

jenkins user

can the user access and execute chrome?

Yes

at first, I recommend you to check the permissions and PATH environment variable.

I have added chrome and chromy to my environment variables and my test folder has 777 permissions. I even tried running chromy using root access on my ci server. Still no luck.

dotneet commented 6 years ago

what if you manually execute chromy by jenkins user on console? or, what if add --disable-gpu to chromeFlags option.

ghost commented 6 years ago

I am able to start chromy using jenkins user and I am running it with --disable-gpu

This is what I am working with - https://github.com/garris/BackstopJS This is the console output when it tries to start chromy and take a screenshot - Starting Chromy: port:9347 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1366,738 I am getting ECONNREFUSED 127.0.0.1:9347

ghost commented 6 years ago

Closing due to lack of response. Have switched to phantomjs.