QA/Execution/Web Testing/Automation/Selenium Grid: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Replaced content with "Since November 2016, we are no longer actively using or maintaining a Selenium Grid instance.")
 
(87 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Selenium Grid ==
Since November 2016, we are no longer actively using or maintaining a Selenium Grid instance.
 
=== moz-grid-config ===
moz-grid-config is a project for managing our Selenium infrastructure. It includes the latest version of Selenium that we're using, and a mechanism for starting the hub/nodes. You can find documentation on moz-grid-config at the [https://github.com/mozilla/moz-grid-config github project page].
 
=== Starting the hub ===
# Connect to qa-selenium.mv.mozilla.com
# From a terminal (you can use SSH, VNC, or Screen):
 
    cd ~/moz-grid-config
    ant launch-hub
 
=== Starting nodes ===
# Connect to the appropriate machine.
# From a terminal (you can use SSH, VNC, or Screen):
 
    cd ~/moz-grid-config
    ant launch-node
 
=== Shutdown ===
* Terminate the process using CTRL+C
 
=== Architecture  ===
* '''qa-selenium'''.mv.mozilla.com (10.250.1.143)
** Mac Mini; 2.66 Ghz Intel Core 2 Duo; 8 GB
** Mac OS X 10.6.8
** Jenkins ([http://qa-selenium.mv.mozilla.com:8080/ dashboard])
** Selenium Grid hub ([http://qa-selenium.mv.mozilla.com:4444/grid/console console])
* '''qa-selenium2'''.mv.mozilla.com (10.250.1.144)
** Mac Mini; 1.83 Ghz Intel Core 2 Duo; 3 GB
** Mac OS X 10.6.8
* '''qa-selenium3'''.mv.mozilla.com (10.250.1.196)
** Mac Mini; 2.4 Ghz Intel Core 2 Duo; 4 GB
** Mac OS X 10.6.8
** VM: Windows 7 Professional (10.250.7.78)
* '''qa-selenium4'''.mv.mozilla.com (10.250.1.197)
** Mac Mini; 2.4 Ghz Intel Core 2 Duo; 4 GB
** Mac OS X 10.6.8
** VM: Windows 7 Professional (10.250.4.68)
* '''qa-selenium5'''.mv.mozilla.com (10.250.1.145)
** Mac Mini; 2.66 Ghz Intel Core 2 Duo; 8 GB
** Mac OS X 10.6.8
** VM: Windows 7 Professional (10.250.5.71)
* '''qa-selenium6'''.mv.mozilla.com (10.250.1.221)
** Mac Mini; 2.53 Ghz Intel Core 2 Duo; 4 GB
** Mac OS X 10.6.8
** VM: Windows 7 Professional (10.250.2.244)
* '''qa-selenium7'''.mv.mozilla.com (10.250.1.9)
** Mac OS X 10.7.4, 2.5 GHz Intel Core i5; 4GB 1067 MHz DDR3
** VM: Windows 7 SP1 pro
* [http://en.wikipedia.org/wiki/Tegra#Tegra_2_series Tegra 2] Boards
** 10.250.4.149
 
We have several Mac Minis running Selenium nodes, integrated via Jenkins Continuous Build Integration and Selenium Grid. All machines can be VNC'ed into from within the MV-Office Intranet (VPN if offsite). In order to start the entire system (Jenkins, Selenium Grid, and all VMs with Selenium RCs), ensure that all the Mac Minis are powered on and logged in.
 
=== Node configuration ===
Since Selenium 2.14.0 was released and allowed both RC and WebDriver nodes to co-exist each node runs the same configuration of browser nodes.
 
==== Firefox version policy ====
Due to rapid release, we have adopted the following policy for Firefox versions available on our Selenium infrastructure:
* Firefox Nightly
* Firefox Aurora
* Firefox Beta
* Firefox Release
* Firefox Release -1
* Firefox ESR
 
==== Selenium RC ====
* Firefox 3.6 (x5) - to be removed
* Firefox 7 (x5) - to be removed
* Firefox 8 (x5) - to be removed
* Firefox 9 (x5) - to be removed
* Firefox 10 (x5)
* Firefox 11 (x5) - to be removed
* Firefox 12 (x5)
* Firefox 13 (x5)
* Firefox Beta (x5)
* Firefox Aurora (x5)
* Firefox Nightly (x5)
* Internet Explorer 8 (x1)
 
==== WebDriver ====
Instances are currently set to 1 due to issues with focus.
 
* Firefox 3.6 (x1) - to be removed
* Firefox 7 (x1) - to be removed
* Firefox 8 (x1) - to be removed
* Firefox 9 (x1) - to be removed
* Firefox 10 (x1)
* Firefox 11 (x1) - to be removed
* Firefox 12 (x1)
* Firefox 13 (x1)
* Firefox Beta (x1)
* Firefox Aurora (x1)
* Firefox Nightly (x1)
* Internet Explorer 8 (x1)
 
=== Adding a new browser environment ===
 
==== Configuration ====
You will need to fork and clone from the [https://github.com/mozilla/moz-grid-config moz-grid-config github repository] and work on a new branch.
 
# Add the browser, alias, and path to grid_configuration.yml
# Add the browser, binary and details to the JSON configuration files
# Submit a pull request to the main github repository from your branch
 
==== Hub/Nodes ====
# Prepare Jenkins for shutdown - this will allow all currently running jobs to finish, but will not start any new jobs.
# Once no jobs are running, [[#Shutdown|shutdown]] the Selenium Grid hub
# Pull in the latest changes from moz-grid-config
# [[#Starting the hub|Start]] the Selenium Grid hub
# For each Selenium node:
## [[#Shutdown|Shutdown]] the Selenium node
## Pull in the latest changes from moz-grid-config
## [[#Installing Firefox|Install]] the appropriate browser for the new environment
## [[#Starting nodes|Start]] the Selenium node
 
==== Installing Firefox ====
* All new browsers should be installed with the version number in the path so that moz-grid-config can always find them!
* Install [http://pypi.python.org/pypi/mozdownload mozdownload] and [http://pypi.python.org/pypi/mozinstall mozinstall] using pip to download and install the Firefox binaries.
** use <code>--help</code> for both mozdownload tand mozinstall to see all available options
** to download the latest release using mozdownload you can simply use: <code>mozdownload -v latest</code>
** to download the latest Firefox Nightly build using mozdownload you can use: <code>mozdownload -t daily --branch=mozilla-central</code>
** to download the latest Firefox Aurora build using mozdownload you can use: <code>mozdownload -t daily --branch=mozilla-aurora</code>
** releases are also available to download manually [http://ftp.mozilla.org/pub/mozilla.org//firefox/releases/ here]
 
===== Mac OS X =====
* <code>mozdownload -v 14.0.1 -d /tmp</code>
* <code>mozinstall -d /Applications/ /tmp/firefox-14.0.1-en-US.mac.dmg</code>
* <code>mv /Applications/Firefox.app/ "/Applications/Firefox 14.app/"</code>
* <code>rm /tmp/firefox-14.0.1-en-US.mac.dmg</code>
 
===== Windows =====
* <code>mozdownload -v 14.0.1 -d %TMP%</code>
* <code>mozinstall -d %USERPROFILE% %TMP%/firefox-14.0.1-en-US.win32.exe</code>
* <code>move %USERPROFILE%/firefox-14 "\Program Files\Mozilla Firefox 14"</code>
* <code>del %TMP%/firefox-14.0.1-en-US.win32.exe</code>
 
== Jenkins ==
=== Starting Jenkins ===
# VPN in via Mozilla-MV to '''qa-selenium.mv.mozilla.org'''
# Look for an existing Terminal/Console window with a Jenkins process
#* If there's one there, you should just be able to cursor-up and type Enter/Return to launch
#* If not, launch as follows:
 
    java -jar -Xms2g -Xmx2g -XX:MaxPermSize=512M -Xincgc ~/Desktop/jenkins.war
 
=== Upgrading Jenkins ===
# Open the [http://qa-selenium.mv.mozilla.com:8080/ Jenkins dashboard] (must be on VPN)
# Click on [http://qa-selenium.mv.mozilla.com:8080/manage Manage Jenkins]
# Click on [http://qa-selenium.mv.mozilla.com:8080/quietDown Prepare for Shutdown]
# VNC into '''qa-selenium.mv.mozilla.com''' and go to the Terminal window and CTRL+C (you'll see Java processes shutting down)
# [[#Starting Jenkins|Start Jenkins]]
 
=== Jenkins Backup ===
Web QA is using the thinBackup (https://wiki.jenkins-ci.org/display/JENKINS/thinBackup) plugin to perform scheduled (currently daily) backups of the Jenkins XML files that store the Jenkins system config, jobs, plugins installed.
 
ThinBackup saves the backup to FS2 in the folder /public/QA/WebQA/Jenkins/
 
There is an unscheduled backup of the Plugins in this folder too but be aware these plugins may be out of date.
 
=== Restoration procedure ===
While thinBackup does backup a list of plugins used it cannot install them while restoring the Jenkins config and jobs. It will restore all of the settings that were used by the plugin but until the plugin is installed they won't be visible or active.
 
The work around to this is to install them manually before performing the restore. If a plugin is no longer available or obsolete then its settings may be lost.
 
Steps to restore WebQA's Jenkins instance:
 
# On the new/recovered server install and start a clean Jenkins instance.
# Open up that Jenkins instance and install thinBackup
# On the thinBackup settings page set the Backup directory to point to the fs2 directory.
# From the FS2 directory open the backed up list of plugins installedPlugins.xml in a text editor.
# In Jenkins install each plugin listed in the XML file. The first string in the <entry> matches the plugin-id. The plugin-id is listed in the information matrix at the top of the plugin's homepage (eg https://wiki.jenkins-ci.org/display/JENKINS/thinBackup). Alternatively you can copy the plugin from the folder in the Jenkins backup directory however because this folder is only backed up manually the plugins may be out of date. You'll need to use your best judgement here.
# Go back to thinBackup settings page and perform the thinBackup restore procedure.
# Restart Jenkins.
# Check that the jobs have retained the plugin settings.
 
NB if job settings have been lost then the plugin may not have been installed or be a different version.
 
== Setting hostname on Mac OS X ==
Shamelessly copied from http://budporter.net/?p=47
 
If you are running a version of OSX prior to 10.5, then look in '''/etc/hostconfig''' for the '''HOSTNAME=''' parameter and set it to be the FQDN (Fully Qualified Domain Name) that you want to use. So, for host ''foo'' located in the domain ''bar.com'', the entry would be as follows:
 
    HOSTNAME=foo.bar.com
 
For OSX 10.5, '''/etc/hostconfig''' is being deprecated. There are a couple of preferred methods to do this in 10.5:
 
    sudo hostname -s foo.bar.com
 
or:
 
    sudo scutil –set HostName foo.bar.com
 
You can verify the change by issuing the following command:
 
    hostname
 
The output will display the FQDN of the computer.
 
 
 
===Registering the  Tegra  Board to the Selenium Grid===
Install and  open the [http://code.google.com/p/selenium/downloads/list WebDriver] Android (android-server-x.xx.apk where x.xx is current version)  application on the Tegra board.
Install the [https://github.com/davehunt/flynnid FlynnID] python package on your computer.
Open your terminal and  type the following command
 
  flynnid --hubhost=[HUBIP] --hubport=4444 --nodehost=[NODEIP] --nodeport=8080 --browsername=browser --platform=ANDROID
 
where  HUBIP is the hostname or IP address of the Selenium Grid  and NODEIP is the hostname or IP address of the Tegra board
 
If everything goes right, you should see
  Registering the node to hub: http://qa-selenium.mv.mozilla.com:4444/grid/register
  Success!
 
You can check to see if the node is running by visiting the following url in your browser
  http://[NODEIP]:[NODEPORT]/wd/hub/static/resource/hub.html
 
where NODEIP is the hostname or IP address of the Tegra board and NODEPORT is the port the node is listening, the default is 8080.
 
 
 
 
 
== References ==
* [http://qa-selenium.mv.mozilla.com:8080/ Jenkins dashboard]
* [http://qa-selenium.mv.mozilla.com:4444/console Selenium Grid console]
* [https://github.com/mozilla/moz-grid-config moz-grid-config on github]

Latest revision as of 15:10, 1 November 2016

Since November 2016, we are no longer actively using or maintaining a Selenium Grid instance.