public RecurringTasks(
     IDeviceProperties deviceProperties,
     ILogger logger)
 {
     this.deviceProperties = deviceProperties;
     this.log = logger;
 }
Пример #2
0
 public Agent(
     IDeviceProperties deviceProperties,
     ILogger logger)
 {
     this.deviceProperties = deviceProperties;
     this.log = logger;
 }
Пример #3
0
        public Jobs(AppConfig config, IDeviceProperties deviceProperties, ITenantConnectionHelper tenantConnectionHelper)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.tenantConnectionHelper = tenantConnectionHelper;
            this.deviceProperties       = deviceProperties;
        }
Пример #4
0
        public Jobs(IServicesConfig config, IDeviceProperties deviceProperties)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            this.deviceProperties = deviceProperties;

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.jobClient = JobClient.CreateFromConnectionString(conn); });

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.registryManager = RegistryManager.CreateFromConnectionString(conn); });
        }
Пример #5
0
        public void ChangeSelectedType()
        {
            DeviceType deviceType = fView.TypeCombo.GetSelectedTag <DeviceType>();

            if (deviceType >= 0)
            {
                var internalProps = ALData.DeviceProps[(int)deviceType];
                fView.TSPointsCombo.Enabled = internalProps.HasMeasurements;
            }

            IDeviceProperties devProps = fRecord.GetProperties(deviceType, fRecord.RawProperties);

            if (devProps != null)
            {
                devProps.SetPropNames();
            }
            fView.PropsGrid.SelectedObject = devProps;
        }
 public DevicesController(IDevices devices, IDeviceService deviceService, IDeviceProperties deviceProperties)
 {
     this.deviceProperties = deviceProperties;
     this.devices          = devices;
     this.deviceService    = deviceService;
 }
Пример #7
0
        // TODO: Refactor. Too many parameters.
        public IDriverSession Create(IDeviceProperties deviceProperties, IBrowserProperties browserProperties, RemoteWebDriverSettings remoteWebDriverSettings, EnvironmentSettings environmentSettings, IControlSettings controlSettings, ILogger logger, ITestCaseReporter testCaseReporter, ICommandExecutor httpCommandExecutor)
        {
            if (deviceProperties == null)
            {
                throw new ArgumentNullException(nameof(deviceProperties));
            }
            if (browserProperties == null)
            {
                throw new ArgumentNullException(nameof(browserProperties));
            }
            if (remoteWebDriverSettings == null)
            {
                throw new ArgumentNullException(nameof(remoteWebDriverSettings));
            }
            if (environmentSettings == null)
            {
                throw new ArgumentNullException(nameof(environmentSettings));
            }
            if (controlSettings == null)
            {
                throw new ArgumentNullException(nameof(controlSettings));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (testCaseReporter == null)
            {
                throw new ArgumentNullException(nameof(testCaseReporter));
            }
            if (httpCommandExecutor == null)
            {
                throw new ArgumentNullException(nameof(httpCommandExecutor));
            }

            var browser = default(IWebDriver);

            // There are several kinds of platform we can create our software on:
            // 1. Desktop (ie: 'traditional' Web Browser Automation)
            // 2. Android (Devices)

            if (deviceProperties.Name == "DESKTOP")
            {
                switch (browserProperties.Name)
                {
                case "CHROME":
                    var chromeBrowserSettings = browserProperties.BrowserSettings as ChromeBrowserSettings;
                    if (null == chromeBrowserSettings)
                    {
                        throw new InvalidOperationException($"The browserSettings for {browserProperties.Name} are not availble. Were they correctly registered in the Container? ");
                    }

                    browser = StartBrowser(remoteWebDriverSettings, chromeBrowserSettings, controlSettings);

                    break;

                case "EDGE":
                    var edgeBrowserSettings = browserProperties.BrowserSettings as EdgeBrowserSettings;
                    if (null == edgeBrowserSettings)
                    {
                        throw new InvalidOperationException($"The browserSettings for {browserProperties.Name} are not availble. Were they correctly registered in the Container? ");
                    }

                    browser = StartBrowser(remoteWebDriverSettings, edgeBrowserSettings, controlSettings);

                    break;

                case "INTERNETEXPLORER":
                    var ieBrowserSettings = browserProperties.BrowserSettings as InternetExplorerBrowserSettings;
                    if (null == ieBrowserSettings)
                    {
                        throw new InvalidOperationException($"The browserSettings for {browserProperties.Name} are not availble. Were they correctly registered in the Container? ");
                    }

                    browser = StartBrowser(remoteWebDriverSettings, ieBrowserSettings, controlSettings);

                    break;

                case "FIREFOX":
                    var ffBrowserSettings = browserProperties.BrowserSettings as FireFoxBrowserSettings;
                    if (null == ffBrowserSettings)
                    {
                        throw new InvalidOperationException($"The browserSettings for {browserProperties.Name} are not availble. Were they correctly registered in the Container? ");
                    }

                    browser = StartBrowser(remoteWebDriverSettings, ffBrowserSettings, controlSettings);

                    break;

                default:
                    throw new ArgumentOutOfRangeException($"There is no support for starting browsers of type {browserProperties.Name}");
                }

                var decoratedWebDriver = new DecoratedWebDriver(browser, controlSettings, testCaseReporter, logger);

                return(new DriverSession(decoratedWebDriver, environmentSettings, controlSettings, testCaseReporter));
            }

            if (deviceProperties.Name == "ANDROID")
            {
                if (!remoteWebDriverSettings.UseRemoteDriver)
                {
                    throw new InvalidOperationException($"For Appium, we always configure the RemoteWebDriver settings. If running Appium locally, use the 'common-localhost-appium.json' file. ");
                }

                var appiumSettings        = deviceProperties.DeviceSettings as AppiumSettings;
                var appiumSettingsAdapter = new AppiumSettingsAdapter();
                var options = appiumSettingsAdapter.ToAppiumOptions(appiumSettings);

                var androidDriver = default(AndroidDriver);

                foreach (var currentAttempt in Enumerable.Range(1, controlSettings.AppiumDriverCreationRetries))
                {
                    try
                    {
                        androidDriver = new AndroidDriver(httpCommandExecutor, options);

                        break;
                    }
                    catch (Exception ex)
                    {
                        logger.Error($"ERROR: Starting Android Driver attempt {currentAttempt}");
                        logger.Error($"ERROR: {ex}");

                        if (currentAttempt == controlSettings.AppiumDriverCreationRetries)
                        {
                            throw;
                        }
                    }
                }

                return(new DriverSession(new DecoratedWebDriver(androidDriver, controlSettings, testCaseReporter, logger), environmentSettings, controlSettings, testCaseReporter));
            }

            throw new InvalidOperationException($"The device {deviceProperties.Name} is not supported as a Driver Session. ");
        }
 public DevicePropertiesController(IDeviceProperties deviceProperties)
 {
     this.deviceProperties = deviceProperties;
 }