E2E testing, Continous integration with Jenkins

We will use Jenkins server with docker from previous article. Our goal for today will be run E2E test with using framework nightwatchjs+ cucumberjs+selenium on Jenkins server.

Let’s get started.

We have:

go to the http://localhost:1111/jenkins/pluginManager/ and login with user name and password “admin

We need install following plugin:

after restart go to the http://localhost:1111/jenkins/blue and login again with name and password “admin

Now we can create and run new pipeline

Jenkins Blueocean – New Pipeline

and that’s it.

As you can see we have two branches

For Master Branch we are using Cucumber and that’s the reason why we needed to install cucumber-report plugin.

We can see all is green, but when we want check cucumber report we need to have a look somewhere else.

Click on go to classic, and we switch to old jenkins style

classic view of jenkins jobs
Cucumber report in Jenkins

Explanation and more details

Selenium Webdriver vs Selenium Server

Selenium Webdriver
In case that I want to start e2e test localy (on my PC) I need to have installed. I need specific version of internet browser agains of specific version webdriver.

source https://nightwatchjs.org/gettingstarted/#overview-of-webdriver

Selenium server

  • internet browser (ie. Chrome)
  • selenium server (Grid)

source https://nightwatchjs.org/gettingstarted/#nightwatch-selenium-server

In my case I will use npm package “selenium-standalone“. So I have docker image with node 10, and during the build process of the image.
I install selenium- standalone with this command

$npm install selenium-standalone@latest -g
$selenium-standalone install

during “selenium-standalone install” is downloaded selenium-server-standalone-3.141.5.jar and chrome driver chromedriver_linux64.zip (v.2.43).

I also need to install internet browser chrome. But always I need correct version Chrome Browser and Chromedriver, so in my Dockerfile during the build process I install latest version chromedriver with latest version Chrome browser.

Checking correct version ChromeDriver and Chrome browser inside docker container.

$docker run -it --name docker-selenium devuserpp/selenium-chromless bash
or later if "docker-selenium" already running
$docker exec -it docker-selenium bash
$chromedriver --v
$google-chrome --version

first 3 groups of numbers should be the same, i.e. my example

ChromeDriver=80.0.3987.106
Google Chrome=80.0.3987.132

current ChromeDriver version you can check here

my Dockerfile.

So Inside my docker image I have:

  • is installed latest stable version of internet browser Chrome
  • is installed latest version of ChromeDriver
  • is installed install openjdk-8-jre (need for run /usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/3.141.5-server.jar)
  • is installed latest version “selenium-standalone

becouse Nightwatch has own runner I do not need to start Selenium server at all.

All configuration is included here in file ” nightwatch.conf.js

Leave a Reply

Close Menu