mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-15 02:03:53 +00:00
62adeb3ce5
The editing view is currently full of tech debt, brittle and surprising code and whatnot. It's basically a miracle if it works without problem, and it'd be an even bigger miracle if you could change something there without breaking anything. For these reasons, and because that class must be refactored as part of the upcoming overhaul, this patch adds a bunch of selenium tests to test the main functionality of that page. In particular, these tests cover all possible cases (each corresponding to a data source) for which buildFilterEditor can be called, which FTR are: 1 - View the result of importing a filter 2 - Create a new filter 3 - Load the current version of an existing filter 4 - Load an old version of an existing filter 5 - Show the user input again if saving fails after one of the steps above Having automated tests to cover these cases means that we don't have to manually test all the scenarios manually each time the class is touched. Bug: T201193 Change-Id: I408e0a132905416effe0d6d6dc0921991edd66bd |
||
---|---|---|
.. | ||
pageobjects | ||
specs | ||
.eslintrc.json | ||
README.md | ||
wdio.conf.js |
Selenium tests
For more information see https://www.mediawiki.org/wiki/Selenium/Node.js and [PATH]/mediawiki/vagrant/mediawiki/tests/selenium/README.md.
Setup
Set up MediaWiki-Vagrant:
cd [PATH]/mediawiki/vagrant/mediawiki/extensions/AbuseFilter
vagrant up
vagrant roles enable abusefilter
vagrant provision
npm install
Chromedriver has to run in one terminal window:
chromedriver --url-base=wd/hub --port=4444
Run all specs
In another terminal window:
npm run selenium-test
Run specific tests
Filter by file name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME]
Filter by file name and test name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME] --mochaOpts.grep [TEST-NAME]