| 
									
										
										
										
											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 {runBenchmark} from '@angular/testing/src/perf_util'; | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('ng2 naive infinite scroll benchmark', function() { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const URL = 'benchmarks/src/naive_infinite_scroll/index.html'; | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							|  |  |  |   [1, 2, 4].forEach(function(appSize) { | 
					
						
							|  |  |  |     it('should run scroll benchmark and collect stats for appSize = ' + appSize, function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |       runBenchmark({ | 
					
						
							|  |  |  |         url: URL, | 
					
						
							|  |  |  |         id: 'ng2.naive_infinite_scroll', | 
					
						
							|  |  |  |         work: function() { | 
					
						
							| 
									
										
										
										
											2016-08-26 15:44:05 -07:00
										 |  |  |           browser.wait( | 
					
						
							|  |  |  |               protractor.until.elementLocated(protractor.By.css('body /deep/ #scrollDiv')), 5000); | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |           $('#reset-btn').click(); | 
					
						
							|  |  |  |           $('#run-btn').click(); | 
					
						
							| 
									
										
										
										
											2015-06-22 09:24:09 -07:00
										 |  |  |           browser.wait(protractor.until.elementLocated(protractor.By.css('#done')), 10000); | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |         }, | 
					
						
							|  |  |  |         params: [ | 
					
						
							| 
									
										
										
										
											2016-08-26 15:44:05 -07:00
										 |  |  |           {name: 'appSize', value: appSize}, {name: 'iterationCount', value: 20, scale: 'linear'}, | 
					
						
							| 
									
										
										
										
											2015-05-30 08:17:27 -07:00
										 |  |  |           {name: 'scrollIncrement', value: 40} | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |       }).then(done, done.fail); | 
					
						
							| 
									
										
										
										
											2015-05-29 21:40:15 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }); |