Task ISubSystem.Start() { return(Task.Factory.StartNew(() => { var settings = StoryTellerEnvironment.Get <SerenityEnvironment>(); WebDriverSettings.Import(settings); FubuMvcPackageFacility.PhysicalRootPath = _settings.PhysicalPath; _runtime = _runtimeSource(); var browserLifecycle = WebDriverSettings.GetBrowserLifecyle(ChooseBrowserType()); _hosting = _settings.RootUrl.IsEmpty() ? (ISerenityHosting) new KatanaHosting() : new ExternalHosting(); _application = _hosting.Start(_settings, _runtime, browserLifecycle); _applicationAlterations.Each(x => x(_application)); _binding = _application.Services.GetInstance <BindingRegistry>(); _bindingRegistrations.Each(x => x(_binding)); configureApplication(_application, _binding); _contextualProviders = _runtime.Factory.GetAll <IContextualInfoProvider>(); _runtime.Facility.Register(typeof(IApplicationUnderTest), ObjectDef.ForValue(_application)); _runtime.Facility.Register(typeof(IRemoteSubsystems), ObjectDef.ForValue(this)); })); }
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(); } }
Task ISubSystem.Start() { return(Task.Factory.StartNew(() => { FubuMvcPackageFacility.PhysicalRootPath = _settings.PhysicalPath; _runtime = _runtimeSource(); var browserLifecycle = WebDriverSettings.GetBrowserLifecyle(ChooseBrowserType()); SetupApplicationHost(); _application = _hosting.Start(_settings, _runtime, browserLifecycle); _applicationAlterations.Each(x => x(_application)); _runtime.Facility.Register(typeof(IApplicationUnderTest), ObjectDef.ForValue(_application)); _runtime.Facility.Register(typeof(IRemoteSubsystems), ObjectDef.ForValue(this)); })); }
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); }); }
public SerenitySystem() { _browserBuilder = WebDriverSettings.Read().DriverBuilder(); }