File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,11 +13,20 @@ const TEST_LOCAL: boolean = hasSetting('remote') || !!process.env.TRAVIS ?
1313const TEST_EXTENSION = hasSetting ( 'test-extension' ) ;
1414const TIME_MODIFIER = 1.2 ;
1515const LOCAL_URL = 'http://localhost:9515' ;
16- const REMOTE_URL = ( ( ) => {
16+ function ping ( url : string ) : Promise < boolean > {
17+ return new Promise < boolean > ( ( resolve ) => {
18+ http . get ( url , ( ) => {
19+ resolve ( true ) ;
20+ } ) . on ( 'error' , ( ) => {
21+ resolve ( false ) ;
22+ } ) ;
23+ } ) ;
24+ }
25+ const REMOTE_URL = ( async ( ) => {
1726 if ( hasSetting ( 'remote-url' ) ) {
1827 return getSetting ( 'remote-url' ) ;
1928 }
20- if ( process . env . REMOTE_URL ) {
29+ if ( process . env . REMOTE_URL && await ping ( process . env . REMOTE_URL ) ) {
2130 console . log ( 'Using custom remote URL' ) ;
2231 return process . env . REMOTE_URL ;
2332 }
@@ -383,7 +392,7 @@ async function openTestPageURL(capabilities: BrowserstackCapabilities) {
383392
384393before ( 'Driver connect' , async function ( ) {
385394 const url = TEST_LOCAL ?
386- LOCAL_URL : REMOTE_URL ;
395+ LOCAL_URL : await REMOTE_URL ;
387396
388397 global . Promise = _promise ;
389398
@@ -4374,4 +4383,4 @@ after('quit driver', function() {
43744383 } , 600000 ) ;
43754384 }
43764385 } ) ;
4377- } ) ;
4386+ } ) ;
You can’t perform that action at this time.
0 commit comments