private EnvironmentManager()
        {
            string          currentDirectory = this.CurrentDirectory;
            string          content          = File.ReadAllText(Path.Combine(currentDirectory, "appconfig.json"));
            TestEnvironment env = JsonConvert.DeserializeObject <TestEnvironment>(content);

            string        activeDriverConfig    = TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
            string        activeWebsiteConfig   = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig);
            string        driverServiceLocation = TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
            DriverConfig  driverConfig          = env.DriverConfigs[activeDriverConfig];
            WebsiteConfig websiteConfig         = env.WebSiteConfigs[activeWebsiteConfig];

            this.driverFactory = new DriverFactory(driverServiceLocation);

            Assembly driverAssembly = Assembly.Load(driverConfig.AssemblyName);

            driverType         = driverAssembly.GetType(driverConfig.DriverTypeName);
            browser            = driverConfig.BrowserValue;
            remoteCapabilities = driverConfig.RemoteCapabilities;

            urlBuilder = new UrlBuilder(websiteConfig);

            DirectoryInfo info = new DirectoryInfo(currentDirectory);

            while (info != info.Root && string.Compare(info.Name, "buck-out", StringComparison.OrdinalIgnoreCase) != 0 && string.Compare(info.Name, "build", StringComparison.OrdinalIgnoreCase) != 0)
            {
                info = info.Parent;
            }

            info      = info.Parent;
            webServer = new TestWebServer(info.FullName);
            bool autoStartRemoteServer = false;

            if (browser == Browser.Remote)
            {
                autoStartRemoteServer = driverConfig.AutoStartRemoteServer;
            }

            remoteServer = new RemoteSeleniumServer(info.FullName, autoStartRemoteServer);
        }
Beispiel #2
0
        private EnvironmentManager()
        {
            string          currentDirectory = this.CurrentDirectory;
            string          content          = File.ReadAllText(Path.Combine(currentDirectory, "appconfig.json"));
            TestEnvironment env = JsonConvert.DeserializeObject <TestEnvironment>(content);

            string        activeDriverConfig    = TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
            string        activeWebsiteConfig   = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig);
            string        driverServiceLocation = TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
            DriverConfig  driverConfig          = env.DriverConfigs[activeDriverConfig];
            WebsiteConfig websiteConfig         = env.WebSiteConfigs[activeWebsiteConfig];

            this.driverFactory = new DriverFactory(driverServiceLocation);

            Assembly driverAssembly = Assembly.Load(driverConfig.AssemblyName);

            driverType         = driverAssembly.GetType(driverConfig.DriverTypeName);
            Browser            = driverConfig.BrowserValue;
            RemoteCapabilities = driverConfig.RemoteCapabilities;

            UrlBuilder = new UrlBuilder(websiteConfig);

            WebServer = new TestWebServer(UrlBuilder.BaseUrl, currentDirectory);
        }