Closed track0x1 closed 7 years ago
Please make sure you are setting a DISPLAY
environment variable that will be shared by Xvfb and karma
. Here's the typical Travis CI setup:
and here it is working in this very repo with Travis CI (uses default npm test
via Travis CI):
https://github.com/twolfson/karma-electron/blob/5.1.1/.travis.yml#L16-L22
There's also a cleaner variant suggested by Electron's docs:
https://github.com/electron/electron/blob/v1.4.10/docs/tutorial/testing-on-headless-ci.md
I have DISPLAY
defined and I can tell the display is configured properly because I can run firefox
without an error. but this is what I see when I try karma:
$ ps -a
PID TTY TIME CMD
2511 tty1 00:00:00 bash
13232 pts/1 00:00:00 Xvfb
13336 pts/1 00:00:00 ps
$ echo $DISPLAY
:99.0
$ ./node_modules/.bin/karma start ./karma.config.js --single-run
05 12 2016 11:27:27.981:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
05 12 2016 11:27:27.983:INFO [launcher]: Launching browser Electron with unlimited concurrency
05 12 2016 11:27:28.085:INFO [launcher]: Starting browser Electron
05 12 2016 11:27:28.201:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.849:INFO [launcher]: Trying to start Electron again (1/2).
05 12 2016 11:27:28.889:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.910:INFO [launcher]: Trying to start Electron again (2/2).
05 12 2016 11:27:28.947:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.952:ERROR [launcher]: Electron failed 2 times (cannot start). Giving up.
Maybe try running the electron executable directly to see if there's a
better error message? It should be available at
./node_modules/.bin/electron
iirc
On Dec 5, 2016 8:30 AM, "Tom B" notifications@github.com wrote:
I have DISPLAY defined and I can tell the display is configured properly because I can run firefox without an error. but this is what I see when I try karma:
$ ps -a PID TTY TIME CMD 2511 tty1 00:00:00 bash 13232 pts/1 00:00:00 Xvfb 13336 pts/1 00:00:00 ps
$ echo $DISPLAY :99.0
$ ./node_modules/.bin/karma start ./karma.config.js --single-run 05 12 2016 11:27:27.981:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/ 05 12 2016 11:27:27.983:INFO [launcher]: Launching browser Electron with unlimited concurrency 05 12 2016 11:27:28.085:INFO [launcher]: Starting browser Electron 05 12 2016 11:27:28.201:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.849:INFO [launcher]: Trying to start Electron again (1/2). 05 12 2016 11:27:28.889:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.910:INFO [launcher]: Trying to start Electron again (2/2). 05 12 2016 11:27:28.947:ERROR [launcher]: Cannot start Electron
05 12 2016 11:27:28.952:ERROR [launcher]: Electron failed 2 times (cannot start). Giving up.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/twolfson/karma-electron/issues/17#issuecomment-264901739, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3FWLcBSbXMlFhg35iqaRT14nEOa16Lks5rFDwQgaJpZM4LC6lL .
Sweet! Found out that I needed to install libXss. Did that and it works! Thanks :)
Here is the list of dependencies in Debian (from https://github.com/segmentio/nightmare/issues/224#issuecomment-141575361):
xvfb
libgtk2.0-0
libgconf-2-4
libasound2
libxtst6
libxss1
libnss3
Here is a Dockerfile with the dependencies for CentOS. I had to install the following dependencies in CentOS 7:
yum install -y \
libX11-devel.x86_64 \
pixman-devel.x86_64 \
libdrm-devel.x86_64 \
mesa-libGL-devel.x86_64 \
openssl-devel.x86_64 \
xorg-x11-xtrans-devel.noarch \
libXfont-devel.x86_64 \
libxkbfile-devel.x86_64 \
libpciaccess-devel.x86_64 \
xorg-x11-utils \
libXtst-devel.x86_64 \
libjpeg-turbo-devel.x86_64 \
gtk2-2.24.28-8.el7.x86_64 \
libXScrnSaver-1.2.2-6.1.el7.x86_64 \
GConf2-3.2.6-8.el7.x86_64 \
alsa-lib-1.1.1-1.el7.x86_64 \
'gnu-free-sans-fonts'
Trying to run my unit tests headless on a linux box with electron but this doesn't let electron launch in Xvfb. :(