Exemplo n.º 1
0
        public void can_do_something_with_web_driver()
        {
            var settings = new WebDriverSettings()
            {
                Browser = BrowserType.Firefox
            };

            using (var browser = settings.DriverBuilder()())
            {
                browser.Navigate().GoToUrl("http://cnn.com");
                var head = browser.FindElement(By.TagName("head"));
                head.TagName.ShouldEqual("head");

                browser.Close();
            }
        }
        public InProcessApplicationUnderTest(ApplicationSettings settings)
        {
            _settings = settings;

            _runtime = new Lazy <FubuRuntime>(() =>
            {
                FubuMvcPackageFacility.PhysicalRootPath = settings.GetApplicationFolder();

                // TODO -- add some diagnostics here
                var runtime = new TSystem().BuildApplication().Bootstrap();
                runtime.Facility.Register(typeof(ICurrentHttpRequest), ObjectDef.ForValue(new StubCurrentHttpRequest()
                {
                    ApplicationRoot = "http://localhost:" + settings.Port
                }));

                return(runtime);
            });

            _urls = new Lazy <IUrlRegistry>(() => _runtime.Value.Facility.Get <IUrlRegistry>());

            _browser = new Lazy <IWebDriver>(() =>
            {
                var reset = startListener(settings, _runtime.Value);

                _disposals.Add(() =>
                {
                    _listener.Stop();
                    _listener.SafeDispose();

                    _listeningThread.Join(3000);
                });

                reset.WaitOne();

                var browser = WebDriverSettings.DriverBuilder()();
                _disposals.Add(browser.Close);

                return(browser);
            });
        }
Exemplo n.º 3
0
 public SerenitySystem()
 {
     _browserBuilder = WebDriverSettings.DriverBuilder();
 }