public void Should_be_able_to_dispose_of_an_explicit_instance_without_affecting_standard_instance() { SeleniumSupport target = CreateTarget(true); const string serverHost = "localhost"; const int serverPort = 4444; string browserString = _firefoxBrowser; ISelenium defaultInstance = target.Start(serverHost, serverPort, browserString, "http://www.google.co.uk"); Assert.IsNotNull(defaultInstance); Assert.AreEqual(1, target.Instances.Count); ISelenium explicitInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.microsoft.com"); Assert.IsNotNull(explicitInstance); Assert.AreEqual(2, target.Instances.Count); Assert.AreNotSame(defaultInstance, explicitInstance); Assert.AreSame(target.Selenium, defaultInstance); target.DisposeInstance(explicitInstance); Assert.AreEqual(1, target.Instances.Count); Assert.IsNotNull(target.Selenium); // Dispose of class to clear up resources target.Dispose(); }
public void Should_be_able_to_start_multiple_explicit_instances_for_different_sites() { SeleniumSupport target = CreateTarget(true); const string serverHost = "localhost"; const int serverPort = 4444; string browserString = _firefoxBrowser; ISelenium firstInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.google.co.uk"); Assert.IsNotNull(firstInstance); Assert.AreEqual(1, target.Instances.Count); ISelenium secondInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.microsoft.com"); Assert.IsNotNull(secondInstance); Assert.AreEqual(2, target.Instances.Count); Assert.AreNotSame(firstInstance, secondInstance); // Dispose of class to clear up resources target.DisposeInstance(firstInstance); target.DisposeInstance(secondInstance); target.Dispose(); }
private SeleniumSupport CreateTarget(bool showWindow) { if (SeleniumServer == null) { SeleniumServer = SeleniumServer.Create(_location, _package, showWindow); } return(SeleniumSupport.Create(SeleniumServer)); }
public static void AfterWebScenario() { Alerts.AlertDismissAll(SeleniumSupport.driverCache); if (SeleniumSupport.ReuseWebSession) { SeleniumSupport.StopSelenium(); } Assert.AreEqual("", ScenarioContext.Current.SeleniumErrors().ToString(), "Selenium verification errors"); }
public void Should_create_selenium_instance_using_firefox_browser() { SeleniumSupport target = CreateTarget(true); ISelenium actual = target.CreateInstance("localhost", 4444, _firefoxBrowser, "http://www.google.co.uk"); Assert.IsNotNull(actual); Assert.AreEqual(1, target.Instances.Count); // Dispose of the selenium support instance otherwise tests to ensure errors thrown when // it is not running will not work target.Dispose(); }
public static void BeforeRestFulApiScenario() { try { SeleniumSupport.config.Browser = "nonWeb"; SeleniumSupport.config.Version = ""; SeleniumSupport.StartTestSuite(); } catch (Exception ex) { Console.Write(ex.Message); if (ex.InnerException != null) { Console.Write(ex.InnerException.Message ?? ""); } } }
public void Should_start_default_selenium_instance_of_ie() { SeleniumSupport target = CreateTarget(true); const string serverHost = "localhost"; const int serverPort = 4444; string browserString = _ieBrowser; const string browserUrl = "http://www.google.co.uk"; ISelenium actual = target.Start(serverHost, serverPort, browserString, browserUrl); Assert.IsNotNull(actual); Assert.AreEqual(1, target.Instances.Count); Assert.AreSame(target.Selenium, actual); // Dispose of the selenium support instance otherwise tests to ensure errors thrown when // it is not running will not work target.Dispose(); }
public static void BeforeWebScenario() { SeleniumSupport.StartTestSuite(); }
public void Should_thow_exception_when_starting_instance_due_to_url_not_provided() { SeleniumSupport target = CreateTarget(true); target.Start("localhost", 4444, _firefoxBrowser, ""); }
public void Should_thow_exception_when_starting_instance_due_to_browser_string_not_provided() { SeleniumSupport target = CreateTarget(true); target.Start("localhost", 4444, "", "http://www.google.co.uk"); }
public void Should_thow_exception_when_starting_instance_due_to_serverhost_not_provided() { SeleniumSupport target = CreateTarget(true); target.Start("", 4444, _firefoxBrowser, "http://www.google.co.uk"); }