File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
roles/tests-unit/files/FWO.Test Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public async Task GeneratePdf()
3333
3434 string path = "" ;
3535 Platform platform = Platform . Unknown ;
36- const SupportedBrowser wantedBrowser = SupportedBrowser . ChromeHeadlessShell ;
36+ const SupportedBrowser wantedBrowser = SupportedBrowser . Chrome ;
3737
3838 switch ( os . Platform )
3939 {
@@ -48,21 +48,23 @@ public async Task GeneratePdf()
4848 break ;
4949 }
5050
51- InstalledBrowser ? installedBrowser = new BrowserFetcher ( new BrowserFetcherOptions ( ) { Platform = platform , Browser = wantedBrowser , Path = path } ) . GetInstalledBrowsers ( )
51+ BrowserFetcher browserFetcher = new ( new BrowserFetcherOptions ( ) { Platform = platform , Browser = wantedBrowser , Path = path } ) ;
52+
53+ InstalledBrowser ? installedBrowser = browserFetcher . GetInstalledBrowsers ( )
5254 . FirstOrDefault ( _ => _ . Platform == platform && _ . Browser == wantedBrowser ) ;
5355
5456 if ( installedBrowser == null )
5557 {
56- throw new Exception ( $ "Browser: { wantedBrowser } is not installed!") ;
58+ Log . WriteWarning ( "Test Log" , $ "Browser { wantedBrowser } is not installed! Trying to download latest version...") ;
59+ installedBrowser = await browserFetcher . DownloadAsync ( BrowserTag . Latest ) ;
5760 }
5861
5962 Log . WriteInfo ( "Test Log" , $ "Browser Path: { installedBrowser . GetExecutablePath ( ) } ") ;
6063
6164 using IBrowser ? browser = await Puppeteer . LaunchAsync ( new LaunchOptions
6265 {
6366 ExecutablePath = installedBrowser . GetExecutablePath ( ) ,
64- Headless = true ,
65- HeadlessMode = HeadlessMode . Shell
67+ Headless = true
6668 } ) ;
6769
6870 try
You can’t perform that action at this time.
0 commit comments