| 
									
										
										
										
											2016-10-23 22:37:15 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  | import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util'; | 
					
						
							|  |  |  | import {runClickBenchmark} from '@angular/testing/src/perf_util'; | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('ng2 cost benchmark', function() { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const URL = 'benchmarks/src/costs/index.html'; | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Number of components to create in a single iteration
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const benchmarkSize = 200; | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |   afterEach(verifyNoBrowserErrors); | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for baseline (plain components)', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |     runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							|  |  |  |       buttons: ['#reset', '#createPlainComponents'], | 
					
						
							|  |  |  |       id: 'ng2.costs.baseline', | 
					
						
							|  |  |  |       params: [{name: 'size', value: benchmarkSize, scale: 'linear'}] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for components with decorators', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |     runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							|  |  |  |       buttons: ['#reset', '#createComponentsWithDirectives'], | 
					
						
							|  |  |  |       id: 'ng2.costs.decorators', | 
					
						
							|  |  |  |       params: [{name: 'size', value: benchmarkSize, scale: 'linear'}] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for dynamic components', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |     runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							|  |  |  |       buttons: ['#reset', '#createDynamicComponents'], | 
					
						
							|  |  |  |       id: 'ng2.costs.dynamic', | 
					
						
							|  |  |  |       params: [{name: 'size', value: benchmarkSize, scale: 'linear'}] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |