Using Selenium or another frontend testing framework, write browser tests for all interaction in DonationInterface.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T86247 More and easier testing for DonationInterface | |||
Invalid | None | T89188 Hackathon idea: Make the DonationInterface extension as friendly as possible | |||
Resolved | K4-713 | T94477 DonationInterface config should be less of a snowflake | |||
Resolved | Ejegg | T95995 Stop gating configuration with optionalParts[] tests | |||
Resolved | awight | T99951 Write puppet to provision DonationInterface | |||
Open | None | T99954 In the event that credentials for a gateway are not supplied, that gateway should go in to local development mode. | |||
Declined | None | T99955 Write browser tests for DonationInterface | |||
Invalid | None | T99957 Write MW-Vagrant puppet to allow us to spin up dev, staging, and testing instances, and deploy sandbox servers on WMF-labs |
Event Timeline
Did someone work on this project during Wikimedia-Hackathon-2015? If so, please update the task with the results. If not, please remove the label.
@Ejegg that's actually not a good example! :)
CirrusSearch is the only repository using Cucumber testing framework. Other repositories use Mocha testing framework (recommended). There is also many other examples and documentation.
Please see Selenium/Node.js page for documentation. Write tests section is what you are probably looking for.
Selenium/Node.js/Write#MediaWiki_Extension is a step by step example, with links to a couple of videos showing how to write tests.
I am also available for reviews and/or pairing.
I have tried setting this up on my machine, but looks like there is no DonationInterface vagrant role.
Change 413181 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[mediawiki/extensions/DonationInterface@master] WIP Selenium test example
Change 413187 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[integration/config@master] Running qunit-selenium job for DonationInterface
Change 413187 merged by jenkins-bot:
[integration/config@master] Running qunit-selenium job for DonationInterface
Oh wow, thanks @zeljkofilipin! Sorry I didn't see your comments earlier. If you haven't found it yet, the vagrant role you'll want is 'fundraising'. It'll set up a multiversion/multiwiki with the extensions we use on the payments cluster.
I have set up Zuul so mediawiki-core-qunit-selenium-jessie job runs if you leave check experimental comment on any patch for DonationInterface. For example see 413181.
But, looks like there is a problem with mw-run-update-script.sh (see mediawiki-core-qunit-selenium-jessie/15208/console).
... 00:00:44.225 + /srv/deployment/integration/slave-scripts/bin/mw-run-update-script.sh 00:00:44.240 PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/20-xhprof.ini on line 2 in Unknown on line 0 00:00:44.324 PHP Fatal error: Class 'SmashPig\Core\GlobalConfiguration' not found in /home/jenkins/workspace/mediawiki-core-qunit-selenium-jessie/src/extensions/DonationInterface/DonationInterface.class.php on line 47 00:00:44.325 00:00:44.325 Fatal error: Class 'SmashPig\Core\GlobalConfiguration' not found in /home/jenkins/workspace/mediawiki-core-qunit-selenium-jessie/src/extensions/DonationInterface/DonationInterface.class.php on line 47 00:00:44.342 Build step 'Execute shell' marked build as failure 00:00:44.454 [PostBuildScript] - Execution post build scripts. 00:00:44.454 [PostBuildScript] Build is not success : do not execute script 00:00:44.455 Archiving artifacts 00:00:44.612 Recording test results 00:00:44.953 Finished: FAILURE
Thanks! Did not found it myself. Is there a simple thing I could check if the wiki is configured correctly? Is there a new link, something like "donate now"?
@zeljkofilipin the vagrant role should install a Main Page with a bunch of links to payment forms.
The difficulty here is that many of the forms need payment processor sandbox account credentials to do anything interesting. There's a bit about configuration on the Main Page text too.
In our unit tests, we swap out the API interaction to use canned responses by (mostly) using child classes that override the curl method. It might work to add a call to DonationInterface::onDonationInterfaceUnitTests() at the end of your LocalSettings.php to get that configuration loaded.
I have provisioned fundraising role, but looks like something is wrong. Do I need to do something else besides provisioning the role?
Ah, looks like that is what is supposed to happen. :) I can log in with admin/vagrant credentials. I was confused with Drupal. I was expecting MediaWiki. :D
Looks like CI is having trouble with DonationInterface. From mediawiki-core-qunit-selenium-jessie/15581/console:
00:00:47.205 PHP Fatal error: Class 'SmashPig\Core\GlobalConfiguration' not found in /home/jenkins/workspace/mediawiki-core-qunit-selenium-jessie/src/extensions/DonationInterface/DonationInterface.class.php on line 47 00:00:47.206 00:00:47.206 Fatal error: Class 'SmashPig\Core\GlobalConfiguration' not found in /home/jenkins/workspace/mediawiki-core-qunit-selenium-jessie/src/extensions/DonationInterface/DonationInterface.class.php on line 47
@hashar, do you know what went wrong?
Please see 413181 for example Selenium test. I can not write tests for you, but I am available for pairing and/or reviews. :)
Documentation is available at Selenium/Node.js. Let me know if you have any questions.
There is something wrong with CI for DonationInterface, see T99955#4005404. Hopefully @hashar can resolve it.
DonationInterface test environment is differentthan the other jobs. It targets mediawiki/core@REL1_27 and mediawiki/vendor has a specific branch fundraising/REL1_27. That can be seen in the PHPUnit job mwext-donationinterfacecore-REL1_27-zend56-jessie:
zuul-cloner --color --verbose \
--map /srv/deployment/integration/slave-scripts/etc/zuul-clonemap.yaml \
--workspace src --cache-dir /srv/git \
--branch REL1_27 \
--project-branch mediawiki/extensions/DonationInterface=master \
--project-branch mediawiki/vendor=fundraising/REL1_27 \
https://gerrit.wikimedia.org/r/p \
mediawiki/core mediawiki/vendor
mediawiki/extensions/DonationInterface
mediawiki/extensions/FundraisingEmailUnsubscribe
mediawiki/extensions/ContributionTracking
mediawiki/extensions/ParserFunctions
mediawiki/extensions/cldr mediawiki/skins/Vector
What this mean is that when a patch is send for DonationInterface we select specific branches for each repository:
mediawiki/extensions/DonationInterface | master |
mediawiki/vendor | fundraising/REL1_27 |
Default: | REL1_27 |
Also it targets PHP 5.6 which is what is being run in production.
We would need a more specific job that reuses that zuul-cloner magic command. But that also means that mediawiki/core REL1_27 will be used and it lacks the webdriver.io integration. Though maybe we could hack that by using the suite from the master branch.
In short: it is not so trivial.
Thanks so much for all the help! We might have to wait till June for the Gerrit integration when we plan to switch over to the next LTS release (1.31) for fundraising.
Change 413181 abandoned by Zfilipin:
WIP Selenium test example
Reason:
No activity in over a month.
No one working on it, but can be reopened or filled again if there is interest later on.