Debugging Browser-based Tests

Integration tests can be difficult to debug, in particular when running on a remote machine. We recommend two options for debugging your browser-based tests on Scrutinizer.

Save screenshots as artifacts

Each build can generate build artifacts which we will persist when tearing down the VM. This allows you to save screenshots as part of your build, and to view them when your build finishes.

Saving screenshots is a built-in feature in webkit and Selenium, and supported by most test runners:

Simply save the screenshots to the ~/artifacts directory, and we will pick them up automatically.

Watch the browser via VNC

Note: This only works if you are using a driver that controls a real browser like Selenium, but not with headless drivers like phantomjs.

VNC allows you to view and interact with the browser that is running your tests. Setting this up is simple:

Prepare the remote VM

In order to reach the VM, start your build in SSH debug mode so that we can establish an SSH connection.

Next, we need to forward the VNC server port 5902 of the VM to a port of your local machine (we use port 5901):

ssh -p PORT [email protected]_ADDRESS -L 5902:localhost:5901

Make sure to replace PORT, USER and IP_ADDRESS with the information displayed on the build page.

Last, start the VNC server on the VM:

vnc4server -geometry 1280x1024 -depth 24; export DISPLAY=:1.0
Tip: When asked for a password, you can choose a simple password like login123 as we have already secured the connection via SSH.

Prepare your local machine

We recommend installing the RealVNC viewer which is available on most platforms, but you can use any VNC viewer basically.

Once installed, we can connect with the viewer to localhost:5902.

Then, you can run your tests on the remote machine and watch your browser via VNC just as if it were running on your local machine.

Note: If you get any warnings about unsecured connections, you can safely ignore these as we are routing the traffic over the SSH tunnel and your VNC viewer is not able to detect that.