Motivation: Manually testing web applications stinks. Selenium offers a pretty impressive way of performing actions and waiting on reactions to occur. To watch it fly by is amazing. For a long-running test, this can be a bit bothersome, as the windows can be popping up and stealing mouse focus and such. The following document explains how to get an automated test environment running with standard tools to help improve the experience of running the tests.
This has been tested/set up on Debian 8.
Install the following items:
sudo apt-get install xvfb
sudo apt-get install x11vnc
sudo apt-get install vncviewerIn one terminal, start xvfb:
user@host:~$ Xvfb :10 -ac -fbdir /var/tmp:10 specifies which display the X server should create.
-ac disables access control. Obviously, in an networked environment, this should be secured more tightly.
fbdir gives us a hook to start x11vnc against.
In another terminal, point to the Xvfb and start your test:
user@host:~$ export DISPLAY=:10
user@host:~$ ~/path/to/selenium/test/test.pyAt this point, your tests should be running happily. To check in on them, first, start a x11vnc server:
user@host:~$ x11vnc -display :10 -localhost -nopw -foreverIf this worked, you should see a PORT=5900 output to the terminal.
Now connect to your x11vnc server using vncviewer:
user@host:~$ vncviewer localhost:5900Now you should see your test running!
Attaching a display to a headless test may sound a bit crazy, but there are cases when a headless test may behave differently than a test run on the local X server, so this provides a way to peek into what's going on in a very minimal kind of way.