Reading/Browser tests/Setting up a browser test bot

This documents the steps required to get a bot running browser tests and posting test results to Gerrit. There is more information on wikitech-l. Note: this reviews any patches which do not have the browser bot attached to them. You can trigger a new review by removing the browser bot from the patchset.
 * Acquire a Gerrit account e.g. Barrythebrowsertestbot
 * Acquire a labs project
 * Create a labs instance with mediawiki
 * ssh into your instance e.g. ssh gather-browser-tests.eqiad.wmflabs
 * Install any extensions you want to test into the mediawiki install. It's likely you'll also need to install the vector skin.
 * Install phantomjs
 * Install Ruby (apt-get install ruby-dev && gem install bundler)
 * Install and configure arcanist for pasting failed test results to Phabricator (see below)
 * Install git review
 * Get barrybot.py from BarryTheBrowserTestBot
 * Register a public key with Gerrit and your labs instance.
 * Create a mediawiki account on your machine for your tests e.g. "User:Mr Selenium"
 * Update ~/.profile with information specific to your machine.
 * Navigate to the extension you want to run browser tests for and set up the browser test environment. Ensure the tests are passing green. Note that some extensions e.g. MobileFrontend require additional setup steps.
 * Run a trial run of the BarryTheBrowserTestBot without the --review flag
 * Set up a background task script and watch it review away.

Install
Follow instructions at https://secure.phabricator.com/book/phabricator/article/arcanist_quick_start/

Configure

 * Visit https://phabricator.wikimedia.org/conduit/login/ to get the API Token and paste it after running the following command:
 * Copy the config file somewhere where arcanist can find it when run by any user:
 * Make it readable:
 * Edit  and add the following key value pair:

Background task sample code
Run this in the background to start reviewing!:

Current setup at gather-browser-tests.eqiad.wmflabs

 * The username used for pasting test results to https://phabricator.wikimedia.org is 'Barry-the-Browser-Test-Bot'. To get the password (which you probably won't need) run: `cat /opt/barry_phab.txt`
 * Arcanist and barry are cloned at /opt/arcanist and /opt/barry
 * The run script is located at /opt/runbarry.sh (which should probably be replaced by a cron job)