? ? Success

User tests: Successful: Unsuccessful:

avatar Ruchiranga
Ruchiranga
3 Aug 2016

Summary of Changes

The set of custom JavaScript libraries in Joomla does not have any tests. This PR contains a test suite that will be run, like the PHP unit tests, automatically for every pull request and commit with Travis.

Shown below are some screenshots of the Travis log with the JavaScript test results.

core.js test results

validate.js test results

repeatable.js test results

The Travis log will also show an overview of the test coverage achieved.

Test coverage and overview

As testing framework we use Jasmine, which is run by Karma-Test Runner in a real Firefox browser.

Core JavaScript Libraries covered by this Pull Request:

  1. caption.js
  2. core.js
  3. permissions.js
  4. repeatable.js
  5. validate.js

Documentation

The documentation is currently available here. This will be moved into the Joomla! documentation soon.

Testing Instructions

None, since this is only run on Travis. If you want to run it locally, please take a look at the documentation.

Demonstration

Demonstration video can be watched via this link.

avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2016
Category Repository Unit Tests JavaScript
avatar Ruchiranga Ruchiranga - open - 3 Aug 2016
avatar Ruchiranga Ruchiranga - change - 3 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2016
Labels Added: ? ?
avatar Ruchiranga
Ruchiranga - comment - 3 Aug 2016

The Travis log for the JavaScript tests in this PR is available here .
The JavaScript tests are run only on the build job shown below.
JS Tests Build Job

avatar zero-24
zero-24 - comment - 5 Aug 2016

Good work @Ruchiranga Looks really nice. Thanks to the GSOC Team!

avatar Ruchiranga
Ruchiranga - comment - 5 Aug 2016

Thank you @zero-24 :)

avatar gunjanpatel
gunjanpatel - comment - 8 Aug 2016

Good work @Ruchiranga

avatar roland-d
roland-d - comment - 9 Aug 2016

@Ruchiranga That looks very cool. The video and your screenshots show when everything goes right. Can you post some shots of what happens when I break something with a code change?

avatar Ruchiranga
Ruchiranga - comment - 10 Aug 2016

@roland-d
Thanks!

Here is a screenshot of the Joomla.submitform function in core.js.
Joomla.submitform before

And all the tests covering that function are passing.
Joomla.submitform before log

Now here, I comment line form.setAttribute('novalidate', !validate) mimicking a situation where we have mistakenly deleted that line of code.
Joomla.submitform after code

As a result, the test case covering that line would fail. It will be shown in the log as follows.
Joomla.submitform after log

The overall summary of the tests would also show that one test case is failing.
Joomla.submitform after log summary

avatar Ruchiranga
Ruchiranga - comment - 10 Aug 2016

Thank you @gunjanpatel :)

avatar roland-d
roland-d - comment - 11 Aug 2016

@Ruchiranga Thank you for that explanation looks good. Good job.

avatar yvesh yvesh - test_item - 12 Aug 2016 - Tested successfully
avatar yvesh
yvesh - comment - 12 Aug 2016

I have tested this item successfully on fda4cdb


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11420.

avatar rdeutz rdeutz - alter_testresult - 12 Aug 2016 - rdeutz: Tested successfully
avatar rdeutz rdeutz - change - 12 Aug 2016
Milestone Added:
Status Pending Ready to Commit
Labels
avatar rdeutz
rdeutz - comment - 12 Aug 2016

Tested with travis and in a local environment. I will merge on Review


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11420.

avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2016
Labels Added: ?
avatar rdeutz rdeutz - change - 12 Aug 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-08-12 15:43:53
Closed_By rdeutz
Labels Added: ?
avatar rdeutz
rdeutz - comment - 12 Aug 2016

Good job @Ruchiranga! One thing we might can add is that it is not needed that phpunit runs for the javascript tests so if we can exclude this we can have the result faster. No big deal at all.

avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2016
Labels Removed: ?
avatar Ruchiranga
Ruchiranga - comment - 12 Aug 2016

@rdeutz Thank you! Yes I agree. We will make that change. Thank you very much again for taking your time to go through this and get it merged :)

Add a Comment

Login with GitHub to post a comment