public void Get_Valid_Test() { // Assign PageObjectContext context = new PageObjectContext(PageObjectParserMock.VALID_pomlDirectory); // Act List<PageObjectFile> result = context.Get(); // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); Assert.IsTrue(result.Exists(i => i.Data.Name.Contains("Website A"))); Assert.IsTrue(result.Exists(i => i.Data.Name.Contains("Website B"))); Assert.IsTrue(result.Exists(i => i.Data.Name.Contains("Website C"))); }
/// <summary> /// Create a browser /// </summary> /// <param name="browsers">Browser name</param> public Browser(string browsers) { // Set poml context Pomls = new PageObjectContext(new DirectoryInfo(Common.PomlFiles)).Get(); // Set browser switch (browsers.ToLower()) { case "chrome": IWebDriver = new ChromeDriver(); break; case "chrome-de": ChromeOptions option_de = new ChromeOptions(); option_de.AddArgument("--lang=de"); IWebDriver = new ChromeDriver(); break; case "chrome-fr": ChromeOptions option_fr = new ChromeOptions(); option_fr.AddArgument("--lang=fr"); IWebDriver = new ChromeDriver(); break; case "chrome-es": ChromeOptions option_es = new ChromeOptions(); option_es.AddArgument("--lang=es"); IWebDriver = new ChromeDriver(); break; case "firefox": IWebDriver = new FirefoxDriver(); break; case "firefox-de": FirefoxProfile profile_de = new FirefoxProfile(); profile_de.SetPreference("intl.accept_languages", "de"); IWebDriver = new FirefoxDriver(profile_de); break; case "firefox-fr": FirefoxProfile profile_fr = new FirefoxProfile(); profile_fr.SetPreference("intl.accept_languages", "fr"); IWebDriver = new FirefoxDriver(profile_fr); break; case "firefox-es": FirefoxProfile profile_es = new FirefoxProfile(); profile_es.SetPreference("intl.accept_languages", "es"); IWebDriver = new FirefoxDriver(profile_es); break; case "grid": DesiredCapabilities abilites = new DesiredCapabilities(); abilites.SetCapability(CapabilityType.BrowserName, "firefox"); IWebDriver = new RemoteWebDriver(new Uri(Common.GridPath), abilites); break; case "ie": case "internetexplorer": case "internet explorer": IWebDriver = new InternetExplorerDriver(); break; default: throw new ConfigException("Config file has been incorrectly set up. '" + browsers + "' is not a valid browser option"); } // Browse to test site NavigateTo(Common.SiteUrl); }