mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-14 09:44:44 +00:00
916234598d
This deals with data inconsistencies in buildFilterEditor. Every property of $row was tested in all 5 scenarios (also using Selenium) to check when it's set. The result is in the normalizeRow method, which aims to remove any inconsistencies, so that buildFilterEditor always receives a "complete" row with all defaults set. The code in buildFilterEditor is now cleaner (because there are no isset() checks), and it gives us a unique place where we can set defaults (rather than partly doing that in loadRequest/loadFilterData/loadImport, and partly relying on isset). This will be especially useful when introducing value objects to represent filters, because now you just have to look at normalizeRow() to tell which properties are allowed to be missing, and thus what "kind" of filter object you need (see I5f33227887c035e301313bbe24d1c1fefb75bc6a). Additionally, reduce the properties that get passed around during export/import, and make the selenium test try a roundtrip, rather than relying on hardcoded data that may get outdated. A future patch will refactor the import/export code. Change-Id: Id52c466baaf6da18e2981f27a81ffdad3a509e78 |
||
---|---|---|
.. | ||
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]