| 
									
										
										
										
											2016-10-04 20:39:20 -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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | // Determine if we run under bazel
 | 
					
						
							|  |  |  | const isBazel = !!process.env.RUNFILES; | 
					
						
							| 
									
										
										
										
											2018-07-13 06:35:23 -07:00
										 |  |  | // isBazel needed while 'scripts/ci/test-e2e.sh test.e2e.protractor-e2e' is run
 | 
					
						
							|  |  |  | // on Travis
 | 
					
						
							|  |  |  | // TODO: port remaining protractor e2e tests to bazel protractor_web_test_suite rule
 | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  | // Make sure that the command line is read as the first thing
 | 
					
						
							|  |  |  | // as this could exit node if the help script should be printed.
 | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | const BASE = isBazel ? 'angular/modules' : 'dist/all'; | 
					
						
							|  |  |  | require(`./${BASE}/e2e_util/perf_util`).readCommandLine(); | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | var CHROME_OPTIONS = { | 
					
						
							| 
									
										
										
										
											2016-08-30 14:17:37 -07:00
										 |  |  |   'args': ['--js-flags=--expose-gc', '--no-sandbox'], | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |   'perfLoggingPrefs': { | 
					
						
							|  |  |  |     'traceCategories': 'v8,blink.console,devtools.timeline,disabled-by-default-devtools.timeline' | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var BROWSER_CAPS = { | 
					
						
							|  |  |  |   LocalChrome: { | 
					
						
							|  |  |  |     'browserName': 'chrome', | 
					
						
							|  |  |  |     chromeOptions: CHROME_OPTIONS, | 
					
						
							|  |  |  |     loggingPrefs: { | 
					
						
							|  |  |  |       performance: 'ALL', | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       browser: 'ALL', | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   ChromeOnTravis: { | 
					
						
							|  |  |  |     browserName: 'chrome', | 
					
						
							|  |  |  |     chromeOptions: mergeInto(CHROME_OPTIONS, { | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       'binary': process.env.CHROME_BIN, | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |     }), | 
					
						
							|  |  |  |     loggingPrefs: { | 
					
						
							|  |  |  |       performance: 'ALL', | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       browser: 'ALL', | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | function mergeInto(src, target) { | 
					
						
							|  |  |  |   for (var prop in src) { | 
					
						
							|  |  |  |     target[prop] = src[prop]; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return target; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const config = { | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |   onPrepare: function() { beforeEach(function() { browser.ignoreSynchronization = false; }); }, | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |   restartBrowserBetweenTests: true, | 
					
						
							|  |  |  |   allScriptsTimeout: 11000, | 
					
						
							|  |  |  |   capabilities: process.env.TRAVIS ? BROWSER_CAPS.ChromeOnTravis : BROWSER_CAPS.LocalChrome, | 
					
						
							|  |  |  |   directConnect: true, | 
					
						
							|  |  |  |   framework: 'jasmine2', | 
					
						
							|  |  |  |   jasmineNodeOpts: { | 
					
						
							|  |  |  |     showColors: true, | 
					
						
							|  |  |  |     defaultTimeoutInterval: 60000, | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |     print: function(msg) { console.log(msg); }, | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  |   }, | 
					
						
							|  |  |  |   useAllAngular2AppRoots: true | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | // Bazel has different strategy for how specs and baseUrl are specified
 | 
					
						
							|  |  |  | if (!isBazel) { | 
					
						
							|  |  |  |   config.baseUrl = 'http://localhost:8000/'; | 
					
						
							|  |  |  |   config.specs = [ | 
					
						
							|  |  |  |     'dist/all/**/e2e_test/**/*_perf.spec.js', | 
					
						
							|  |  |  |     'dist/all/**/e2e_test/**/*_perf.js', | 
					
						
							|  |  |  |   ] | 
					
						
							| 
									
										
										
										
											2016-08-30 09:29:39 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-06 15:42:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | exports.config = config; |