# Status
- Waiting for review: [[ https://gerrit.wikimedia.org/r/#/c/422933/ | 422933 ]].
- Updated documentation: [[ https://www.mediawiki.org/wiki/Selenium/Node.js/Inside_MediaWiki-Vagrant#Run_the_Selenium_tests_and_record_video_of_each_test | Run the Selenium tests and record video of each test ]].
# TODO
- The last video (User-should-be-able-to-change-preferences.mp4) is not saved correctly in Jenkins. All other [[ https://integration.wikimedia.org/ci/job/mediawiki-core-qunit-selenium-jessie/18845/artifact/log/ | files ]] are saved correctly. It works fine in mediawiki-vagrant.
- At the moment, videos of passing and failing tests are recorded. Ruby framework recorded only failed tests. I thought about doing the same here, but I actually prefer having all videos recorded. They really do not take much space, 75-187 KB per video.
---
It was implemented in Ruby framework. There are two options:
- Sauce Labs
- Xvfb
There are tools similar to [[ https://rubygems.org/gems/headless | headless ]] ruby gem:
- [[ https://www.npmjs.com/package/headless | headless ]]
- [[ https://www.npmjs.com/package/xvfb | xvfb ]]
- [[ https://github.com/lightsofapollo/x-recorder | x-recorder ]]
- [[ https://www.npmjs.com/package/fluent-ffmpeg | fluent-ffmpeg ]]
- https://www.npmjs.com/package/fluent-ffmpeg#inputoptionsoption-add-custom-input-options
Instructions on how to test locally:
- [[ https://www.mediawiki.org/wiki/Selenium/Node.js/Inside_MediaWiki-Vagrant | Inside MediaWiki-Vagrant ]]
Run tests using [[ http://manpages.ubuntu.com/manpages/trusty/man1/xvfb-run.1.html | xvfb-run ]]:
```
vagrant@vagrant:/vagrant/mediawiki$ xvfb-run npm run selenium
```
Video is recorded via [[ https://ffmpeg.org/ffmpeg.html | ffmpeg ]].
Links:
- http://elementalselenium.com/tips/38-headless
- http://shawnzhu.blogspot.hr/2014/04/feedback-information-from.html
- https://phabricator.wikimedia.org/source/integration-config/browse/master/dockerfiles/npm-browser-test/run-with-xvfb.sh
- http://afterdesign.net/2016/02/07/recording-headless-selenium-tests-to-mp4.html