Skip to main content

Linux example

Prepare Linux droplet on DigitalOcean#

Create and sign in to droplet on DigitalOcean

DigitalOcean Droplets are simple, scalable virtual machines.

  • Start on and sign up
  • Create droplet Droplet is only business name for virtual machine
  • Choose an image > Marketplace select Docker 19.03.1 on OS Ubuntu 18.04 or newer
  • Choose a plan select Shared CPU - Basic
  • Select 8GB a 4CPUs
  • Choose a datacenter Frankfurt 1
  • Add your SSH key or choose Password option and create your root password and save it (You will not be sent an email containing the password)
  • Click on Create Droplet button

Wait for your virtual machine (alias droplet) is created.

Azure deployment

  • Use your ssh client for log into droplet. For example on MacOSX - open terminal an run ssh root@
    • Use password to your private key or your root password.
    • Always use root as username.
  • And check, that docker is ready
# run this command
docker run hello-world
# this is how the output should look like
Hello from Docker!
This message shows that your installation appears to be working correctly.

Create docker network#

User-defined bridges provide automatic DNS resolution between containers

docker network create canary

Canarytrace and selenium will be created in the same network and they will recognize each other by their container name

Run Selenium standalone#

docker run --name selen --net canary -d -p 5902:5900 -p 4444:4444 -p -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.141.59-20200730
  • Open documentation for more information.
  • Open url <ip-your-droplet:4444 in your browser, for example and you should see message Selenium Standalone v.3.141.59

Create your first easy test case#

Go to your home directory and create directory with name demo

cd ~/ && mkdir demo && cd demo

Create an empty file and open it via program vim

touch smoke.js
vim smoke.js
  • press the key i for insert mode

Paste to smoke.js first test case.

// Save this script to smoke.js
describe('Smoke monitoring on', () => {
describe('HomePage', () => {
it('open', () => {
const title = 'Electric Cars, Solar & Clean Energy | Tesla'
const titleElm = $(`//title[contains(text(),"${title}")]`)
expect(titleElm.waitForExist({timeoutMsg: "Element title not found. The page couldn't be loaded in time."}))
  • press the key escape on your keyboard, write : followed by wq and press enter to save and exit from vim editor
  • this test script is based on v6 and you can extend the test script.

Create bash script runner#

  • This file simplifies startup of Canarytrace runner.
  • Create an empty file and open it via program vim
  • press the key i for insert mode
# Save this script to
docker run --name canary --rm -ti \
-e SPEC=smoke.js \
--net canary \
-v $(pwd):/tmp/canary-tests \
  • press the key escape on your keyboard, write : followed by wq and press enter to save and exit from vim


  • docker run --name canary --rm -ti run a docker container with the name canary, output will be printed to stdout and the container will be deleted at the end of the test.
  • -e SPEC=smoke.js define your test case.
  • -e AT_DRIVER_HOST_NAME=selen name container with selenium standalone
  • --net canary network name
  • -v $(pwd):/tmp/canary-tests mount place when I'm now and where I have a tests to path in the docker container
  • container image in format maintainer/name_docker_image:version. Check out repository for latest docker image

Your directory looks like this

ls -lah
total 16
drwxr-xr-x 4 rdpanek staff 128B 10 čvc 19:14 .
drwxr-xr-x 6 rdpanek staff 192B 10 čvc 17:14 ..
-rwxr--r-- 1 rdpanek staff 234B 10 čvc 19:14
-rw-r--r-- 1 rdpanek staff 472B 10 čvc 17:17 smoke.js

Run your first test case#

Make executable.

chmod u+x

Run Canarytrace with test case


Output from Canarytrace ends as follows

[chrome 76.0.3809.87 linux #0-0] Spec: /tmp/canary-tests/smoke.js
[chrome 76.0.3809.87 linux #0-0] Running: chrome (v76.0.3809.87) on linux
[chrome 76.0.3809.87 linux #0-0] Session ID: 3d6139ff33294d71664603e6613c3a05
[chrome 76.0.3809.87 linux #0-0]
[chrome 76.0.3809.87 linux #0-0] Smoke monitoring on
[chrome 76.0.3809.87 linux #0-0] HomePage
[chrome 76.0.3809.87 linux #0-0] ✓ open
[chrome 76.0.3809.87 linux #0-0]
[chrome 76.0.3809.87 linux #0-0] 1 passing (2.2s)
Spec Files: 1 passed, 1 total (100% completed) in 00:00:04

When you are done using Canarytrace

Stop the selen container

$ docker container stop selen

and remove user-defined bridge canary

docker network rm canary
  • This demo is available in a git repository [] - Can't find link you can checkout on aaa2790 revision
  • Don't forget to delete the virtual machine (=droplet) when no longer needed