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:
- Automatically on failure using Behat and Mink
- Automatically on failure using Cucumber
- Manually with Selenium
Simply save the screenshots to the
~/artifacts directory, and we will pick them up automatically.
Watch the display in your own browser¶
You can view your UI tests right in your browser, when running an SSH debug session.
As soon as the test container is prepared, a Display tab opens on the right side:
Interact with the display via VNC¶
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 set-up a SSH tunnel that forwards the local port
5902 of localhost to port
5902 of the build environment:
ssh -p PORT USER@IP_ADDRESS -L 5902:localhost:5902
Make sure to replace
IP_ADDRESS with the information displayed on the build page.
Last, start the VNC server on the VM:
x11vnc -rfbport 5902
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
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.