Example #1
0
        public virtual void RegisterDefaults(IObjectContainer container)
        {
            var serviceProvider = container.Resolve<IServiceProvider>();
            RegisterVsDependencies(container, serviceProvider);

            container.RegisterTypeAs<InstallServices, InstallServices>();
            container.RegisterTypeAs<VsBrowserGuidanceNotificationService, IGuidanceNotificationService>();
            container.RegisterTypeAs<WindowsFileAssociationDetector, IFileAssociationDetector>();
            container.RegisterTypeAs<RegistryStatusAccessor, IStatusAccessor>();

            container.RegisterTypeAs<IntegrationOptionsProvider, IIntegrationOptionsProvider>();
            container.RegisterInstanceAs<IIdeTracer>(VsxHelper.ResolveMefDependency<IVisualStudioTracer>(serviceProvider));
            container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IProjectScopeFactory>(serviceProvider));

            container.RegisterTypeAs<TestRunnerEngine, ITestRunnerEngine>();
            container.RegisterTypeAs<TestRunnerGatewayProvider, ITestRunnerGatewayProvider>();
            container.RegisterTypeAs<MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2010MsTest.ToString());
            container.RegisterTypeAs<ReSharper5TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper5.ToString());
            container.RegisterTypeAs<ReSharper6TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString());
            container.RegisterTypeAs<SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString());
            container.RegisterTypeAs<VS2012RunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2012.ToString());
            container.RegisterTypeAs<AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString());

            container.RegisterTypeAs<StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>();
            container.RegisterTypeAs<DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>();
            container.RegisterTypeAs<StepTextAnalyzer, IStepTextAnalyzer>();

            RegisterCommands(container);
        }
Example #2
0
        protected virtual void RegisterVsDependencies(IObjectContainer container, IServiceProvider serviceProvider)
        {
            var dte = serviceProvider.GetService(typeof(DTE)) as DTE;
            if (dte != null)
            {
                container.RegisterInstanceAs(dte);
                container.RegisterInstanceAs((DTE2)dte);
            }

            container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IOutputWindowService>(serviceProvider));
        }
Example #3
0
        public void RegisterTestConfiguration()
        {
            var configurationBuilder = new ConfigurationBuilder()
                                       .AddJsonFile("appSettings.json")
                                       .AddEnvironmentVariables()
                                       .Build();

            objectContainer.RegisterInstanceAs <IConfiguration>(configurationBuilder);
        }
Example #4
0
        public void BeforeScenario()
        {
            InsightsRetail_TestIter intr = null;

            intr    = new InsightsRetail_TestIter("chrome");
            _driver = intr.driver;
            _objectContainer.RegisterInstanceAs(_driver);
            this.scenario = featureName.CreateNode <Scenario>(this._scenarioContext.ScenarioInfo.Title);
        }
Example #5
0
        public void InitialiseTest()
        {
            WebDriverFactory factory = new WebDriverFactory();
            IWebDriver       driver  = factory.Create(ComponentLibrary.Config.Environment.browser);

            driver.Manage().Window.Maximize();
            _objectContainer.RegisterInstanceAs <IWebDriver>(driver);

            User user = new User();

            user.HasTheAbilityTo(BrowseTheWeb.WithHisBrowser(driver));
            user.HasTheAbilityTo(Access.TheDmi(),
                                 View.Orders(),
                                 View.Settlements());

            _objectContainer.RegisterInstanceAs <User>(user);
            Log.MetaData($"Test start DateTime:  {DateTime.Now}");
        }
 public void SetupContainer()
 {
     _container.RegisterInstanceAs(new FabricClient());
     _container.RegisterInstanceAs <IActorProxyFactory>(new ActorProxyFactory());
     _container.RegisterInstanceAs <IPartitionProxy>(
         new PartitionProxy(
             _container.Resolve <IActorProxyFactory>(),
             _container.Resolve <FabricClient>()
             )
         );
     _container.RegisterInstanceAs <IPoolProxy>(
         new PoolProxy(
             _container.Resolve <IActorProxyFactory>(),
             _container.Resolve <IPartitionProxy>(),
             _container.Resolve <FabricClient>()
             )
         );
 }
Example #7
0
        public void CreateScenario(ScenarioContext scenarioContext)
        {
            _testScope = new TestScopeContext();
            _objectContainer.RegisterInstanceAs <TestScopeContext>(_testScope);

            _testScope.testLinkNotes = @"
         <div style='background: linear-gradient(to right, #30CFD0 0%, #330867 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;font-weight:bold;font-size:1.2rem'>Executing test case: "
                                       + scenarioContext.ScenarioInfo.Title + @"</div>";
        }
 public void RunBeforeScenario()
 {
     seleniumContext.WebDriver.Navigate().GoToUrl(ConfigurationManager.AppSettings["baseUrl"]);
     objectContainer.RegisterInstanceAs <SeleniumContext>(seleniumContext);
     seleniumContext.WebDriver.Manage().Window.Maximize();
     seleniumContext.WebDriver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromMilliseconds(10);
     seleniumContext.WebDriver.Manage().Timeouts().ImplicitWait           = TimeSpan.FromSeconds(10);
     seleniumContext.WebDriver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(60);
 }
Example #9
0
 public void Setup()
 {
     if (IsUiTest())
     {
         var browserName = _scenarioContext.ScenarioInfo.Tags[1];
         _driver = new Driver(browserName);
         _objectContainer.RegisterInstanceAs <Driver>(_driver);
     }
 }
Example #10
0
        public virtual void RegisterDefaults(IObjectContainer container)
        {
            var serviceProvider = container.Resolve<IServiceProvider>();
            RegisterVsDependencies(container, serviceProvider);

            container.RegisterTypeAs<IntegrationOptionsProvider, IIntegrationOptionsProvider>();
            container.RegisterInstanceAs<IIdeTracer>(VsxHelper.ResolveMefDependency<IVisualStudioTracer>(serviceProvider));
            container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IProjectScopeFactory>(serviceProvider));

            container.RegisterTypeAs<TestRunnerEngine, ITestRunnerEngine>();
            container.RegisterTypeAs<TestRunnerGatewayProvider, ITestRunnerGatewayProvider>();
            container.RegisterTypeAs<MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.MsTest.ToString());
            container.RegisterTypeAs<ReSharperTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString());
            container.RegisterTypeAs<SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString());
            container.RegisterTypeAs<AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString());

            RegisterCommands(container);
        }
Example #11
0
        public void WhenIContactQAWorksWithTheFollowingInformation(Table table)
        {
            var     homePage           = _objectContainer.Resolve <HomePage>();
            var     contactPage        = homePage.NavigatetoContactPage();
            dynamic contactDetails     = table.CreateDynamicInstance();
            var     postSubmissionPage = contactPage.SendAMessage(contactDetails.Name, contactDetails.Email, contactDetails.Messsage);

            _objectContainer.RegisterInstanceAs(postSubmissionPage);
        }
Example #12
0
        public void InitializeWebDriver()
        {
            var webDriver = new ChromeDriver();

            webDriver.Manage().Window.Maximize();
            webDriver.Navigate().GoToUrl("http://localhost:52048/");

            _objectContainer.RegisterInstanceAs <IWebDriver>(webDriver);
        }
Example #13
0
        public static void RegisterExtentReport(IObjectContainer objectContainer, TestContext testContext)
        {
            var report = new ExtentHtmlReporter(testContext.UniqueOutputDirectory);
            var extent = new AventStack.ExtentReports.ExtentReports();

            extent.AttachReporter(report);

            objectContainer.RegisterInstanceAs(extent);
        }
Example #14
0
 public static void BeforeTestRun(IObjectContainer container)
 {
     container.RegisterInstanceAs <ITest>(new Test()
     {
         Id = "BeforeTestRun"
     });
     Console.WriteLine("Setting up BDD Tests: deleting test data and rebuilding lookups...");
     StaticHosts.ApiProjectTestFixture = new ApiProjectTestFixture();
 }
        public void GivenIMOnTheQAWorksWebsite()
        {
            var      driver     = _objectContainer.Resolve <IQAWebDriver>();
            var      qaWorksUri = _objectContainer.Resolve <QAWorksUri>();
            MainPage mainPage   = new MainPage(driver);
            var      homePage   = mainPage.Navigate(qaWorksUri.MainUrl);

            _objectContainer.RegisterInstanceAs(homePage);
        }
Example #16
0
 public void CreateWebDriver()
 {
     _driver = new ChromeDriver();
     _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     _driver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(10);
     _driver.Manage().Window.Maximize();
     ScenarioContext.Current.Add("currentDriver", _driver);
     _objectContainer.RegisterInstanceAs <IWebDriver>(_driver);
 }
Example #17
0
        public FrameworkHooks(IObjectContainer container)
        {
            this.container   = container;
            this.environment = TestEnvironment.Current;
            this.dataContext = new DataContext();
            Current          = this.dataContext;

            container.RegisterInstanceAs <IEnvironment>(this.environment);
        }
        public void WhenIRequestForSFARoatpCsvFile()
        {
            var roatpwebdriver = _objectContainer.Resolve <IRoatpWebDriver>();
            var roatpUri       = _objectContainer.Resolve <RoatpUri>();
            RoatpRegisterPage roatpregisterPage = new RoatpRegisterPage(roatpwebdriver);
            var responce = roatpregisterPage.ClickCSVLink(roatpUri.MainUrl);

            _objectContainer.RegisterInstanceAs(responce, "csv");
        }
Example #19
0
 public void StartDriver()
 {
     _driver = new ChromeDriver();
     objectContainer.RegisterInstanceAs <IWebDriver>(_driver);
     _driver.Manage().Window.Maximize();
     _conduitWebpage = new ConduitWebPage(_driver);
     _conduitWebpage.Open();
     _conduitWebpage.GoToSignInPage();
 }
Example #20
0
        /// <summary>
        /// Provides an example of creating and registering a custom Chrome web driver.
        /// </summary>
        private void RegisterCustomChromeBrowser()
        {
            // create our chrome options and set a value
            var chromeOptions = new ChromeOptions();

            chromeOptions.AddArgument("no-sandbox");
            chromeOptions.AddArgument("--lang=" + Lan);



            // Pass options to a new chrome browser and pass into the BrowserSession
            var customChromeDriver = new CustomChromeSeleniumDriver(chromeOptions);

            _browserSession = new BrowserSession(customChromeDriver);

            // Finally, register with the DI container.
            _objectContainer.RegisterInstanceAs(_browserSession);
        }
Example #21
0
 public void InitializeWebDriver(TestContext testContext)
 {
     _webDriver = new ChromeDriver();
     _webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     _webDriver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(10);
     _webDriver.Manage().Window.Maximize();
     objectContainer.RegisterInstanceAs <IWebDriver>(_webDriver);
     int i = 0;
 }
        public void BeforeScenario(TestContext test)
        {
            string browser = test.Properties["browser"].ToString();

            driver = CriaDriver(browser);
            driver.Manage().Window.Maximize();
            objectContainer.RegisterInstanceAs <IWebDriver>(driver);
            testContext = test;
        }
Example #23
0
        public void InitializeEnvironment()
        {
            // settings are hardcoded
#if DEBUG
            {
                var settings = new HardcodedSettings();
                m_Container.RegisterInstanceAs <IEnvironmentSettings>(settings);
            }
#endif

            // enables the user to configure the settings via xml
#if RELEASE
            {
                var settings = new ConfigurableSettings();
                m_Container.RegisterInstanceAs <IEnvironmentSettings>(settings);
            }
#endif
        }
        private void DriverController(string BrowserType)
        {
            _driver = _driverFactory.InitDriver(BrowserType);
            _driver.Manage().Window.Maximize();
            int ip = int.Parse(Configapp["Connection:ImplicitWait"]);

            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ip);
            objectContainer.RegisterInstanceAs <RemoteWebDriver>(_driver);
        }
Example #25
0
        public void BeforeScenario()
        {
            _driver = new Driver();

            _driver.Navigate(Constants.HomeURL);
            _driver.MaximizeWindow();
            _driver.SetTimeout(Constants.Timeout);
            _objectContainer.RegisterInstanceAs <Driver>(_driver);
        }
        private static ICollection <IFeatureDependency> GetFeatureDependencies(IObjectContainer objectContainer)
        {
            if (!objectContainer.IsRegistered <ICollection <IFeatureDependency> >(FeatureDependenciesName))
            {
                objectContainer.RegisterInstanceAs <ICollection <IFeatureDependency> >(new List <IFeatureDependency>(), FeatureDependenciesName);
            }

            return(objectContainer.Resolve <ICollection <IFeatureDependency> >(FeatureDependenciesName));
        }
Example #27
0
 public void Prepare(string name)
 {
     if (!container.IsRegistered <IWebDriver>(name))
     {
         var webdriver = SetupWebDriver();
         container.RegisterInstanceAs(webdriver, name: name);
         _name = name;
     }
 }
Example #28
0
        public void InitializeWebDriver()
        {
            var webDriver = GetWebDriver();

            webDriver.Navigate().GoToUrl(BaseUrl);
            webDriver.Manage().Window.Maximize();
            webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            objectContainer.RegisterInstanceAs(webDriver);
        }
Example #29
0
 public void RunBeforeFeature()
 {
     System.Diagnostics.Debugger.Break();
     bdf = new BrowserSeleniumDriverFactory();
     wd  = new WebDriver(bdf);
     //log.Info("WebDriver driver class: "+ wd);
     objectContainer.RegisterInstanceAs <WebDriver>(wd);
     //log.Info(objectContainer.IsRegistered())
 }
Example #30
0
        // Constructor and Register IWebdDriver as context injection
        public SeleniumWebDriverHooks(IObjectContainer objectContainer)
        {
            ObjectContainer = objectContainer;
            // Use Chrome as testing browser
            SeleniumWebDriver = new ChromeDriver(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName);

            // Register IWebDriver
            ObjectContainer.RegisterInstanceAs <IWebDriver>(SeleniumWebDriver);
        }
    public void CreateWebDriver()
    {
        // or new FirefoxDriver or new WhateverDriver as long as it implements
        // the IWebDriver interface
        ChromeDriver driver = new ChromeDriver();

        // Make 'driver' available for DI
        container.RegisterInstanceAs <IWebDriver>(driver);
    }
Example #32
0
    public async Task RegisterServices()
    {
        var host = Host
                   .CreateDefaultBuilder()
                   .ConfigureServices(services =>
        {
            var config = services.BuildServiceProvider()
                         .GetRequiredService <IConfiguration>();
            services.AddAppSettings <ReferenceArchSpecsSettings>(config);
            services.AddHttpClient();
            services.AddSingleton <ICustomerRepository, CustomerRepository>();
            services.AddSingleton <IOrderRepository, OrderRepository>();
            services.AddMongoDbSettings <CustomerDatabaseSettings, Customer>(config);
            services.AddMongoDbSettings <OrderDatabaseSettings, Order>(config);
        })
                   .Build();

        var settings           = host.Services.GetRequiredService <ReferenceArchSpecsSettings>();
        var customerRepository = host.Services.GetRequiredService <ICustomerRepository>();
        var orderRepository    = host.Services.GetRequiredService <IOrderRepository>();
        var httpClientFactory  = host.Services.GetRequiredService <IHttpClientFactory>();

        if (settings.StartTyeProcess)
        {
            await StartTyeProcess(settings.TyeProcessTimeout);
        }

        await ClearData(customerRepository, settings.Customer1Id);
        await ClearData(customerRepository, settings.Customer2Id);
        await ClearData(customerRepository, settings.Customer3Id);
        await ClearData(customerRepository, settings.CustomerPubSub1Id);
        await ClearData(orderRepository, settings.Order1Id);
        await ClearData(orderRepository, settings.Order2Id);
        await ClearData(orderRepository, settings.Order3Id);
        await ClearData(orderRepository, settings.Order4Id);
        await ClearData(orderRepository, settings.OrderPubSub1Id);
        await ClearData(orderRepository, settings.OrderPubSub2Id);

        _objectContainer.RegisterInstanceAs(settings);
        _objectContainer.RegisterInstanceAs(httpClientFactory);
        _objectContainer.RegisterInstanceAs(new JsonFilesRepository());
        _objectContainer.RegisterInstanceAs(customerRepository);
        _objectContainer.RegisterInstanceAs(orderRepository);
    }
Example #33
0
        public void ChromeDriver()
        {
            var webDriverContext = new WebDriverContext();

            webClient = webDriverContext.CreateChromeDriver();
            objectContainer.RegisterInstanceAs <WebClient>(webClient);
            objectContainer.RegisterInstanceAs <IWebDriver>(webClient.chromeDriver);
        }
Example #34
0
        static partial void RegisterCommands(IObjectContainer container)
        {
            var serviceProvider = container.Resolve<IServiceProvider>();

            container.RegisterInstanceAs<MenuCommandHandler>(new DelegateMenuCommandHandler(serviceProvider, container.Resolve<DTE>(),
                    (_1, _2) => System.Windows.MessageBox.Show("generate skeleton")), SpecFlowCmdSet.GenerateStepDefinitionSkeleton.ToString());
            container.RegisterTypeAs<RunScenariosCommand, MenuCommandHandler>(SpecFlowCmdSet.RunScenarios.ToString());
            container.RegisterTypeAs<DebugScenariosCommand, MenuCommandHandler>(SpecFlowCmdSet.DebugScenarios.ToString());
            container.RegisterTypeAs<ReGenerateAllCommand, MenuCommandHandler>(SpecFlowCmdSet.ReGenerateAll.ToString());
        }
 public void Setup()
 {
     container = GeneratorContainerBuilder.CreateContainer(new SpecFlowConfigurationHolder(), new ProjectSettings());
     unitTestGeneratorProviderMock = new Mock<IUnitTestGeneratorProvider>();
     container.RegisterInstanceAs(unitTestGeneratorProviderMock.Object);
 }
 public void Setup()
 {
     container = GeneratorContainerBuilder.CreateContainer(new SpecFlowConfigurationHolder(), new ProjectSettings());
     container.RegisterInstanceAs<IUnitTestGeneratorProvider>(container.Resolve<XUnitTestGeneratorProvider>());
 }