@@ -11,28 +11,46 @@ public class ElectronFixture : IAsyncLifetime
1111
1212 public async Task InitializeAsync ( )
1313 {
14- AppDomain . CurrentDomain . SetData ( "ElectronTestAssembly" , Assembly . GetExecutingAssembly ( ) ) ;
15- var runtimeController = ElectronNetRuntime . RuntimeController ;
16- await runtimeController . Start ( ) ;
17- await runtimeController . WaitReadyTask ;
18-
19- // create hidden window for tests (avoid showing UI)
20- this . MainWindow = await Electron . WindowManager . CreateWindowAsync ( new BrowserWindowOptions
14+ try
2115 {
22- Show = false ,
23- Width = 800 ,
24- Height = 600 ,
25- } , "about:blank" ) ;
16+ Console . Error . WriteLine ( "[ElectronFixture] InitializeAsync: start" ) ;
17+ AppDomain . CurrentDomain . SetData ( "ElectronTestAssembly" , Assembly . GetExecutingAssembly ( ) ) ;
18+ Console . Error . WriteLine ( "[ElectronFixture] Acquire RuntimeController" ) ;
19+ var runtimeController = ElectronNetRuntime . RuntimeController ;
20+ Console . Error . WriteLine ( "[ElectronFixture] Starting Electron runtime..." ) ;
21+ await runtimeController . Start ( ) ;
22+ Console . Error . WriteLine ( "[ElectronFixture] Waiting for Ready..." ) ;
23+ await runtimeController . WaitReadyTask ;
24+ Console . Error . WriteLine ( "[ElectronFixture] Runtime Ready" ) ;
2625
27- // Clear potential cache side-effects
28- await this . MainWindow . WebContents . Session . ClearCacheAsync ( ) ;
26+ // create hidden window for tests (avoid showing UI)
27+ Console . Error . WriteLine ( "[ElectronFixture] Creating hidden BrowserWindow" ) ;
28+ this . MainWindow = await Electron . WindowManager . CreateWindowAsync ( new BrowserWindowOptions
29+ {
30+ Show = false ,
31+ Width = 800 ,
32+ Height = 600 ,
33+ } , "about:blank" ) ;
34+
35+ Console . Error . WriteLine ( "[ElectronFixture] Clearing session cache" ) ;
36+ await this . MainWindow . WebContents . Session . ClearCacheAsync ( ) ;
37+ Console . Error . WriteLine ( "[ElectronFixture] InitializeAsync: done" ) ;
38+ }
39+ catch ( Exception ex )
40+ {
41+ Console . Error . WriteLine ( "[ElectronFixture] InitializeAsync: exception" ) ;
42+ Console . Error . WriteLine ( ex . ToString ( ) ) ;
43+ throw ;
44+ }
2945 }
3046
3147 public async Task DisposeAsync ( )
3248 {
3349 var runtimeController = ElectronNetRuntime . RuntimeController ;
50+ Console . Error . WriteLine ( "[ElectronFixture] Stopping Electron runtime..." ) ;
3451 await runtimeController . Stop ( ) ;
3552 await runtimeController . WaitStoppedTask ;
53+ Console . Error . WriteLine ( "[ElectronFixture] Runtime stopped" ) ;
3654 }
3755 }
3856
0 commit comments