| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  | var benchpress = require('../../../../tools/benchpress/benchpress.js'); | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('ng2 element injector benchmark', function () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var URL = 'benchmarks/web/element_injector/element_injector_benchmark.html'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  |   afterEach(benchpress.verifyNoBrowserErrors); | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it('should log the stats for instantiate', function() { | 
					
						
							| 
									
										
										
										
											2014-12-29 16:15:41 -08:00
										 |  |  |     browser.get(URL); | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  |     runClickTimeBenchmark({ | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |       buttons: ['#instantiate'], | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  |       logId: 'ng2.elementInjector.instantiate' | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log the stats for instantiateDirectives', function() { | 
					
						
							| 
									
										
										
										
											2014-12-29 16:15:41 -08:00
										 |  |  |     browser.get(URL); | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  |     runClickTimeBenchmark({ | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |       buttons: ['#instantiateDirectives'], | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  |       logId: 'ng2.elementInjector.instantiateDirectives' | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-12-29 15:36:29 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | function runClickTimeBenchmark(config) { | 
					
						
							|  |  |  |   var buttons = config.buttons.map(function(selector) { | 
					
						
							|  |  |  |     return $(selector); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   var timeParams = browser.params.timeBenchmark; | 
					
						
							|  |  |  |   benchpress.runTimeBenchmark({ | 
					
						
							|  |  |  |     sampleSize: timeParams.sampleSize, | 
					
						
							|  |  |  |     targetCoefficientOfVariation: timeParams.targetCoefficientOfVariation, | 
					
						
							|  |  |  |     timeout: timeParams.timeout, | 
					
						
							|  |  |  |     metrics: timeParams.metrics, | 
					
						
							|  |  |  |     logId: browser.params.lang+'.'+config.logId | 
					
						
							|  |  |  |   }, function() { | 
					
						
							|  |  |  |     buttons.forEach(function(button) { | 
					
						
							|  |  |  |       button.click(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |