Exemplo n.º 1
0
        public void SetUp()
        {
            _browserHostFactory    = Substitute.For <IBrowserHostFactory>();
            _parser                = Substitute.For <IBrowserConfigurationParser>();
            _capabilitiesBuilder   = Substitute.For <ICapabilitiesBuilder>();
            _configurationProvider = Substitute.For <IConfigurationProvider>();

            _capabilitiesBuilder.WithTestSpecification(Arg.Any <TestSpecification>()).Returns(_capabilitiesBuilder);
            _capabilitiesBuilder.WithRunTestLocally(Arg.Any <bool>()).Returns(_capabilitiesBuilder);
            _sut = new RemoteBrowserConfigurator(_browserHostFactory, _parser, _capabilitiesBuilder, _configurationProvider);
        }
Exemplo n.º 2
0
        public IBrowserHost CreateAndConfigure(TestSpecification testSpecification, string browser = null)
        {
            var builder = _capabilitiesBuilder.WithTestSpecification(testSpecification);
            BrowserConfiguration browserConfiguration = null;

            if (browser != null)
            {
                browserConfiguration = _parser.Parse(browser);
                builder.WithBrowserConfiguration(browserConfiguration);
            }

            var capabilities = builder.WithRunTestLocally(_configurationProvider.RunTestLocally).Build();

            return(_configurationProvider.LocalBrowser.HasValue
                ? _browserHostFactory.CreateLocalWebDriver(_configurationProvider.LocalBrowser.Value, browserConfiguration)
                : _browserHostFactory.CreateWithCapabilities(capabilities, browserConfiguration));
        }