Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Summer of Code 2016 JavaScript Testing project #11420

Merged
merged 60 commits into from
Aug 12, 2016

Conversation

Ruchiranga
Copy link
Contributor

@Ruchiranga Ruchiranga commented Aug 3, 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.

@@ -1,18 +1,19 @@
# Forces new Travis-CI Infrastructure
sudo: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed as it's going to affect all jobs?

Copy link
Member

@yvesh yvesh Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, why it's in there .. I think from the beginning of GSoC project, where it still was that way in core.. Going to remove it.

@mbabker For the unit tests sudo seems not to be needed, any reasons it was reenabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We turned it off to use the newer (faster) Travis-CI structure by default. So my only guess is someone changed this testing something along the way.

@Ruchiranga
Copy link
Contributor Author

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

@zero-24
Copy link
Contributor

zero-24 commented Aug 5, 2016

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

@Ruchiranga
Copy link
Contributor Author

Thank you @zero-24 :)

@gunjanpatel
Copy link
Contributor

Good work @Ruchiranga

@roland-d
Copy link
Contributor

roland-d commented Aug 9, 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?

@Ruchiranga
Copy link
Contributor Author

Ruchiranga commented Aug 10, 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

@Ruchiranga
Copy link
Contributor Author

Thank you @gunjanpatel :)

@roland-d
Copy link
Contributor

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

@yvesh
Copy link
Member

yvesh commented Aug 12, 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.

@rdeutz rdeutz added this to the Joomla 3.6.3 milestone Aug 12, 2016
@rdeutz
Copy link
Contributor

rdeutz commented Aug 12, 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.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 12, 2016
@rdeutz rdeutz merged commit 6021a45 into joomla:staging Aug 12, 2016
@rdeutz
Copy link
Contributor

rdeutz commented Aug 12, 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.

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 12, 2016
@Ruchiranga
Copy link
Contributor Author

@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 :)

@brianteeman brianteeman mentioned this pull request Aug 24, 2016
roland-d pushed a commit to roland-d/joomla-cms that referenced this pull request Sep 11, 2016
* Initial test environment setup with Jasmine, Karma and RequireJS

* Seperated test setup code from test logic

* Configured .travis.yml to run Karma

* Fixed typo in .travis.yml

* changes to .travis.yml

* Added karma requirejs module

* Removed unnecessary code in travis.yml

* Fixed missing code is travis.yml

* Removed 2 unused image files

* Improved code standards

* Modified travis.yml

* Issue 1 Cleaned the mess with changes bunch of to unrelated files

* Issue 1 Added newline at end of file

* Issue 4 Improved JCaption JavaScript tests

* New coeverage reporter plugin test with Travis

* Issue 1 Added karma-coerage reporter and configured it to display coverage on console

* Issue 1 Added and configured karma-verbose-reporter plugin

* Issue 1 Fixing verbose reporter config for travis

* Issue 1 removed redundant javascript dir and added requirejs/text plugin to load fixtures

* Issue 4 Improved code with suggestions made in the code review

* Issue 1 Added version for requirejs text plugin

* Issue 1 converted space indentations to tabs

* Issue 1 Fixed indentation in package.json

* Issue 1 Fixed version issue in require text

* Issue 1 Fixed version issue in require text

* Issue 1 Fixed version issue in require text

* Issue 4 Improved code standards and jquer selector efficiency

* Issue 1 Tersting version issue with text plugin on travis

* Issue 1 Tersting version issue with text plugin on travis

* Issue 1 Tersting version issue with text plugin on travis

* Issue 1 Removed spec folder

* Corejs tests (joomla#15)

Tests for core.js

* Tests for permissions.js (#13)

* Test suite for permissions.js
* Added karma-jasmine-ajax plugin

* Added a container div for fixtures representing library name (#11)

* Added a container div for fixtures representing the library name

* CS - Removed an extra new line

* Permissions.js tests

Test for permissions

* Repeatable.js test suite

* Improvements to JCaption tests

* README.md update

* Modified readme file
* Made running tests easier by adding configuration for tests to run on npm test

* Core js Improvements

* Issue 9 Added jasmine spies and improved code
* Issue 9 Fixed an indentation issue

* Demo video on Youtube 

* Inserted the video demonstration link to the readme

* Issue 5 Added spies and made code improvements (joomla#31)

* Issue 12 Improved code (joomla#34)

* Repeatable.js Improvements (joomla#35)

* Run Travis JavaScript tests on separated Matrix Build (joomla#39)

* Only run Travis tests on PHP 7

* Fix base path issue

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Added own matrix tests for JavaScript

* Reverted README.md

* Synced README.md to the new version

* Synced README.md with new version

* Fixed indentations

* Synced README.md with 3.6 version

* Fixed indentations

* Fixed indentations
* Added newline at the end of travis-tests.sh

* Added missing sudo:false in .travis.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants