Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jenkins, Protractor and Headless Chrome Browser Setup on Ubuntu 14.04

Jenkins, Protractor and Headless Chrome Browser Setup on Ubuntu 14.04

Update Ubuntu

sudo apt-get update
sudo apt-get upgrade

Install Java

sudo apt-get install default-jre

Install Jenkins

wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

Install Node.js and npm

curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs

Install Protractor and Selenium WebDriver

sudo su
npm install protractor -g
webdriver-manager update
ln /usr/lib/node_modules/protractor/selenium/chromedriver /usr/bin/chromedriver
exit

If protractor installation fails with an error, perform follwoing steps instead of above steps

sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules
npm install protractor -g
sudo webdriver-manager update
sudo ln /usr/lib/node_modules/protractor/selenium/chromedriver /usr/bin/chromedriver

Setup Headless Chrome browser

echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get install google-chrome-stable
sudo apt-get install xvfb gtk2-engines-pixbuf
sudo apt-get install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get install imagemagick x11-apps
Xvfb -ac :99 -screen 0 1280x1024x16 &
disown $1
export DISPLAY=:99
@igama

This comment has been minimized.

Copy link

@igama igama commented May 19, 2016

Thanks! 👍

@constan4in

This comment has been minimized.

Copy link

@constan4in constan4in commented May 23, 2016

You've forgotten to add the sudo apt-get install npm to "Install Node.js and npm" section.

@ilyakorzh

This comment has been minimized.

Copy link

@ilyakorzh ilyakorzh commented Jun 14, 2016

If your install NodeJS v6 - not need install NPM

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt-get install -y nodejs

Install process execute install NodeJS and npm

@clpalmer

This comment has been minimized.

Copy link

@clpalmer clpalmer commented Apr 6, 2017

Old thread, but to save someone else the headache later:
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
add the arch in there as google took out the x86 version of chrome and apt will complain otherwise.

@elgalu

This comment has been minimized.

Copy link

@elgalu elgalu commented Apr 21, 2017

FYI chrome --headless has come to stay: http://stackoverflow.com/a/43542422/511069

@ezuk

This comment has been minimized.

Copy link

@ezuk ezuk commented Jan 17, 2018

@clpalmer - great tip!

@tasmo

This comment has been minimized.

Copy link

@tasmo tasmo commented Jan 18, 2018

Just to add to @clpalmer:
It's more likely to use the /etc/apt/sources.list.d/ folder. The resulting command is

echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/chrome.list
@aasimali

This comment has been minimized.

Copy link

@aasimali aasimali commented Mar 20, 2018

Can somebody explain to me the entire process step by step including the shell command needs to be added in the Jenkins while creating the build to run the protractor test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.