public void MergeScreenshotAndWaitUntilDialogClosed(RepoItemInfo formInfo) { try { formInfo.WaitForExists(2000); Report.Screenshot(ReportLevel.Info, "User", "", formInfo.FindAdapter <Form>(), false); Report.Info("Waiting 4h to not exist. Associated repository item: 'formInfo'" + formInfo.ToString()); formInfo.WaitForNotExists(14400000); } catch (Exception) { } }
public override RanorexStepExecutionResponse Execute(Dictionary <string, object> arguments) { RanorexStepExecutionResponse stepResponse = new RanorexStepExecutionResponse(); try { RepoItemInfo repoItemInfo = null; string target = (string)arguments.GetValueOrDefault <string, object>("target"); string waitAction = (string)arguments.GetValueOrDefault <string, object>("waitAction"); int waitTimeout = Convert.ToInt32(arguments.GetValueOrDefault <string, object>("waitTimeout")); int timeout = Convert.ToInt32(arguments.GetValueOrDefault <string, object>("timeout")); if (waitAction == default(string)) { throw new Exception("No wait action defined!"); } if (target != default(string)) { repoItemInfo = CreateItemInfo(repo, target, timeout); } if (repoItemInfo != null) { switch (waitAction) { case "Exists": repoItemInfo.WaitForExists(waitTimeout); break; case "NotExists": repoItemInfo.WaitForNotExists(waitTimeout); break; } } else { throw new Exception("No target defined!"); } stepResponse.success = true; } catch (Exception e) { stepResponse.message = "Ranorex Exception: " + e.Message; stepResponse.success = false; } return(stepResponse); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; TestReport.BeginTestModule(this.GetType().Name); Global.xdocModule = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config"); Global.CriteriaType = "Entrance"; Global.Proceed = false; Verify V = new Verify(); TestModuleRunner.Run(V); string TenderAmount = ""; string BalanceDue = ""; string Tender = Global.xelModule.Attribute("Tender").Value; if (Host.Local.TryFindSingle <Ranorex.Text>(xPathBalanceDue, 2000, out txtBalanceDue)) { BalanceDue = txtBalanceDue.TextValue.Replace("$", ""); } if (Host.Local.TryFindSingle <Ranorex.Text>(xPathCash, 2000, out txtCash)) { Report.Log(ReportLevel.Info, "Mouse", "Clicking Cash"); txtCash.Click(); } if (Host.Local.TryFindSingle <Ranorex.Text>(xPathAmountPaid, 2000, out txtAmountPaid)) { switch (Tender) { case "Exact": TenderAmount = BalanceDue; break; case "Split w/ Credit Prompt": break; case "Split": break; case "Over": break; default: break; } Report.Log(ReportLevel.Info, "Keyboard", "Typing " + TenderAmount + " and a Return in AmountPaid"); txtAmountPaid.PressKeys(TenderAmount + "{Return}"); } Validate.Exists(xPathChangeDue, 5000, "Change Due Prompt Displayed", false); GamestopAutomationRepository repo = GamestopAutomationRepository.Instance; RepoItemInfo ChangeDueInfo = new RepoItemInfo(repo, "ChangeDue", xPathChangeDue, 30000, null); ChangeDueInfo.WaitForNotExists(30000); //Validate.NotExists(xPathChangeDue,10000,"Change Due Prompt Closed",false); Global.CriteriaType = "Exit"; Global.Proceed = false; TestModuleRunner.Run(V); TestReport.EndTestModule(); if (!Global.Proceed) { TestReport.EndTestCase(TestResult.Failed); } }