protected override string DoImpl() { try { this.Automator.Session = Guid.NewGuid().ToString(); // It is easier to reparse desired capabilities as JSON instead of re-mapping keys to attributes and calling type conversions, // so we will take possible one time performance hit by serializing Dictionary and deserializing it as Capabilities object var serializedCapability = JsonConvert.SerializeObject(this.ExecutedCommand.Parameters["desiredCapabilities"]); this.Automator.ActualCapabilities = Capabilities.CapabilitiesFromJsonString(serializedCapability); this.Automator.InitializeApp(); if (this.Automator.ActualCapabilities.AutoLaunch) { this.Automator.Deployer.Launch(); this.Automator.ConnectToApp(); } return(this.JsonResponse(ResponseStatus.Success, this.Automator.ActualCapabilities)); } catch (Exception ex) { throw new AutomationException(ex.Message, ex); } }
protected override string DoImpl() { // It is easier to reparse desired capabilities as JSON instead of re-mapping keys to attributes and calling type conversions, // so we will take possible one time performance hit by serializing Dictionary and deserializing it as Capabilities object var serializedCapability = JsonConvert.SerializeObject(this.ExecutedCommand.Parameters["desiredCapabilities"]); this.Automator.ActualCapabilities = Capabilities.CapabilitiesFromJsonString(serializedCapability); this.InitializeApplication(this.Automator.ActualCapabilities.DebugConnectToRunningApp); this.InitializeKeyboardEmulator(this.Automator.ActualCapabilities.KeyboardSimulator); // Gives sometime to load visuals (needed only in case of slow emulation) Thread.Sleep(this.Automator.ActualCapabilities.LaunchDelay); // Update running application process pointing to the real process instead of the launcher in such cases if (this.Automator.Application.HasExited()) { // Add parse process name pass from request var realProcessName = this.ExecutedCommand.Parameters["desiredCapabilities"]["realProcessName"]; // Update launched process by process name if it's exited if (realProcessName != null) { this.Automator.Application.UpdateProcessByName(realProcessName.ToString()); } } return(this.JsonResponse(ResponseStatus.Success, this.Automator.ActualCapabilities)); }
protected override string DoImpl() { var serializedCapability = JsonConvert.SerializeObject(this.ExecutedCommand.Parameters["desiredCapabilities"]); this.Automator.ActualCapabilities = Capabilities.CapabilitiesFromJsonString(serializedCapability); this.InitializeApplication(); FlaNiumKeyboard.SwitchInputLanguageToEng(); // Имеются проблемы ввода текста при активной русской раскладке. Добавлено переключение на английскую раскладку. return(this.JsonResponse(ResponseStatus.Success, this.Automator.ActualCapabilities)); }
protected override string DoImpl() { // It is easier to reparse desired capabilities as JSON instead of re-mapping keys to attributes and calling type conversions, // so we will take possible one time performance hit by serializing Dictionary and deserializing it as Capabilities object var serializedCapability = JsonConvert.SerializeObject(this.ExecutedCommand.Parameters["desiredCapabilities"]); this.Automator.ActualCapabilities = Capabilities.CapabilitiesFromJsonString(serializedCapability); this.InitializeApplication(this.Automator.ActualCapabilities.DebugConnectToRunningApp); this.InitializeKeyboardEmulator(this.Automator.ActualCapabilities.KeyboardSimulator); // Gives sometime to load visuals (needed only in case of slow emulation) Thread.Sleep(this.Automator.ActualCapabilities.LaunchDelay); return(this.JsonResponse(ResponseStatus.Success, this.Automator.ActualCapabilities)); }
protected override string DoImpl() { this.Session = SessionsManager.CreateSession(); var session = this.Session; var serializedCapability = JsonConvert.SerializeObject(this.ExecutedCommand.Parameters["desiredCapabilities"]); session.ActualCapabilities = Capabilities.CapabilitiesFromJsonString(serializedCapability); session.DeviceBridge = new DeviceBridge( session.ActualCapabilities.DeviceName, session.ActualCapabilities.DeviceIpAddress, session.ActualCapabilities.Locale, session.ActualCapabilities.DebugCaptureLogs); if (!session.ActualCapabilities.DebugCodedUi) { Logger.Info("Deploying CodedUI test server."); session.DeviceBridge.DeployCodedUiTestServer(); } if (!string.IsNullOrEmpty(session.ActualCapabilities.App)) { session.DeviceBridge.Install(session.ActualCapabilities.App); } session.CommandForwarder = new Requester( session.DeviceBridge.IpAddress, session.ActualCapabilities.InnerPort); if (WaitForConnection(session) == false) { throw new AutomationException("Could not connect to Test Server", ResponseStatus.SessionNotCreatedException); } return(this.JsonResponse(ResponseStatus.Success, session.ActualCapabilities)); }