File tree Expand file tree Collapse file tree
Tests/CSF.Screenplay.Selenium.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3- using System . Configuration . Assemblies ;
43using System . Linq ;
54using System . Net . Http ;
65using System . Net . Http . Headers ;
98using System . Text ;
109using BrowserStack ;
1110using CSF . Screenplay . Performances ;
12- using Microsoft . Extensions . DependencyInjection ;
1311
1412namespace CSF . Screenplay . Selenium . BrowserStack ;
1513
@@ -21,12 +19,18 @@ public sealed class BrowserStackExtension : IDisposable
2119 IHasPerformanceEvents ? eventBus ;
2220 HttpClient ? httpClient ;
2321
24- public void OnTestRunStarting ( )
22+ public async Task OnTestRunStarting ( )
2523 {
2624 if ( ! BrowserStackEnvironment . IsBrowserStackTest ( ) ) return ;
2725
2826 browserStackLocal = new Local ( ) ;
2927 browserStackLocal . start ( GetBrowserStackLocalArgs ( ) . ToList ( ) ) ;
28+ for ( var i = 0 ; i < 10 ; i ++ )
29+ {
30+ await Task . Delay ( 250 ) ;
31+ if ( browserStackLocal . isRunning ( ) ) break ;
32+ }
33+ if ( ! browserStackLocal . isRunning ( ) ) throw new TimeoutException ( "BrowserStack Local is still not running after 2.5 seconds" ) ;
3034
3135 httpClient = GetHttpClient ( ) ;
3236
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public async Task StartWebAppAsync()
2323 await WaitForWebAppToBeAvailableAsync ( ) ;
2424
2525 browserStack = new BrowserStackExtension ( ) ;
26- browserStack . OnTestRunStarting ( ) ;
26+ await browserStack . OnTestRunStarting ( ) ;
2727 }
2828
2929 [ OneTimeTearDown ]
You can’t perform that action at this time.
0 commit comments