| 
									
										
										
										
											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-20 17:01:51 -07:00
										 |  |  | import {verifyNoBrowserErrors} from 'angular2/src/testing/perf_util'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('ng2 largetable benchmark', function() { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const URL = 'benchmarks/src/page_load/page_load.html'; | 
					
						
							|  |  |  |   const runner = global['benchpressRunner']; | 
					
						
							| 
									
										
										
										
											2016-04-20 17:01:51 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   afterEach(verifyNoBrowserErrors); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log the load time', function(done) { | 
					
						
							| 
									
										
										
										
											2016-08-26 15:44:05 -07:00
										 |  |  |     runner | 
					
						
							|  |  |  |         .sample({ | 
					
						
							|  |  |  |           id: 'loadTime', | 
					
						
							|  |  |  |           prepare: null, | 
					
						
							|  |  |  |           microMetrics: null, | 
					
						
							|  |  |  |           userMetrics: | 
					
						
							|  |  |  |               {loadTime: 'The time in milliseconds to bootstrap', someConstant: 'Some constant'}, | 
					
						
							|  |  |  |           bindings: [ | 
					
						
							|  |  |  |             benchpress.bind(benchpress.SizeValidator.SAMPLE_SIZE).toValue(2), | 
					
						
							|  |  |  |             benchpress.bind(benchpress.RegressionSlopeValidator.SAMPLE_SIZE).toValue(2), | 
					
						
							|  |  |  |             benchpress.bind(benchpress.RegressionSlopeValidator.METRIC).toValue('someConstant') | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |           execute: () => { browser.get(URL); } | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2016-04-20 17:01:51 -07:00
										 |  |  |         .then(report => { | 
					
						
							|  |  |  |           expect(report.completeSample.map(val => val.values.someConstant) | 
					
						
							|  |  |  |                      .every(v => v === 1234567890)) | 
					
						
							|  |  |  |               .toBe(true); | 
					
						
							|  |  |  |           expect(report.completeSample.map(val => val.values.loadTime) | 
					
						
							|  |  |  |                      .filter(t => typeof t === 'number' && t > 0) | 
					
						
							|  |  |  |                      .length) | 
					
						
							|  |  |  |               .toBeGreaterThan(1); | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         .then(done); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |