Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
        public void Should_create_selenium_instance_using_ie_browser()
        {
            SeleniumSupport target = CreateTarget(true);

            ISelenium actual = target.CreateInstance("localhost", 4444, _ieBrowser, "http://www.google.co.uk");

            Assert.IsNotNull(actual);
            Assert.AreEqual(1, target.Instances.Count);

            // must dispose of the instance to prevent further tests failing
            target.DisposeInstance(actual);

            // Dispose of the selenium support instance otherwise tests to ensure errors thrown when
            // it is not running will not work
            target.Dispose();
        }