# TL;DR
You can now write Selenium tests in Node.js! Learn more about it at https://www.mediawiki.org/wiki/Selenium/Node.js
# Introduction
Five years ago we introduced browser tests using Selenium and a Ruby based stack. It has worked great for some teams, and not so great for others. Last year we talked to people from several teams and ran a survey[0]. The outcome is a preference toward using a language developers are familiar with: JavaScript/Node.Js.
After several months of research and development, we are proud to announce support for writing tests in Node.js. We have decided to use WebdriverIO[1]. It is already available in MediaWiki core and supports running tests for extensions.
You can give it a try in MediaWiki-Vagrant[2]:
vagrant up vagrant ssh sudo apt-get install chromedriver export PATH=$PATH:/usr/lib/chromium cd /vagrant/mediawiki xvfb-run npm run selenium
# Documentation
Extensive details are available on the landing page: https://www.mediawiki.org/wiki/Selenium/Node.js
# Future
We plan to replace the majority of Selenium tests written in Ruby with tests in Node.js in the next 6 months. We can not force anybody to rewrite existing tests, but we will offer documentation and pairing sessions for teams that need help. After 6 months, teams that want to continue using Ruby framework will be able to do so, but without support from Release Engineering team.
I have submitted a skill share session for Wikimedia Hackathon 2017 in Vienna[3]. If you would like to pair on Selenium tests in person, that would be a great time.
The list of short term actions is in task T139740[4].
# Thanks
I would like to thank several people for reviews, advice and code: Jean-Rene Branaa, Dan Duvall, Antoine Musso, Jon Robson, Timo Tijhof. (Names are sorted alphabetically by last name. Apologies to people I have forgot.)
# References
[0] https://www.mediawiki.org/wiki/Browser_testing_user_satisfaction_survey [1] http://webdriver.io/ [2] https://www.mediawiki.org/wiki/Selenium/Node.js/Inside_MediaWiki-Vagrant [3] https://phabricator.wikimedia.org/T159945 [4] https://phabricator.wikimedia.org/T139740
Željko Filipin
wikitech-l@lists.wikimedia.org