public void StartChromeTest() { if (_chromeProcessFactory == null) { var chromePath = ChromePathFinder.GetChromePath(new NativeFsAbstraction()); _chromeProcessFactory = new ChromeProcessFactory(chromePath); } if (_chromeProcess == null) { try { _chromeProcess = _chromeProcessFactory.Create($"http://localhost:{_webServer.Port}/bb/test/"); } catch (Exception ex) { Console.WriteLine("Failed To Start Chrome Headless"); Console.WriteLine(ex); } } }
void ThrowsExceptionWhenChromeNorChromiumIsNotFound() { Exception ex = Assert.Throws <Exception>(() => ChromePathFinder.GetChromePath(new FakeFs(true))); Assert.Equal("Chrome not found. Install Google Chrome or Chromium.", ex.Message); }
void ReturnsLinuxPathIfIsUnixFs() { var chromePath = ChromePathFinder.GetChromePath(new FakeFs(true, "/opt/google/chrome/google-chrome")); Assert.Equal("/opt/google/chrome/google-chrome", chromePath); }
void ReturnsLinuxChromiumBrowserPathIfIsUnixFsAndChromeNotInstalled() { var chromePath = ChromePathFinder.GetChromePath(new FakeFs(true, "/usr/bin/chromium-browser")); Assert.Equal("/usr/bin/chromium-browser", chromePath); }
void ReturnsWindowsPathIfNotUnixFs() { var chromePath = ChromePathFinder.GetChromePath(new FakeFs(false, @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")); Assert.Equal(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", chromePath); }