Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save praphull27/6950d2a6c76a6e68acb7 to your computer and use it in GitHub Desktop.

Select an option

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
@igama

igama commented May 19, 2016

Copy link
Copy Markdown

Thanks! 👍

ghost commented May 23, 2016

Copy link
Copy Markdown

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

@ilyakorzh

Copy link
Copy Markdown

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

clpalmer commented Apr 6, 2017

Copy link
Copy Markdown

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

elgalu commented Apr 21, 2017

Copy link
Copy Markdown

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

@ezuk

ezuk commented Jan 17, 2018

Copy link
Copy Markdown

@clpalmer - great tip!

@tasmo

tasmo commented Jan 18, 2018

Copy link
Copy Markdown

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

aasimali commented Mar 20, 2018

Copy link
Copy Markdown

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