Jump to content

Reading/Browser tests/Setting up a browser test instance

From mediawiki.org

If you prefer you follow instructions to manually setup a browser test bot but we;ve created a bash script, Barry-the-Browser-Test-Bot-Installer in effort to reduce the amount of heavy lifting.

To setup a browser test bot labs-vagrant instance, please follow these instructions:

  • Create a Labs / Gerrit account by signing up at wikitech (eg: Barrythebrowsertestbot). Please note [bot policy].
  • Request a labs project if a project doesn't already exist. Currently we already have a project called reading-smoketest.
  • Create a labs instance Choose ubuntu-14.04-trusty and configure with role::labs::vagrant checked. You must have Project Admin rights in a project to create and manage its instances. You can ask an existing Project Admin in a project to grant you the role.
  • ssh into your instance e.g. ssh reading-smoketest.wmflabs.org
    • If you cannot access your labs project. Try ssh -A username@bastion.wmflabs.org then ssh into your instance from there. ssh instance-name
  • Following instructions from Help:Labs-vagrant Run an initial provision and enable the project roles needed for your testing instance.
  • Setup a Web Proxy and link to the instance.
    • Example:
      sudo puppet agent -tv
      labs-vagrant provision
      labs-vagrant list-roles
      labs-vagrant enable-role mobilefrontend
      labs-vagrant provision
      
  • Checkout the Barry installer script and run it as sudo.
    • cd ~/
      git clone https://github.com/rmoen/Barry-the-Browser-Test-Bot-Installer install-barry
      cd install-barry
      sudo ./install.sh
      
  • The script does the following.
    • Installs npm, nodejs-legacy, phantomjs, ruby, ruby-dev, updates gems, bundler, git-review/
    • Creates a system user account for the testbot and does the following for the new user:
    • Installs Barry-the-Browser-Test-Bot at ~/barrybot and adds to $PATH by editing bashrc
    • Creates a new ssh key for the test bot user. This is required to command Gerrit.
    • Asks for the mediawiki server url (eg: http://reading-smoketest.wmflabs.org)
    • Wwill create the MediaWiki account Mr_Selenium with sysop and bureaucrat
    • Writes the bot configuration in ~/.bashrc
    • Asks for a project name and dependency and creates a run script. Currently configures an extension with a dependency. (eg: Gather and MobileFrontend)
      • Writes the run script to /home/$username/barrybot/run.sh
    • Installs and configures Arcanist for phabricator commands
    • To setup Arcanist, it will ask for your phabricator api token which can be found https://phabricator.wikimedia.org/conduit/login
    • Prints your newly created public key and asks you to add it to https://gerrit.wikimedia.org/r/#/settings/ssh-keys
  • Verify the setup completed correctly. If prompted for a username when running `git review` provide the name of the bot. arc command should print a url.
  • > echo 'foo' |arc paste
    sudo su username
    > cd /vagrant/mediawiki/extensions/MobileFrontend
    > git review
    
  • Run the bot once
  • sudo su username
    cd ~/barrybot && ./run.sh
    
  • Run the bot indefinitely
  • > sudo su localusername
    > script /dev/null
    > screen
    > cd ~/barrybot && ./run.sh &
    > [ctrl + a + d to detach ]