Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save praphull27/6950d2a6c76a6e68acb7 to your computer and use it in GitHub Desktop.
Save praphull27/6950d2a6c76a6e68acb7 to your computer and use it in GitHub Desktop.
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
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
@clpalmer
Copy link

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
Copy link

elgalu commented Apr 21, 2017

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

@ezuk
Copy link

ezuk commented Jan 17, 2018

@clpalmer - great tip!

@tasmo
Copy link

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
Copy link

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