Пример #1
0
 public static void CheckForDriver()
 {
     using (BrowserFactory factory = BrowserFactory.GetBrowserFactory(new NullLogger()))
     {
         factory.ValidateDriverSetup();
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes the page mapper at the start of the test run.
        /// </summary>
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();

            var logger = this.objectContainer.Resolve <ILogger>();

            browserFactory = BrowserFactory.GetBrowserFactory(logger);
            this.objectContainer.RegisterInstanceAs(browserFactory, dispose: true);

            var mapper = new PageMapper();

            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterFactoryAs((container) =>
            {
                return(InitializeBrowser(container));
            });

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            this.objectContainer.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            actionRepository = new ActionRepository(this.objectContainer);
            this.objectContainer.RegisterInstanceAs <IActionRepository>(actionRepository);

            var actionPipelineService = new ActionPipelineService(actionRepository);

            this.objectContainer.RegisterInstanceAs <IActionPipelineService>(actionPipelineService);
        }
Пример #3
0
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory = BrowserFactory.GetBrowserFactory(logger);
            var browser = factory.GetBrowser();

            this.objectContainer.RegisterInstanceAs(browser);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterInstanceAs <IScenarioContextHelper>(new ScenarioContextHelper());
            this.objectContainer.RegisterInstanceAs(TokenManager.Current);

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
Пример #4
0
        /// <summary>
        /// Initializes the page mapper at the start of the test run.
        /// </summary>
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory       = BrowserFactory.GetBrowserFactory(logger);
            var configSection = configurationHandler.Value;

            bool reusingBrowser = true;

            if (!configSection.BrowserFactory.ReuseBrowser || Browser == null || Browser.IsDisposed)
            {
                Browser        = factory.GetBrowser();
                reusingBrowser = false;
            }

            if (configSection.BrowserFactory.EnsureCleanSession)
            {
                Browser.ClearCookies();

                if (reusingBrowser)
                {
                    Browser.ClearUrl();
                }
            }

            // NOTE: Don't register the browser to dispose, since doing so breaks the reuseBrowser support.
            // We will dispose it after scenario or test run as appropriate.
            this.objectContainer.RegisterInstanceAs(Browser, dispose: false);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(Browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
Пример #5
0
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            IBrowser browser;

            if (this.reuseBrowser)
            {
                if (!TestRunContext.Current.TryGetValue(out browser))
                {
                    var factory = BrowserFactory.GetBrowserFactory(logger);
                    browser = new ReusableBrowser(factory.GetBrowser());
                    TestRunContext.Current.Set(browser);
                }
            }
            else
            {
                var factory = BrowserFactory.GetBrowserFactory(logger);
                browser = factory.GetBrowser();
            }
            this.objectContainer.RegisterInstanceAs(browser);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterInstanceAs <IScenarioContextHelper>(new ScenarioContextHelper());
            this.objectContainer.RegisterInstanceAs(TokenManager.Current);

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
Пример #6
0
        public void InitializeDriver()
        {
            this.objectContainer.RegisterTypeAs <ProxyLogger, ILogger>();
            var logger = this.objectContainer.Resolve <ILogger>();

            var factory       = BrowserFactory.GetBrowserFactory(logger);
            var configSection = configurationHandler.Value;

            if (!configSection.BrowserFactory.ReuseBrowser || browser == null)
            {
                browser = factory.GetBrowser();
            }

            if (configSection.BrowserFactory.EnsureCleanSession)
            {
                browser.ClearCookies();
            }

            this.objectContainer.RegisterInstanceAs(browser, dispose: true);

            this.objectContainer.RegisterInstanceAs <ISettingHelper>(new WrappedSettingHelper());

            var mapper = new PageMapper();

            mapper.Initialize(browser.BasePageType);
            this.objectContainer.RegisterInstanceAs <IPageMapper>(mapper);

            this.objectContainer.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>();
            this.objectContainer.RegisterTypeAs <TokenManager, ITokenManager>();

            var repository = new ActionRepository(this.objectContainer);

            this.objectContainer.RegisterInstanceAs <IActionRepository>(repository);
            this.objectContainer.RegisterTypeAs <ActionPipelineService, IActionPipelineService>();

            // Initialize the repository
            repository.Initialize();
        }
Пример #7
0
        public static void CheckForDriver()
        {
            var factory = BrowserFactory.GetBrowserFactory(new NullLogger());

            factory.ValidateDriverSetup();
        }
Пример #8
0
 /// <summary>
 /// Sets the browser factory.
 /// </summary>
 /// <param name="newBrowserFactory">The new browser factory.</param>
 internal static void SetBrowserFactory(BrowserFactory newBrowserFactory)
 {
     browserFactory = newBrowserFactory;
 }