We will provide you with a machine IP address which is your Ubuntu Virtual Machine (VM) for the duration of tonight's DevOps Playground.
-
To access your machine first open a Terminal/Command window and enter the following command:
ssh devops@your.Ip
-
You will be asked about whether you wish to proceed, type
yes
and press return. -
You will be prompted for a password. The password for all machines is
playground
.
- Docker - https://docs.docker.com/
- NodeJs - https://nodejs.org/en
- NPM - https://www.npmjs.com/
To install Zalenium and Selenium for Docker.
-
To install docker-selenium run the following command in your ssh session:
docker pull elgalu/selenium
-
To install Zalenium, run the following command in your ssh session:
docker pull dosel/zalenium
-
In your ssh terminal/command window enter the following:
docker run --rm -ti --name zalenium -d -p 4444:4444 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/videos:/home/seluser/videos \ --privileged dosel/zalenium start
The above command runs Zalenium and points your tests towards port 4444.
It allows Zalenium to create more Selenium Grid docker containers.
It sets a local temporary location for videos to be saved.
Running it privileged is optional, but it does help to speed up the registration of containers. -
After a few seconds, in your browser on your local machine, access http://yourIp:4444/grid/admin/live?refresh=5. You should see two Selenium Grid containers with one instance each of Firefox and Chrome. This is by default.
-
You first want to create a directory for the Playground repository to be pulled into. Enter the following command into your ssh session:
mkdir myProject
-
Change directory to your 'myProject' folder:
cd myProject
-
We now want to clone the DevOps Playground repository into our new folder within our ssh session. Perform the following:
git clone https://github.com/ecsdigital/devopsplayground-edi-8-zalenium.git
-
You now want to change directory into the devopsplayground repository you just cloned.
cd devopsplayground-edi-8-zalenium
-
To run the tests, enter the following command
./node_modules/.bin/wdio wdio.conf.js
-
Whilst this is running, you can observe the number of Selenium Grid containers being created at: http://yourIP:4444/grid/admin/live?refresh=5 as the tests are being run.
-
Once the tests are finishing you can observe, on the same page, the number of instances scale down.
-
You can also view recorded videos by accessing http://yourIp:4444/dashboard. This provides you with a history of the tests which have been run and their status.
-
To view logs for each test, click on the instance from the left hand menu. From there you can view a video recording of the test as well as Selenium and Browser log information.
- Once your tests are finished you will probably want to shut down Zalenium. To do this enter the following command:
docker stop zalenium
To verify that this has closed correctly, access the Console page here: http://yourIp:4444/grid/console . You should have a page not found error.