public void ShouldReturnTheDefaultArguments() { Assert.Contains("--headless", Puppeteer.GetDefaultArgs(TestConstants.DefaultBrowserOptions())); Assert.DoesNotContain("--headless", Puppeteer.GetDefaultArgs(new LaunchOptions { Headless = false })); if (TestConstants.IsChrome) { Assert.Contains("--no-first-run", Puppeteer.GetDefaultArgs(TestConstants.DefaultBrowserOptions())); Assert.Contains("--user-data-dir=\"foo\"", Puppeteer.GetDefaultArgs(new LaunchOptions { UserDataDir = "foo" })); } else { Assert.Contains("--no-remote", Puppeteer.GetDefaultArgs(TestConstants.DefaultBrowserOptions())); Assert.Contains("--foreground", Puppeteer.GetDefaultArgs(TestConstants.DefaultBrowserOptions())); Assert.Contains("--profile", Puppeteer.GetDefaultArgs(new LaunchOptions { UserDataDir = "foo", Product = TestConstants.IsChrome ? Product.Chrome : Product.Firefox, })); Assert.Contains("\"foo\"", Puppeteer.GetDefaultArgs(new LaunchOptions { UserDataDir = "foo", Product = TestConstants.IsChrome ? Product.Chrome : Product.Firefox, })); } }
public void ShouldReturnTheDefaultChromeArguments() { Assert.Contains("--no-first-run", Puppeteer.GetDefaultArgs()); Assert.Contains("--headless", Puppeteer.GetDefaultArgs()); Assert.DoesNotContain("--headless", Puppeteer.GetDefaultArgs(new LaunchOptions { Headless = false })); Assert.Contains("--user-data-dir=\"foo\"", Puppeteer.GetDefaultArgs(new LaunchOptions { UserDataDir = "foo" })); }
public async Task ShouldFilterOutIgnoredDefaultArguments() { var defaultArgs = Puppeteer.GetDefaultArgs(); var options = TestConstants.DefaultBrowserOptions(); options.IgnoredDefaultArgs = new[] { defaultArgs[0], defaultArgs[2] }; using (var browser = await Puppeteer.LaunchAsync(options)) { var spawnargs = browser.Process.StartInfo.Arguments; Assert.DoesNotContain(defaultArgs[0], spawnargs); Assert.Contains(defaultArgs[1], spawnargs); Assert.DoesNotContain(defaultArgs[2], spawnargs); } }