| 
									
										
										
										
											2016-09-07 16:04:33 -07: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-11-23 13:49:57 -08:00
										 |  |  | /* tslint:disable:no-console  */ | 
					
						
							| 
									
										
										
										
											2016-09-07 16:04:33 -07:00
										 |  |  | import * as webdriver from 'selenium-webdriver'; | 
					
						
							|  |  |  | declare var browser: any; | 
					
						
							|  |  |  | declare var expect: any; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // TODO (juliemr): remove this method once this becomes a protractor plugin
 | 
					
						
							|  |  |  | export function verifyNoBrowserErrors() { | 
					
						
							| 
									
										
										
										
											2016-09-14 09:41:40 -07:00
										 |  |  |   browser.manage().logs().get('browser').then(function(browserLog: any[]) { | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |     const errors: any[] = []; | 
					
						
							| 
									
										
										
										
											2016-09-07 16:04:33 -07:00
										 |  |  |     browserLog.filter(logEntry => { | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |       const msg = logEntry.message; | 
					
						
							| 
									
										
										
										
											2016-11-23 13:49:57 -08:00
										 |  |  |       console.log('>> ' + msg); | 
					
						
							| 
									
										
										
										
											2016-09-07 16:04:33 -07:00
										 |  |  |       if (logEntry.level.value >= webdriver.logging.Level.INFO.value) { | 
					
						
							|  |  |  |         errors.push(msg); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     expect(errors).toEqual([]); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |