| 
									
										
										
										
											2018-07-06 14:51:37 -07:00
										 |  |  | import { browser } from 'protractor'; | 
					
						
							| 
									
										
										
										
											2019-07-24 08:52:26 -07:00
										 |  |  | import {OnPrepareConfig, runServer} from '@bazel/protractor/protractor-utils'; | 
					
						
							| 
									
										
										
										
											2019-08-15 08:35:33 -07:00
										 |  |  | import * as path from 'path'; | 
					
						
							| 
									
										
										
										
											2018-07-06 14:51:37 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export = function(config: OnPrepareConfig) { | 
					
						
							| 
									
										
										
										
											2019-08-15 08:35:33 -07:00
										 |  |  |   const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver'; | 
					
						
							|  |  |  |   return runServer(config.workspace, config.server, isProdserver ? '-p' : '-port', []) | 
					
						
							| 
									
										
										
										
											2018-07-06 14:51:37 -07:00
										 |  |  |     .then(serverSpec => { | 
					
						
							|  |  |  |       const serverUrl = `http://localhost:${serverSpec.port}`; | 
					
						
							|  |  |  |       console.log(`Server has been started, starting tests against ${serverUrl}`); | 
					
						
							|  |  |  |       browser.baseUrl = serverUrl; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | } |