Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(tests): performance improvements and fixes to jasmine testing #2800

Closed
wants to merge 6 commits into from

Conversation

ThomasBurleson
Copy link
Contributor

Testing now works with Safari, Firefox, PhantomJS, and Chrome browser testing.:

  • Removed module wrappers around all components
  • now only has a single module wrapper protecting all the angular material code
  • Replaced use of Function.bind( ) with angular.bind()
  • Fixed tests runs with uncompiled source or compiled, deployed angular-material.js
  • Refactor internal test utils to angular-material-spec.js
  • Publish material mocks angular-material-mocks.js to work with angular-mocks.js for 3rd party unit testing.
  • Use angular-material-mocks.js to decorate $$rAF.throttle(), force $mdAria.expectWithText() to be synchronous, and disable the generation of Theme CSS rules.
  • Major testing speed improvements by disabling Theme CSS generation.
  • Theme improvements: test existence of Theme CSS rule before regenerating.

Refactor internal test utils to angular-material-spec.js
Publish material mocks `angular-material-mocks.js` to work with angular-mocks.js for 3rd party unit testing.
Removed module wrappers around all components
- now only has a single module wrapper protecting all the angular material code
Replaced use of `Function.bind( )` with `angular.bind()`
Fixed tests runs with uncompiled source **or** compiled, deployed `angular-material.js`
Use angular-material-mocks.js to decorate $$rAF.throttle(), force $mdAria.expectWithText() to be synchronous, and disable the generation of Theme CSS rules.
Major testing speed improvements by disabling Theme CSS generation.
Theme improvements: test existence of Theme CSS rule before regenerating.
Now works with Safari, Firefox, PhantomJS, and Chrome browser testing.
@ThomasBurleson ThomasBurleson added the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label May 11, 2015
@ThomasBurleson
Copy link
Contributor Author

@rschmukler, @jelbourn - Can you guys reviews these changes:

  • karma start ./config/karma.conf.js --browsers="PhantomJS"
  • gulp karma --browsers="PhantomJS"

All work very fast now: < 3secs.
Testing with compiled, distribution file angular-material.js works very fast now!

Note use of new source directory: /test/angular-material-mocks.js.

Running karma on ci was not exiting with non zero code, giving the impression the specs passed

Closes #2535.
@ThomasBurleson
Copy link
Contributor Author

I am working to fix the injection errors for minified source.

@ThomasBurleson ThomasBurleson removed the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label May 11, 2015
@gkalpak
Copy link
Member

gkalpak commented May 11, 2015

-1 for the ngMaterial-mock name (seems quite arbitrary/unconventional)

+10 for everything else 😄

Restored module wrapper to material theme constants.
Passed global args to module wrapper for JS modules
Minified code no longer contains angular-material-mocks; which is not deployed as external file.
@ThomasBurleson ThomasBurleson added the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label May 11, 2015
@ThomasBurleson
Copy link
Contributor Author

@gkalpak - since Angular uses 'ng' and 'ngMock', we wanted something analogous: 'ngMaterial', 'ngMaterial-mock'.

What about 'ngMock-material' ?

});
}
},
flags: ['--web-security=no', '--proxy-type=none', '--remote-debugger-port=9000', '--remote-debugger-autorun=yes']
Copy link
Member

Choose a reason for hiding this comment

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

Can you multi-line this array?

Auto-wrap all JS files in module wrapper.
Repackage angular-material-mocks.js to `/test/` directory
Change karma logLevel to 'warn'
@ThomasBurleson ThomasBurleson removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs wip labels May 11, 2015
@ThomasBurleson ThomasBurleson added this to the 0.10.0 milestone May 11, 2015
@EladBezalel EladBezalel deleted the wip/jasmine-test-fixes branch January 16, 2016 00:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants