Skip to content
Stephane PARIS edited this page Nov 26, 2013 · 2 revisions

Configuration of Xvfb on Debian 7

On Debian 7, you need to launch X virtual frame buffer with a init script to launch cucumber tests with javascript :

  1. Create a init script
vi /etc/init.d/Xvfb
#!/bin/sh
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop:
### END INIT INFO
N=/etc/init.d/Xvfb
set -e
case "$1" in
  start)
Xvfb :99 -screen 0 640x480x8 -nolisten tcp -fbdir /var/run -auth . >> /dev/null  &
;;
  stop|reload|restart|force-reload)
;;
  *)
echo "Usage: $N {start|stop|restart|force-reload}" >&2exit 1
;;
esac
exit 0
##### end of script ######
  1. Put the correct permissions
chmod 755 /etc/init.d/Xvfb
  1. If you want to start Xvfb automatically after boot
update-rc.d Xvfb defaults
  1. Start Xvfb
/etc/init.d/Xvfb start
  1. Define DISPLAY parameter for your session
echo 'export DISPLAY=:99' >> ~/.bashrc
  1. define manually the DISPLAY parameter
export DISPLAY=:99

After that, you can run 'bundle exec rake cucumber' with X virtual frame buffer