public async Task ShouldFilterOutIgnoredDefaultArguments() { string[] defaultArgsWithoutUserDataDir = Playwright.GetDefaultArgs(TestConstants.GetDefaultBrowserOptions()); var withUserDataDirOptions = TestConstants.GetDefaultBrowserOptions(); withUserDataDirOptions.UserDataDir = "fake-profile"; string[] defaultArgsWithUserDataDir = Playwright.GetDefaultArgs(withUserDataDirOptions); var launchOptions = TestConstants.GetDefaultBrowserOptions(); launchOptions.UserDataDir = "fake-profile"; launchOptions.IgnoreDefaultArgs = true; launchOptions.IgnoredDefaultArgs = defaultArgsWithUserDataDir.Where(x => !defaultArgsWithoutUserDataDir.Contains(x)).ToArray(); using var browserApp = await Playwright.LaunchBrowserAppAsync(launchOptions); Assert.DoesNotContain("fake-profile", browserApp.Process.StartInfo.Arguments); }
public void ShouldReturnTheDefaultArguments() { if (TestConstants.IsChromium) { Assert.Contains("--no-first-run", Playwright.GetDefaultArgs()); } Assert.Contains(TestConstants.IsFirefox ? "-headless" : "--headless", Playwright.GetDefaultArgs()); Assert.DoesNotContain( TestConstants.IsFirefox ? "-headless" : "--headless", Playwright.GetDefaultArgs(new BrowserArgOptions { Headless = false })); Assert.DoesNotContain( TestConstants.IsFirefox ? "foo" : "--user-data-dir=foo", Playwright.GetDefaultArgs(new BrowserArgOptions { UserDataDir = "foo" })); }