/// <summary> /// Set paper source /// </summary> /// <param name="papersource">paper source to set</param> public void SetPaperSource(RegusKioskOriginalSize papersource) { if (!_controller.Click(new UiSelector().ResourceId($"{_packageName}:id/paper_src_btn"))) { throw new DeviceWorkflowException($"Failed to click Paper Source list :: {papersource.GetDescription()}"); } if (!SetOption(papersource.GetDescription())) { throw new DeviceWorkflowException($"Can not set paper source :: {papersource.GetDescription()}"); } }
private void NavigateWelcomeScreen() { const string privacyCheckbox = "com.hp.roam:id/value_prop_privacy_checkbox"; //Ensure we are on the Roam Welcome screen. We've already waited 5 seconds, so it should be there. TimeSpan timeout = TimeSpan.FromSeconds(3); if (!_androidHelper.WaitForAvailableResourceId("com.hp.roam:id/value_prop_title", timeout)) { throw new DeviceWorkflowException($"Roam Welcome screen did not display within {timeout.TotalSeconds} seconds."); } OnStatusUpdate("Welcome screen detected."); if (_androidHelper.WaitForAvailableResourceId(privacyCheckbox, TimeSpan.FromSeconds(1))) { // Accept Privacy Policy _controller.Click(new UiSelector().ResourceId(privacyCheckbox)); // Click the Sign In button _controller.Click(new UiSelector().ResourceId("com.hp.roam:id/value_prop_login")); } }
/// <summary> /// Press the HP Roam app button on the phone. /// </summary> /// <param name="recordMarkers">Whether or not to record performance markers.</param> private void PressRoamAppButton(bool recordMarkers) { string appText = "HP Roam"; TimeSpan timeOut = TimeSpan.FromSeconds(30); if (_androidHelper.WaitForAvailableText(appText, timeOut)) { string msg = "Pressing the HP Roam App Button"; OnStatusUpdate(msg); ExecutionServices.SystemTrace.LogDebug(msg); if (recordMarkers) { WorkflowLogger?.RecordEvent(DeviceWorkflowMarker.AppButtonPress, appText); } _controller.Click(new UiSelector().TextContains(appText)); } else { new DeviceWorkflowException($"The HP Roam app button was not found within {timeOut.TotalSeconds} seconds."); } }
/// <summary> /// Click Print Button /// </summary> public void Print() { if (!_mobile.Click(new UiSelector().ResourceId("com.printeron.droid.phone:id/print_action_print_button"))) { throw new MobileWorkflowException("Can not click Print button"); } if (!string.IsNullOrEmpty(_name)) { _mobile.SetText(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_job_accounting_network_login_edit"), _name); } if (!string.IsNullOrEmpty(_email)) { _mobile.SetText(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_job_accounting_email_address_edit"), _email); } if (!_mobile.Click(new UiSelector().ResourceId("com.printeron.droid.phone:id/fragment_print_setting_button_ok"))) { throw new MobileWorkflowException("Can not file OK button at Print option popup"); } }
/// <summary> /// Set Original Sides for scan source /// </summary> /// <param name="originalSides">original sides to set</param> public void SetOriginalSides(LinkScanOriginalSides originalSides) { if (!originalSides.Equals(GetOriginalSides())) { bool result = true; result &= _controller.Click(new UiSelector().Text("Original Sides")); switch (originalSides) { case LinkScanOriginalSides.Onesided: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("1-sided"), 200, 300)) { Thread.Sleep(1000); result &= _controller.Click(new UiSelector().Text("1-sided")); } break; case LinkScanOriginalSides.Twosided: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("2-sided"), 200, 300)) { Thread.Sleep(1000); result &= _controller.Click(new UiSelector().Text("2-sided")); } break; case LinkScanOriginalSides.Pagesflipup: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("2-sided"), 200, 300)) { Thread.Sleep(1000); result &= _controller.Click(new UiSelector().Text("2-sided")); } result &= _controller.Click(new UiSelector().ResourceId($"{_packageName}:id/chk_check")); break; } if (!result) { throw new DeviceWorkflowException($"Can not set option :: Original Sides to {originalSides.GetDescription()}"); } } }
/// <summary> /// Set Output sides for print output /// </summary> /// <param name="outputSides">output sides to set</param> public void SetOutputSides(LinkPrintOutputSides outputSides) { if (!outputSides.Equals(GetOutputSides())) { bool result = true; if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("Output Sides"))) { result &= _controller.Click(new UiSelector().Text("Output Sides")); } switch (outputSides) { case LinkPrintOutputSides.Onesided: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("1-sided"))) { result &= _controller.Click(new UiSelector().Text("1-sided")); } break; case LinkPrintOutputSides.Twosided: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("2-sided"))) { result &= _controller.Click(new UiSelector().Text("2-sided")); } break; case LinkPrintOutputSides.Pagesflipup: if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().Text("2-sided"))) { result &= _controller.Click(new UiSelector().Text("2-sided")); } if (result &= _controlHelper.WaitingObjectAppear(new UiSelector().ResourceId($"{_packageName}:id/chk_check"))) { result &= _controller.Click(new UiSelector().ResourceId($"{_packageName}:id/chk_check")); } break; } if (!result) { throw new DeviceWorkflowException($"Can not set option :: Output Sides to {outputSides.GetDescription()}"); } } }