public void Run() { //*****************Start Scenario 40 - Retech - Card Balance ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; //Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); FnProductionIssueFunctions ProductionIssueFunctions = new FnProductionIssueFunctions(); Global.CurrentScenario = 43; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } } Global.ScenarioExecuted = true; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Global.LogText = @"---> fnDoScenario43 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 40 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start // Check card balance MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.ShellView.CardBalanceButton.Click(); Thread.Sleep(100); repo.CardBalanceInquiryView.AccountNumber.TextValue = "3876608052056"; repo.CardBalanceInquiryView.AccountNumber.PressKeys("{Enter}"); while (!repo.CardBalanceInquiryView.PowerUpRewardsCardBalanceText.Visible) { Thread.Sleep(1000); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Check Card Balance"; Global.Module = "Check Card Balance"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); Thread.Sleep(2000); Keyboard.Press("{Escape}"); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 43"; Global.Module = "Total Time"; DumpStatsQ4.Run(); if (!Global.AbortScenario) { // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); } else { Global.Q4StatBuffer = ""; } Global.LogText = "<--- fnDoScenario43 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 43 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 43***************** }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Start Transaction"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); bool StatsWritten = false; if (Global.DomesticRegister) { Global.LogText = @"Clicking on ReTech screen then press F5"; WriteToLogFile.Run(); repo.ReTechStartTransaction.PressKeys("{F5}"); Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.GenericDialogView.CriticalErrorSavingTransactionCallHInfo.AbsolutePath.ToString(), out element)) { repo.GenericDialogView.ErrorSavingButtonOK.Click(); Thread.Sleep(200); Global.TempErrorString = "Error Saving Transaction"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); } Global.LogText = @"Waiting for logon"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.RetechLoginView.TxtPasswordInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(200); float MetricTimeDiv1000 = MystopwatchQ4.ElapsedMilliseconds / 1000; if (MetricTimeDiv1000 > 20.0 && !StatsWritten) { StatsWritten = true; Global.LogText = @"Process Stats captured waiting for TryFindSingle([F5] Start Transaction TryFindSingle(repo.RetechLoginView.TxtPassword"; WriteToLogFile.Run(); // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", ""); TimeStampPart = "_" + TimeStampPart; string FullCsvFilename = Global.RegisterName; FullCsvFilename = Regex.Replace(FullCsvFilename, @"[-]", "R"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[(]", "_"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[)]", "_"); string CsvFilename = FullCsvFilename + TimeStampPart; FullCsvFilename = FullCsvFilename + TimeStampPart + "_F5_Start_Transaction_pressed_waiting_for_while(!Host.Local.TryFindSingle(repo.RetechLoginView.TxtPassword...)"; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = FullCsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); var proc2 = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\CPU.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc2.Start(); } if (Host.Local.TryFindSingle(repo.GenericDialogView.CriticalErrorSavingTransactionCallHInfo.AbsolutePath.ToString(), out element)) { repo.GenericDialogView.ErrorSavingButtonOK.Click(); Thread.Sleep(200); Global.TempErrorString = "Error Saving Transaction"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); } } } else { // Click on F5 POS Register - international //repo.IPOSScreen.ContainerF7BackOffice.Click("32;55"); repo.IPOSScreen.Self.Click(); Delay.Milliseconds(200); Keyboard.Press("{F5}"); while (!repo.LogOn.InternationalLoginID.Enabled) { Thread.Sleep(100); } repo.LogOn.InternationalLoginID.PressKeys("psu"); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F5] Start Transaction"; Global.Module = "Log On"; DumpStatsQ4.Run(); // Enter Password MystopwatchQ4.Reset(); MystopwatchQ4.Start(); StatsWritten = false; if (Global.DomesticRegister) { Global.LogText = @"Waiting for Password field to appear"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ReTechLogonPasswordInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); float MetricTimeDiv1000 = MystopwatchQ4.ElapsedMilliseconds / 1000; if (MetricTimeDiv1000 > 20.0 && !StatsWritten) { StatsWritten = true; Global.LogText = @"Process Stats captured waiting for (!Host.Local.TryFindSingle(repo.ReTechLogonPassword..."; WriteToLogFile.Run(); // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", ""); TimeStampPart = "_" + TimeStampPart; string FullCsvFilename = Global.RegisterName; FullCsvFilename = Regex.Replace(FullCsvFilename, @"[-]", "R"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[(]", "_"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[)]", "_"); string CsvFilename = FullCsvFilename + TimeStampPart; FullCsvFilename = FullCsvFilename + TimeStampPart + "_waiting_for_(!Host.Local.TryFindSingle(repo.ReTechLogonPassword...)"; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = FullCsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); var proc2 = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\CPU.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc2.Start(); } } Global.LogText = @"Waiting for Password field to be enabled"; WriteToLogFile.Run(); while (!repo.ReTechLogonPassword.Enabled) { Thread.Sleep(100); float MetricTimeDiv1000 = MystopwatchQ4.ElapsedMilliseconds / 1000; if (MetricTimeDiv1000 > 20.0 && !StatsWritten) { StatsWritten = true; Global.LogText = @"Process Stats captured waiting for repo.ReTechLogonPassword.Enabled"; WriteToLogFile.Run(); // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", ""); TimeStampPart = "_" + TimeStampPart; string FullCsvFilename = Global.RegisterName; FullCsvFilename = Regex.Replace(FullCsvFilename, @"[-]", "R"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[(]", "_"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[)]", "_"); string CsvFilename = FullCsvFilename + TimeStampPart; FullCsvFilename = FullCsvFilename + TimeStampPart + "_waiting_for_while(!repo.ReTechLogonPassword.Enabled)"; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = FullCsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); var proc2 = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\CPU.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc2.Start(); } } Global.LogText = @"Entering password"; WriteToLogFile.Run(); repo.RetechLoginView.TxtPassword.PressKeys("advanced{Return}"); Global.LogText = @"Password entered - wating for Add Line F1"; WriteToLogFile.Run(); Thread.Sleep(500); // ############################################################ // If login takes longer than 20 seconds write out process stats while (!Host.Local.TryFindSingle(repo.AddLineItemCommandInfo.AbsolutePath.ToString(), 1000, out element)) { Thread.Sleep(200); float MetricTimeDiv1000 = MystopwatchQ4.ElapsedMilliseconds / 1000; if (MetricTimeDiv1000 > 20.0 && !StatsWritten) { StatsWritten = true; Global.LogText = @"Process Stats captured waiting for TryFindSingle(repo.AddLineItemCommandInfo"; WriteToLogFile.Run(); // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", ""); TimeStampPart = "_" + TimeStampPart; string FullCsvFilename = Global.RegisterName; FullCsvFilename = Regex.Replace(FullCsvFilename, @"[-]", "R"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[(]", "_"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[)]", "_"); string CsvFilename = FullCsvFilename + TimeStampPart; FullCsvFilename = FullCsvFilename + TimeStampPart + "_waiting_for_while(!Host.Local.TryFindSingle(repo.AddLineItemCommand...)"; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = FullCsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); var proc2 = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\CPU.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc2.Start(); } } Global.LogText = @"Wating for Add Line F1 - waiting till Enabled"; WriteToLogFile.Run(); while (!repo.AddLineItemCommand.Enabled) { Thread.Sleep(200); float MetricTimeDiv1000 = MystopwatchQ4.ElapsedMilliseconds / 1000; if (MetricTimeDiv1000 > 20.0 && !StatsWritten) { StatsWritten = true; Global.LogText = @"Process Stats captured waiting for TryFindSingle(repo.AddLineItemCommand.Enabled"; WriteToLogFile.Run(); // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", ""); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", ""); TimeStampPart = "_" + TimeStampPart; string FullCsvFilename = Global.RegisterName; FullCsvFilename = Regex.Replace(FullCsvFilename, @"[-]", "R"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[(]", "_"); FullCsvFilename = Regex.Replace(FullCsvFilename, @"[)]", "_"); string CsvFilename = FullCsvFilename + TimeStampPart; FullCsvFilename = FullCsvFilename + TimeStampPart + "_waiting_for_while(!repo.AddLineItemCommand.Enabled)"; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = FullCsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); var proc2 = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\CPU.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc2.Start(); } if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(200); } } Global.LogText = @"Add Line F1 - found enabled"; WriteToLogFile.Run(); // If Customer Info then just skip by continue if (Host.Local.TryFindSingle(repo.Retech.ContinueButtonCommand2Info.AbsolutePath.ToString(), out element)) { repo.Retech.ContinueButtonCommand2.Click(); Thread.Sleep(100); } } else { // International repo.LogOn.InternationalPassword.PressKeys("advanced{Return}"); //while(!repo.ReservationDeposit.EnterSerialNumber.Enabled) //{ Thread.Sleep(100); } //repo.ReservationDeposit.EnterSerialNumber.PressKeys("{Escape}"); //repo.FormPOS.Self.PressKeys("{Escape}"); Thread.Sleep(100); repo.NotEnrolledEsc.Click(); Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter Password"; Global.Module = "Log On"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Log On"; DumpStatsQ4.Run(); }
public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly //if (Util.IsRestartRequiredForWinAppAccess) // return Util.RestartWithUiAccess(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); SpeechSynthesizer Speech = new SpeechSynthesizer(); Keyboard.AbortKey = System.Windows.Forms.Keys.Escape; int error = 0; // To autorun Scripts in directory <C: on reg1, D: on reg 2-n>/PAL/RanorexStudio Projects\Ranorex Automation\Alpha\bin\Debug // NOTE: autorun is assumed to be type Baseline // RanorexAutomation.exe auto [<iteratins-time> [<Scenario-list>] ] // <iteratins-time> = number iterations // <iteratins-time> = time to stop "6:00 am" // <iteratins-time> = time to start and stop "6:00 am to 3:00 PM" // <Scenario-list> = list if scenarios to run comma delited "3,4,6-20" // If neither <iteratins-time> or <Scenario-list> supplied will run using same paramaters as last run // Just auto <iterations-time> can be given, will ust last run scenario list // Get command line argumets Global.CommandLineArg0 = ""; Global.CommandLineArg1 = ""; Global.CommandLineArg2 = ""; Global.CommandLineArg3 = ""; string[] RanorexCmdLine = Environment.GetCommandLineArgs(); int Arguments = args.Length; switch (Arguments) { case 1: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); break; case 2: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); Global.CommandLineArg2 = RanorexCmdLine[2].ToUpper(); break; case 3: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); Global.CommandLineArg2 = RanorexCmdLine[2].ToUpper(); Global.CommandLineArg3 = RanorexCmdLine[3].ToUpper(); break; } // For debugging auto run // Global.CommandLineArg1 = "AUTO"; // Global.CommandLineArg2 = "1"; // Global.CommandLineArg3 = "3"; // Report.Log(ReportLevel.Info, "CommandLineStuff", // "\n" + "Arglen: " + Arguments + "\n" + // "Zero: " + Global.CommandLineArg0 + "\n" + // "One: " + Global.CommandLineArg1 + "\n" + // "Two: " + Global.CommandLineArg2 + "\n" + // "Three: " + Global.CommandLineArg3 + "\n" // , new RecordItemIndex(0)); // Thread.Sleep(10000); // Environment.Exit(0); // Onetime delay for Ranorex to setup instrumentation Thread.Sleep(5000); if (Global.CommandLineArg1 == "AUTO") { Global.AutoRun = true; } try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; Global.LogText = "Unexpected exception occurred: " + e.ToString(); WriteToLogFile.Run(); Global.TempErrorString = Global.LogText; WriteToErrorFile.Run(); Global.WavFilePath = "UnexpectedException.wav"; PlayWavFile.Run(); if (Global.DoRegisterSoundAlerts) { Speech.Speak("Register " + Global.RegisterNumber); } } fnTearDown Teardown = new fnTearDown(); Report.Log(ReportLevel.Info, "Main", "Starting Teardown", new RecordItemIndex(0)); TestModuleRunner.Run(Teardown); Report.Log(ReportLevel.Info, "Main", "Teardown Finished", new RecordItemIndex(0)); return(error); }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); fnWaitForItemSearchToFinish WaitForItemSearchToFinish = new fnWaitForItemSearchToFinish(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnProductionIssueFunctions ProductionIssueFunctions = new FnProductionIssueFunctions(); FnEnterSKU EnterSKU = new FnEnterSKU(); Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTrade = new Stopwatch(); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Start Transaction"; WriteToLogFile.Run(); StartTransaction.Run(); if (Global.DomesticRegister) { Global.LogText = @"Enter Customer Information"; WriteToLogFile.Run(); // Enter customer MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.Retech.FindCustomerTextBox.PressKeys("9727651234{Enter}"); Thread.Sleep(100); while (!repo.RetechFindCustomerView.CustomerSearchCriteria.Enabled) { Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Member Card Lookup"; Global.Module = "Member Card Lookup"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); } MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { while (!Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // change 1/8/17 repo.RetechFindCustomerView.ListBoxItem.Click(); while (Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } } int NumberSKUs = 1; if (Global.NumberOfTradesMinusOne == 4) { NumberSKUs = 1; } else if (Global.NumberOfTradesMinusOne == 99) { NumberSKUs = 4; } for (int x = 1; x <= NumberSKUs; x++) { Global.LogText = @"Add Item"; WriteToLogFile.Run(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); // Add Item F1 MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } } Global.LogText = @"Enter purchase SKU"; WriteToLogFile.Run(); // Enter SKUs if (Global.DomesticRegister) { if (NumberSKUs == 1) { repo.AddItemText.TextValue = "115571"; } else { repo.AddItemText.TextValue = "883672"; } repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); Thread.Sleep(200); while (!Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.ShellView.AgeVerifiedCommandWPFInfo.AbsolutePath.ToString(), out element)) { repo.ShellView.AgeVerifiedCommandWPF.Click(); Thread.Sleep(100); } // 11/16/18 } // if(Host.Local.TryFindSingle(repo.ShellView.AgeVerifiedCommandWPFInfo.AbsolutePath.ToString(), out element)) // { repo.ShellView.AgeVerifiedCommandWPF.Click(); // Thread.Sleep(100); // } if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(100); } while (!repo.AddLineItemCommand.Enabled) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); } Thread.Sleep(100); } } else // International { EnterSKU.Run(); // Value set in EnterSKU } } // TimeMinusOverhead.Run((float) MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine // Global.CurrentMetricDesciption = "Enter SKUs"; // Global.Module = "Enter SKUs"; // DumpStatsQ4.Run(); // Global.CurrentMetricDesciption = "Module Total Time"; // DumpStatsQ4.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { switch (Global.RetechVersion.Substring(0, 3)) { case "5.6": while (!repo.Retech.TradeKey_5_6_0_103.Enabled) { Thread.Sleep(100); } break; case "5.7": while (!repo.Retech.TradesF3_5_7_1_2.Enabled) { Thread.Sleep(100); } break; default: while (!repo.Retech.TradesF3_5_7_1_2.Enabled) { Thread.Sleep(100); } break; } } // Press the Trade Key if (Global.DomesticRegister) { Keyboard.Press("{F3}"); while (!Host.Local.TryFindSingle(repo.Retech.TradesTotalInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } } else // International { repo.InternationalInsideSKUField.PressKeys("{F6}"); // Trades while (!repo.TradeIn.InternationalTradeSKUFIeld.Enabled) { Thread.Sleep(100); } } string[] TradeInSKUList = new string[100]; TradeInSKUList[0] = Global.S17Trade1; TradeInSKUList[1] = Global.S17Trade2; TradeInSKUList[2] = Global.S17Trade3; TradeInSKUList[3] = Global.S17Trade4; TradeInSKUList[4] = Global.S17Trade6; // 02-20-18 TradeInSKUList[5] = Global.S17Trade6; TradeInSKUList[6] = Global.S17Trade7; TradeInSKUList[7] = Global.S17Trade8; TradeInSKUList[8] = Global.S17Trade9; TradeInSKUList[9] = Global.S17Trade10; TradeInSKUList[10] = Global.S17Trade11; TradeInSKUList[11] = Global.S17Trade12; TradeInSKUList[12] = Global.S17Trade13; TradeInSKUList[13] = Global.S17Trade14; TradeInSKUList[14] = Global.S17Trade15; TradeInSKUList[15] = Global.S17Trade16; TradeInSKUList[16] = Global.S17Trade17; TradeInSKUList[17] = Global.S17Trade18; TradeInSKUList[18] = Global.S17Trade19; TradeInSKUList[19] = Global.S17Trade20; TradeInSKUList[20] = Global.S17Trade21; TradeInSKUList[21] = Global.S17Trade22; TradeInSKUList[22] = Global.S17Trade23; TradeInSKUList[23] = Global.S17Trade24; TradeInSKUList[24] = Global.S17Trade25; TradeInSKUList[25] = Global.S17Trade1; TradeInSKUList[26] = Global.S17Trade2; TradeInSKUList[27] = Global.S17Trade3; TradeInSKUList[28] = Global.S17Trade4; TradeInSKUList[29] = Global.S17Trade5; TradeInSKUList[30] = Global.S17Trade6; TradeInSKUList[31] = Global.S17Trade7; TradeInSKUList[32] = Global.S17Trade8; TradeInSKUList[33] = Global.S17Trade9; TradeInSKUList[34] = Global.S17Trade10; TradeInSKUList[35] = Global.S17Trade11; TradeInSKUList[36] = Global.S17Trade12; TradeInSKUList[37] = Global.S17Trade13; TradeInSKUList[38] = Global.S17Trade14; TradeInSKUList[39] = Global.S17Trade15; TradeInSKUList[40] = Global.S17Trade16; TradeInSKUList[41] = Global.S17Trade17; TradeInSKUList[42] = Global.S17Trade18; TradeInSKUList[43] = Global.S17Trade19; TradeInSKUList[44] = Global.S17Trade20; TradeInSKUList[45] = Global.S17Trade21; TradeInSKUList[46] = Global.S17Trade22; TradeInSKUList[47] = Global.S17Trade23; TradeInSKUList[48] = Global.S17Trade24; TradeInSKUList[49] = Global.S17Trade25; TradeInSKUList[50] = Global.S17Trade1; TradeInSKUList[51] = Global.S17Trade2; TradeInSKUList[52] = Global.S17Trade3; TradeInSKUList[53] = Global.S17Trade4; TradeInSKUList[54] = Global.S17Trade5; TradeInSKUList[55] = Global.S17Trade6; TradeInSKUList[56] = Global.S17Trade7; TradeInSKUList[57] = Global.S17Trade8; TradeInSKUList[58] = Global.S17Trade9; TradeInSKUList[59] = Global.S17Trade10; TradeInSKUList[60] = Global.S17Trade11; TradeInSKUList[61] = Global.S17Trade12; TradeInSKUList[62] = Global.S17Trade13; TradeInSKUList[63] = Global.S17Trade14; TradeInSKUList[64] = Global.S17Trade15; TradeInSKUList[65] = Global.S17Trade16; TradeInSKUList[66] = Global.S17Trade17; TradeInSKUList[67] = Global.S17Trade18; TradeInSKUList[68] = Global.S17Trade19; TradeInSKUList[69] = Global.S17Trade20; TradeInSKUList[70] = Global.S17Trade21; TradeInSKUList[71] = Global.S17Trade22; TradeInSKUList[72] = Global.S17Trade23; TradeInSKUList[73] = Global.S17Trade24; TradeInSKUList[74] = Global.S17Trade25; TradeInSKUList[75] = Global.S17Trade1; TradeInSKUList[76] = Global.S17Trade2; TradeInSKUList[77] = Global.S17Trade3; TradeInSKUList[78] = Global.S17Trade4; TradeInSKUList[79] = Global.S17Trade5; TradeInSKUList[80] = Global.S17Trade6; TradeInSKUList[81] = Global.S17Trade7; TradeInSKUList[82] = Global.S17Trade8; TradeInSKUList[83] = Global.S17Trade9; TradeInSKUList[84] = Global.S17Trade10; TradeInSKUList[85] = Global.S17Trade11; TradeInSKUList[86] = Global.S17Trade12; TradeInSKUList[87] = Global.S17Trade13; TradeInSKUList[88] = Global.S17Trade14; TradeInSKUList[89] = Global.S17Trade15; TradeInSKUList[90] = Global.S17Trade16; TradeInSKUList[91] = Global.S17Trade17; TradeInSKUList[92] = Global.S17Trade18; TradeInSKUList[93] = Global.S17Trade19; TradeInSKUList[94] = Global.S17Trade20; TradeInSKUList[95] = Global.S17Trade21; TradeInSKUList[96] = Global.S17Trade22; TradeInSKUList[97] = Global.S17Trade23; TradeInSKUList[98] = Global.S17Trade24; TradeInSKUList[99] = Global.S17Trade25; Global.LogText = @"Enter Trade SKUs"; WriteToLogFile.Run(); for (int soff = 0; soff <= Global.NumberOfTradesMinusOne; soff++) { if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); // Add Item F1 MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); // Add Item F1 Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } // Enter SKUs repo.AddItemText.TextValue = TradeInSKUList[soff]; repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); } else // International { // for International SKU search for staring with PO in description // select * from SKU // Where Price >= 1 and description like 'PO%' // order by Price repo.TradeIn.InternationalTradeSKUFIeld.PressKeys("703620{Enter}"); } } if (!Global.DomesticRegister) { while (!repo.TradeIn.InternationalTradeSKUFIeld.Enabled) { Thread.Sleep(100); } repo.TradeIn.InternationalTradeSKUFIeld.PressKeys("{F12}"); // complete tradces } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter Trades"; Global.Module = "Enter Trades"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); if (Global.DomesticRegister) { MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); switch (Global.RetechVersion.Substring(0, 3)) { case "5.6": Global.LogText = @"Clicking on Purchase Mode F2"; WriteToLogFile.Run(); repo.Retech.Self.Focus(); Keyboard.Press("{F2}"); // Purchase Mode F2 Thread.Sleep(100); Global.LogText = @"Clicking Cointinue in Purchase Mode F6"; WriteToLogFile.Run(); repo.Retech.Self.Focus(); Keyboard.Press("{F6}"); // Continue in Purchase Mode F6 // repo.Retech.ContinueToPurchaseMode.Click(); // Continue in Purchase Mode F6 Thread.Sleep(100); Global.LogText = @"Waiting on CustomerInfoEditProfileIcon"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.LineItemCustomerEditorView.CustomerInfoEditProfileIcon_5_6_0_103Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } break; case "5.7": Global.LogText = @"Clicking on Trades F3 Continue F5 button"; WriteToLogFile.Run(); repo.Retech.ContinueButtonCommandTrade_5_7_1_2.Click(); Global.LogText = @"Waiting on CustomerInfoEditProfileIcon"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.EditProfileCommandInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } break; default: Global.LogText = @"Clicking on Trades F3 Continue F5 button"; WriteToLogFile.Run(); repo.Retech.ContinueButtonCommandTrade_5_7_1_2.Click(); // Global.LogText = @"Waiting on CustomerInfoEditProfileIcon"; // WriteToLogFile.Run(); // while(!Host.Local.TryFindSingle(repo.CustomerEditorView.EditProfileCommand_5_7_1_2Info.AbsolutePath.ToString(), out element)) // { Thread.Sleep(100); } break; } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Select Purchase Mode"; Global.Module = "Select Purchase Mode"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); // Start block comment for program flow change MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // ##### Start edit customer Global.LogText = @"F8 edit customer info"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // Edit the customer information // Keyboard.Press("{F8}"); // edit F8 while (!repo.EditProfileCommand.Enabled) { Thread.Sleep(100); } repo.EditProfileCommand.Click(); while (!repo.Gender.Enabled) { Thread.Sleep(100); } if (repo.Gender.SelectedItemText == null) { repo.Gender.SelectedItemText = "Female"; } if (repo.EyeColor.SelectedItemText == null) { repo.EyeColor.SelectedItemText = "Brown"; } if (repo.HairColor.SelectedItemText == null) { repo.HairColor.SelectedItemText = "Brown"; } Thread.Sleep(200); if (repo.CustomerEditorView1.DateOfBirth.TextValue == "") { repo.CustomerEditorView1.DateOfBirth.TextValue = "01/01/1940"; } if (repo.AlternatePhoneValue.TextValue == "") { repo.AlternatePhoneValue.TextValue = "5555555555"; } if (repo.StreetTwoValue.TextValue == "") { repo.StreetTwoValue.TextValue = "10 St"; } if (repo.CustInfoEmail.TextValue == "") { repo.CustInfoEmail.PressKeys("*****@*****.**"); } // ##### End edit customer Global.LogText = @"Save Customer F6"; WriteToLogFile.Run(); Keyboard.Press("{F6}"); // Save Thread.Sleep(200); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Edit Customer Information"; Global.Module = "Edit Customer Information"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); // End block comment MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"F6 Continue to Purchase & Contine to pin pad"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.DialogShellView.WaitingForSignatureInfo.AbsolutePath.ToString(), out element)) { Keyboard.Press("{F6}"); // Continue in Purchase Mode F6 & Continue to Pin Pad F6 Thread.Sleep(500); } Global.LogText = @"Sign on Pin Pad"; WriteToLogFile.Run(); Thread.Sleep(50); repo.RetechPeripheralHostWindow.SignOnPinPad.Click(); Thread.Sleep(50); repo.RetechPeripheralHostWindow.AcceptOnPinPad.Click(); Thread.Sleep(50); repo.RetechPeripheralHostWindow.MinimizePinPad.Click(); // minimize cause always on top!!!! Thread.Sleep(50); repo.DialogShellView.SignatureAcceptedCommand.Click(); Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(100); } // Global.LogText = @"SpecialPriceOverride"; // WriteToLogFile.Run(); // ProductionIssueFunctions.SpecialPriceOverride(12.00m); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.NowCustomerLookup = Global.AdjustedTime; Global.CurrentMetricDesciption = "Sign on Pin Pad"; Global.Module = "Sign on Pin Pad"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); } // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "Cash"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 47"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Thread.Sleep(2000); }
public void Run() { //*****************Start Scenario 35 - Retech - Simple One SKU pay with PURCC ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnEnterSKU EnterSKU = new FnEnterSKU(); Global.CurrentScenario = 35; if (!Global.DoScenarioFlag[Global.CurrentScenario]) // if(Global.CurrentScenario != 9999) { return; } Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchF1 = new Stopwatch(); Global.LogText = @"---> fnDoScenario35 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 35 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Start Transaction"; WriteToLogFile.Run(); // Click on start a transaction while (!Host.Local.TryFindSingle(repo.Retech.StartATransactionInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } repo.Retech.StartATransaction.Click(); if (Host.Local.TryFindSingle(repo.GenericDialogView.CriticalErrorSavingTransactionCallHInfo.AbsolutePath.ToString(), out element)) { repo.GenericDialogView.ErrorSavingButtonOK.Click(); Thread.Sleep(200); Global.TempErrorString = "Error Saving Transaction"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); } MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.RetechLoginView.TxtPasswordInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1500) { repo.Retech.StartATransaction.Click(); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F5] Start Transaction"; Global.Module = "Log On"; DumpStatsQ4.Run(); // Enter Password MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // if(repo.RetechLoginView.UserId.TextValue == "") // { // repo.RetechLoginView.UserId.TextValue = "PSU"; // } repo.RetechLoginView.TxtPassword.PressKeys("advanced{Return}"); switch (Global.RetechVersion.Substring(0, 3)) { case "5.6": while (!repo.Retech.LetsGetStarted_5_6_0_103.Visible) { Thread.Sleep(100); } break; case "5.7": while (!repo.AddLineItemCommand.Enabled) { Thread.Sleep(100); } break; default: while (!repo.AddLineItemCommand.Enabled) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); } Thread.Sleep(100); } break; } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter Password"; Global.Module = "Log On"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Log On"; DumpStatsQ4.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Add Item"; WriteToLogFile.Run(); // Press F1 add item Keyboard.Press("{F1}"); while (!repo.AddItemText.Enabled) { Thread.Sleep(100); } // Enter SKU Global.CurrentSKU = Global.S4Sku1; EnterSKU.Run(); // Press F1 add item Keyboard.Press("{F1}"); while (!repo.AddItemText.Enabled) { Thread.Sleep(100); } // Enter SKU cost 1 penny Global.CurrentSKU = "644917"; EnterSKU.Run(); // Return the SKU MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // Press returns repo.Retech.ReturnsF4.Click(); Thread.Sleep(100); // select add item and add the SKU repo.AddLineItemCommand.Click(); //Thread.Sleep(100); repo.AddItemText.TextValue = Global.S4Sku1; Keyboard.Press("{Enter}"); // Select Defective for retrun reason repo.ReturnReason.Click("246;16"); repo.Retech.ListItemGameStopOESOrdersItemsRetur.Click("153;6"); repo.ReturnReason.PressKeys("{LControlKey down}{LMenu down}"); repo.ReturnReason.PressKeys("{LMenu up}{LControlKey up}"); repo.Retech.DataContextShowCheckoutViewCommand.Click("93;62"); repo.Retech.DataContextShowCheckoutViewCommand.Click("95;56"); //Click on Scan or select receipt and select no receipt repo.Retech.SelectReceipt.Click("369;20"); repo.Retech.NoReceiptAvailableCommand.Click("265;11"); repo.Retech.SelectReceipt.PressKeys("{LControlKey down}{LMenu down}"); repo.Retech.SelectReceipt.PressKeys("{LControlKey up}{LMenu up}"); // Press F5 continue Keyboard.Press("{F5}"); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter Return"; Global.Module = "Add Return"; DumpStatsQ4.Run(); // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "PURCC"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 35"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Global.LogText = "<--- fnDoScenario35 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 35 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 35***************** }
// // P R E C H E C K O U T N O N Z E r o b a l a n c e############################################################################## // private void SpecialPreCheckOutNonZeroBalance() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Check for Please select a charity to donate if (Host.Local.TryFindSingle(repo.RetechPeripheralHostWindow.PleaseSelectACharityToDonateInfo.AbsolutePath.ToString(), out element)) { repo.RetechPeripheralHostWindow.DeclineDonateNoThanks.Click(); Thread.Sleep(100); } Global.LogText = @"Waiting on Time to Check Out - fnProductionIssueFunctions()"; WriteToLogFile.Run(); Thread.Sleep(100); while (!Host.Local.TryFindSingle(repo.Retech.TimeToCheckOutInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Global.LogText = @"Clicked on Continue Button - fnProductionIssueFunctions()"; WriteToLogFile.Run(); Thread.Sleep(100); } Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.Retech.AcknowledgeRelatedProductsCommandInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.Retech.AcknowledgeRelatedProductsCommandInfo.AbsolutePath.ToString(), out element)) { if (repo.Retech.AcknowledgeRelatedProductsCommand.Enabled) { Global.LogText = @"Clicking on acknowledge related products before F12"; WriteToLogFile.Run(); repo.Retech.AcknowledgeRelatedProductsCommand.Click(); Thread.Sleep(100); } } } else if (Host.Local.TryFindSingle(repo.Retech.ContinueF5_5_6_0_103Info.AbsolutePath.ToString(), out element)) { if (repo.Retech.ContinueF5_5_6_0_103.Enabled) { Global.LogText = @"Clicking on F5 Continue before F12"; WriteToLogFile.Run(); repo.Retech.ContinueF5_5_6_0_103.Click(); Thread.Sleep(100); repo.Retech.ButtonCheckout.Click(); Thread.Sleep(100); } } } // Click on screen to make sure in focust - .focus not work //repo.Retech.PaymentView.Click("689;82"); 1-22-19 switch (Global.PayWithMethod) { case "Cash": Global.LogText = @"Waiting on Cash F5"; WriteToLogFile.Run(); repo.Retech.Self.Focus(); Thread.Sleep(100); while (!repo.Retech.RequestCashSettlement.Enabled) { Thread.Sleep(500); } Global.LogText = @"Found Cash F5 Enabled"; WriteToLogFile.Run(); break; case "Credit": case "PURCC": Global.LogText = @"Waiting on Manual Card F6"; WriteToLogFile.Run(); repo.Retech.Self.Focus(); Thread.Sleep(100); while (!repo.Retech.RequestManualCardSettlement.Enabled) { Thread.Sleep(500); } Global.LogText = @"Found Manual Card F6 Enabled"; WriteToLogFile.Run(); break; } // Read Remaining Balance from screen string BalanceDueText = repo.Retech.BalanceDue.TextValue; string BalTemp = BalanceDueText.Substring(1, BalanceDueText.Length - 1); float BalanceDueAmount = float.Parse(BalTemp); string BalanceDueAmountTxt = Convert.ToString(BalanceDueAmount); switch (Global.PayWithMethod) { case "Cash": // Click on Cash F5 button Global.LogText = @"Clicking on Cash F5 button"; WriteToLogFile.Run(); repo.Retech.RequestCashSettlement.Click(); while (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.TxtAmountPaidInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Enter amount paid if (Global.SpecialPayThisAmount == "All") { repo.RetechCardPaymentView.TxtAmountPaid.TextValue = BalanceDueAmountTxt; } else { repo.RetechCardPaymentView.TxtAmountPaid.TextValue = Global.SpecialPayThisAmount; } repo.RetechCardPaymentView.TxtAmountPaid.PressKeys("{Enter}"); break; case "Credit": // Click on Manual Card F6 button Global.LogText = @"Clicking on Manual Card F6 button"; WriteToLogFile.Run(); repo.Retech.RequestManualCardSettlement.Click(); while (!repo.RetechCardPaymentView.RunAsCreditCard.Enabled) { Thread.Sleep(100); } // Click on Run as Credit button Global.LogText = @"Clicking on Run as Credit button"; WriteToLogFile.Run(); repo.RetechCardPaymentView.RunAsCreditCard.Click(); Thread.Sleep(500); repo.RetechCardPaymentView.TxtCardNumber.TextValue = Global.CreditCardNumber; repo.RetechCardPaymentView.TxtExpirationDate.TextValue = Global.CreditCardMonth + "/" + Global.CreditCardYear; repo.RetechCardPaymentView.TxtZipCode.TextValue = Global.CreditCardZip; // Enter amount paid if (Global.SpecialPayThisAmount == "All") { repo.RetechCardPaymentView.TxtAmountToCharge.TextValue = BalanceDueAmountTxt; } else { repo.RetechCardPaymentView.TxtAmountToCharge.TextValue = Global.SpecialPayThisAmount; } repo.RetechCardPaymentView.ProcessCreditCardView.PressKeys("{Enter}"); Thread.Sleep(100); while (!Global.AbortScenario && !Host.Local.TryFindSingle(repo.RetechCardPaymentView.Waiting_for_SignatureInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.RetechCardPaymentView.TryAuthorizingAgainInfo.AbsolutePath.ToString(), out element)) { Global.AbortScenario = true; Global.TempErrorString = "Credit Card Unable to Process Payment - transaction voided"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); Keyboard.Press("{Escape}"); Thread.Sleep(100); repo.Retech.DataContextVoidOrderCommand.Click(); Thread.Sleep(100); repo.GenericDialogView.Yesvoidthistransaction.Click(); Thread.Sleep(100); while (!repo.RetechAnotherTransaction.Visible) { Thread.Sleep(100); } } } if (!Global.AbortScenario) { repo.RetechPeripheralHostWindow.SignOnPinPad.Click(); Thread.Sleep(200); repo.RetechPeripheralHostWindow.AcceptOnPinPad.Click(); Thread.Sleep(200); repo.RetechCardPaymentView.Self.Focus(); Thread.Sleep(100); repo.RetechCardPaymentView.SignatureAcceptedCommand.Click(); Thread.Sleep(200); } break; case "PURCC": // Click on Manual Card F6 button Global.LogText = @"Clicking on Manual Card F6 button"; WriteToLogFile.Run(); repo.Retech.RequestManualCardSettlement.Click(); while (!repo.RetechCardPaymentView.RunAsPURCCCard.Enabled) { Thread.Sleep(100); } // Click on Run as PURCC button (Run as PowerUp Rewards Cerdit Cart Global.LogText = @"Clicking on run as PURCC"; WriteToLogFile.Run(); repo.RetechCardPaymentView.RunAsPURCCCard.Click(); while (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.TxtCardNumberInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Select ID type and Issuer (Drivers Lenense and State) repo.RetechCardPaymentView.PickIdType.SelectedItemText = "Drivers License"; repo.RetechCardPaymentView.PickIdIssuer.Click(); repo.RetechCardPaymentView.PickIdIssuer.SelectedItemText = "Texas"; repo.RetechCardPaymentView.ProcessPrivateLabelCreditCardView.Click(); // Fill in PowerUp Rewards Credit Card Manual Entry repo.RetechCardPaymentView.TxtCardNumber.TextValue = "7788400030000272"; repo.RetechCardPaymentView.TxtNameFromId.TextValue = "PAL User"; repo.RetechCardPaymentView.ProcessPrivateLabelCreditCardView.Click(); repo.RetechCardPaymentView.Self.PressKeys("{Enter}"); Global.LogText = @"Info entered - watching for Waiting for Signature"; WriteToLogFile.Run(); while (!Global.AbortScenario && !Host.Local.TryFindSingle(repo.RetechCardPaymentView.Waiting_for_SignatureInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.RetechCardPaymentView.PaymentCouldNotBeAuthorizedAnUnknInfo.AbsolutePath.ToString(), out element)) { Global.AbortScenario = true; Global.TempErrorString = "PURCC Unable to Process Payment - transaction voided"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); Keyboard.Press("{Escape}"); Thread.Sleep(100); repo.Retech.DataContextVoidOrderCommand.Click(); Thread.Sleep(100); repo.GenericDialogView.Yesvoidthistransaction.Click(); Thread.Sleep(100); while (!repo.RetechAnotherTransaction.Visible) { Thread.Sleep(100); } } } if (!Global.AbortScenario) { repo.RetechPeripheralHostWindow.SignOnPinPad.Click(); Thread.Sleep(200); repo.RetechPeripheralHostWindow.AcceptOnPinPad.Click(); Thread.Sleep(200); repo.RetechCardPaymentView.Self.Focus(); Thread.Sleep(100); repo.RetechCardPaymentView.SignatureAcceptedCommand.Click(); Thread.Sleep(200); } break; } }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Waiting for Performance Dashboard Menu to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.DashBoardF11Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.DashBoardF11.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display Dashboard Menu"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); // // Sales F1 Report // Global.LogText = @"Waiting for Sales F1 Report to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.SalesButtonF1Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.SalesButtonF1.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.SalesButtonF1.Click("184;26"); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.SalesTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.SalesTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display Sales F1 Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); // // Five To Drive F2 Report // Global.LogText = @"Waiting for Five To Drive F2 Report to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.FiveToDriveButtonF2Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.FiveToDriveButtonF2.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.FiveToDriveButtonF2.Click("104;13"); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.FiveToDriveTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.FiveToDriveTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display Five To Drive F2 Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); // // Guest F3 Report // Global.LogText = @"Waiting for Guest F3 Report to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.GuestButtonF3Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.GuestButtonF3.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.GuestButtonF3.Click("160;9"); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.GuestTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.GuestTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display Guest F3 Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); // // Circle of Life F4 Report // Global.LogText = @"Waiting for Circle of Life F4 Report to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.CircleOfLifeButtonF4Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.CircleOfLifeButtonF4.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.CircleOfLifeButtonF4.Click("198;9"); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.CircleOfLifeTaskBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.CircleOfLifeTaskBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display Circle of Life F4 Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); // Sub Circle of Life Reports // F1 Reservations Global.LogText = @"Waiting for F1 Reservations Report to display"; WriteToLogFile.Run(); while (!repo.ShellRoot.SalesButtonF1.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.SalesButtonF1.Click(); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.ReservationsTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.ReservationsTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display F1 Reservations Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); Thread.Sleep(1000); repo.ShellRoot.Self.PressKeys("{Escape}"); Global.LogText = @"Waiting for Circle of Life to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.CircleOfLifeTaskBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.CircleOfLifeTaskBar.Enabled) { Thread.Sleep(100); } // F2 Power Up Rewards Global.LogText = @"Waiting for F2 Power Up Rewards Report to display"; WriteToLogFile.Run(); while (!repo.ShellRoot.FiveToDriveButtonF2.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.FiveToDriveButtonF2.Click(); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.PowerUpRewardsTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.PowerUpRewardsTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display F2 Power Up Rewards Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); Thread.Sleep(1000); repo.ShellRoot.Self.PressKeys("{Escape}"); Global.LogText = @"Waiting for Circle of Life to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.CircleOfLifeTaskBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.CircleOfLifeTaskBar.Enabled) { Thread.Sleep(100); } // Exit Circle of Life Report GoHome(); // // Team F5 Report // Global.LogText = @"Waiting for Team F5 Report to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.TeamF5Info.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.TeamF5.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.ShellRoot.TeamF5.Click("53;11"); Thread.Sleep(100); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.TeamTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.TeamTitleBar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display Team F5 Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); Global.LogText = @"Waiting for Performance Dashboard Menu to display"; WriteToLogFile.Run(); Thread.Sleep(100); // Sub report // F1 Collectible Sales Global.LogText = @"Waiting for F1 Collectible Sales Report to display"; WriteToLogFile.Run(); repo.ShellRoot.Self.PressKeys("{F1}"); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.CollectiblesSalesDollarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.CollectiblesSalesDollar.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Display F1 Collectible Sales Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); Thread.Sleep(1000); repo.ShellRoot.Self.PressKeys("{Escape}"); Global.LogText = @"Waiting for Circle of Life to display"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.ShellRoot.TeamTitleBarInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.TeamTitleBar.Enabled) { Thread.Sleep(100); } // Exit Team Report GoHome(); // My Report Global.LogText = @"Waiting for My Report Report to display"; WriteToLogFile.Run(); repo.ShellRoot.Icon.Click("1;22"); Delay.Milliseconds(200); repo.ShellRoot.MyREPORT.Click("127;23"); Delay.Milliseconds(200); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.EmployeeComparisonCtrlPlusTInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.EmployeeComparisonCtrlPlusT.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display My Report Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); while (Host.Local.TryFindSingle(repo.ShellRoot.EmployeeComparisonCtrlPlusTInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // My Goals Global.LogText = @"Waiting for My Goals Report to display"; WriteToLogFile.Run(); repo.ShellRoot.Icon.Click("1;22"); Delay.Milliseconds(200); repo.ShellRoot.Text.Click("38;9"); Delay.Milliseconds(200); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.EntireStoreInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.EntireStore.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display My Goals Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); // My Schedule Planner Global.LogText = @"Waiting for My Schedule Planner Report to display"; WriteToLogFile.Run(); repo.ShellRoot.Icon.Click("1;22"); Delay.Milliseconds(200); repo.ShellRoot.Text1.Click("87;6"); Delay.Milliseconds(200); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (!Host.Local.TryFindSingle(repo.ShellRoot.SchedulePlannerHeaderInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.ShellRoot.SchedulePlannerHeader.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Display My Schedule Planner Report"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); GoHome(); }
/// <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() { if (!Global.SwitchUploadOnly) { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Global.PhoneNumbertype = ""; // all types // Create the needed classes RanorexRepository repo = new RanorexRepository(); fnGetEndTime GetEndTime = new fnGetEndTime(); fnGetStartTime GetStartTime = new fnGetStartTime(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnDumpStats DumpStats = new fnDumpStats(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); SpeechSynthesizer Speech = new SpeechSynthesizer(); Global.LogFileIndentLevel++; Global.LogText = "IN fnDoScenarios"; WriteToLogFile.Run(); Global.CurrentIteration = 1; if (Global.TimeToStartExecution != "") { Global.LogText = "Waiting for start time - IN fnDoScenarios: " + Global.TimeToStartExecution; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "fnDoScenarios", "Waiting for start time: " + Global.TimeToStartExecution, new RecordItemIndex(0)); bool TimeToStart = false; while (!TimeToStart) { System.DateTime DateTimeNow = System.DateTime.Now; int TimeUp = System.DateTime.Compare(DateTimeNow, Convert.ToDateTime(Global.TimeToStartExecution)); if (TimeUp > 0) { TimeToStart = true; } } } Global.LoopingDone = false; while (!Global.LoopingDone) { try { DoScenarioLooping(); } catch (Exception e) { string sayString = ""; if (e.ToString().IndexOf("Thread was being aborted.") == -1) { sayString = e.ToString().Substring(0, 28); Global.TempErrorString = "Ranorex Crashed Message: " + e.Message; WriteToErrorFile.Run(); Global.WavFilePath = "RanorexCrashed.wav"; PlayWavFile.Run(); if (e.ToString().Contains("MemoryException")) { // Write out Tasklist to file in C:\PAL\Reports String.Empty string TimeStampPart = System.DateTime.Now.ToString(); TimeStampPart = Regex.Replace(TimeStampPart, @"[/]", "-"); TimeStampPart = Regex.Replace(TimeStampPart, @"[:]", "-"); TimeStampPart = Regex.Replace(TimeStampPart, @"[ ]", "_"); TimeStampPart = "(" + TimeStampPart + ")"; string CsvFilename = "Tasklist_(" + Global.RegisterName + ")_" + TimeStampPart; var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Global.Register1DriveLetter + @":\PAL\Reports\GetTaskList.bat", Arguments = CsvFilename, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = Global.Register1DriveLetter + @":\PAL\Reports\" } }; proc.Start(); } ; //Report.Snapshot("/form[@controlname='frmWebBrowserHost']"); if (Global.DoRegisterSoundAlerts) { Speech.Speak(sayString); } Global.WavFilePath = "Error.wav"; PlayWavFile.Run(); PlayWavFile.Run(); PlayWavFile.Run(); PlayWavFile.Run(); string ErrorMessage; ErrorMessage = e.ToString(); Global.LogText = @ErrorMessage; WriteToLogFile.Run(); MessageBox.Show(e.ToString(), "Ranorex has crashed"); fnTearDown Teardown = new fnTearDown(); Report.Log(ReportLevel.Info, "Main", "Starting Teardown", new RecordItemIndex(0)); TestModuleRunner.Run(Teardown); Report.Log(ReportLevel.Info, "Main", "Teardown Finished", new RecordItemIndex(0)); Environment.Exit(0); } } } Global.LogText = "OUT fnDoScenarios"; WriteToLogFile.Run(); Global.LogFileIndentLevel--; } }
public void EnterPRPSKU() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchGPGPRP = new Stopwatch(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } } // Enter SKU MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { while (!repo.AddItemText.Enabled) { Thread.Sleep(100); } if (Global.CurrentSKUOveride) // 12-3-18 { repo.AddItemText.TextValue = Global.CurrentSKUOverideValue; } else { repo.AddItemText.TextValue = "177966"; } repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); Global.LogText = @"Item added"; WriteToLogFile.Run(); Global.LogText = "Adding PRP"; WriteToLogFile.Run(); MystopwatchGPGPRP.Reset(); MystopwatchGPGPRP.Start(); while (!repo.Retech.PRPAddButton.Enabled) { Thread.Sleep(100); } repo.Retech.PRPAddButton.Click(); while (!repo.Retech.SelectCustomer.Enabled) { Thread.Sleep(100); } repo.Retech.PRPSelectCustomerButton.Click(); while (!repo.Retech.ButtonContent.Enabled) { Thread.Sleep(100); } repo.Retech.ButtonContent.Click(); // Search for Customer Thread.Sleep(100); string PRPPhoneNumber = "406254111" + Global.RegisterNumber; repo.RetechFindCustomerView.CustomerLookupTxt.TextValue = PRPPhoneNumber; repo.RetechFindCustomerView.Self.PressKeys("{Enter}"); while (!Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } while (!repo.RetechFindCustomerView.ListBoxItem.Enabled) { Thread.Sleep(100); } repo.RetechFindCustomerView.ListBoxItem.Click(); // accept customer while (Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Process Continue if exists if (Host.Local.TryFindSingle(repo.Retech.ProductReplacementContinueInfo.AbsolutePath.ToString(), out element)) { repo.Retech.ProductReplacementContinue.Click(); Thread.Sleep(100); } } else { // International SKU OBS Mass Effect repo.IPOSScreen.InternationalOutsideSKUField.PressKeys("611547{Enter}"); WriteToLogFile.Run(); Thread.Sleep(100); // while(!repo.IPOS20167172.OBSMASSEFFECTEDGECARDInfo.Exists()) // { Thread.Sleep(100); } if (Host.Local.TryFindSingle(repo.ReservationDeposit.RawTextESCCloseInfo.AbsolutePath.ToString(), out element)) { repo.ReservationDeposit.RawTextESCClose.Click(); } } TimeMinusOverhead.Run((float)MystopwatchGPGPRP.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Add PRP"; Global.Module = "Add PRP"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); // Enter SKU MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { while (!repo.AddItemText.Enabled) { Thread.Sleep(100); } if (Global.CurrentSKUOveride) // 12-3-18 { repo.AddItemText.TextValue = Global.CurrentSKUOverideValue; } else { repo.AddItemText.TextValue = Global.CurrentSKU; } repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); Global.LogText = @"Item added"; WriteToLogFile.Run(); if (!Global.DoingCollectible) { while (!repo.ContinueButtonCommand.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.Retech.ButtonContent2.Click("32;11"); } } else { // International SKU OBS Mass Effect //repo.IPOSScreen.InternationalOutsideSKUField.PressKeys("611547{Enter}"); repo.IPOSInternationalEnterSKUField.Text.PressKeys("611547{Enter}"); // 3/25/19 WriteToLogFile.Run(); Thread.Sleep(100); // while(!repo.IPOS20167172.OBSMASSEFFECTEDGECARDInfo.Exists()) // { Thread.Sleep(100); } if (Host.Local.TryFindSingle(repo.ReservationDeposit.RawTextESCCloseInfo.AbsolutePath.ToString(), out element)) { repo.ReservationDeposit.RawTextESCClose.Click(); } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter SKU"; Global.Module = "Add SKU"; DumpStatsQ4.Run(); // if(Global.DomesticRegister) // { // // Click continue // MystopwatchQ4.Reset(); // MystopwatchQ4.Start(); // switch (Global.RetechVersion.Substring(0,3)) // { // case "5.6": // while(!repo.Retech.ContinueF5_5_6_0_103.Enabled) // { Thread.Sleep(100); } // repo.Retech.ContinueF5_5_6_0_103.Click(); // break; // case "5.7": // while(!repo.ContinueButtonCommand.Enabled) // { Thread.Sleep(100); } // repo.ContinueButtonCommand.Click(); // break; // default: // while(!repo.ContinueButtonCommand.Enabled) // { // if(Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) // { // repo.ContinueButtonCommand.Click(); // } // Thread.Sleep(100); // } // Thread.Sleep(100); // repo.ContinueButtonCommand.Click(); // break; // } // // Global.LogText = @"Waiting for CheckOut F12"; // WriteToLogFile.Run(); // while(!repo.Retech.ButtonCheckout.Enabled) // { Thread.Sleep(100); } // // if(Global.CurrentScenario != 39) // { // TimeMinusOverhead.Run((float) MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine // Global.CurrentMetricDesciption = "Click Continue"; // Global.Module = "Add SKU"; // DumpStatsQ4.Run(); // } // } if (Global.CurrentScenario != 39) { TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.NowCustomerLookup = Global.AdjustedTime; Global.NowEnterSKU = Global.AdjustedTime; Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Add SKU"; DumpStatsQ4.Run(); } }
// #################################################### private void DoScenarioLooping() { RanorexRepository repo = new RanorexRepository(); fnGetEndTime GetEndTime = new fnGetEndTime(); fnGetStartTime GetStartTime = new fnGetStartTime(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnDumpStats DumpStats = new fnDumpStats(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); // Backoffice fnDoScenario13 DoScenario13 = new fnDoScenario13(); fnDoScenario14 DoScenario14 = new fnDoScenario14(); fnDoScenario15 DoScenario15 = new fnDoScenario15(); fnDoScenario18 DoScenario18 = new fnDoScenario18(); fnDoScenario19 DoScenario19 = new fnDoScenario19(); fnDoScenario20 DoScenario20 = new fnDoScenario20(); fnDoScenario21 DoScenario21 = new fnDoScenario21(); // Retech fnDoScenario16 DoScenario16 = new fnDoScenario16(); fnDoScenario33 DoScenario33 = new fnDoScenario33(); fnDoScenario34 DoScenario34 = new fnDoScenario34(); fnDoScenario36 DoScenario36 = new fnDoScenario36(); fnDoScenario37 DoScenario37 = new fnDoScenario37(); fnDoScenario38 DoScenario38 = new fnDoScenario38(); fnDoScenario41 DoScenario41 = new fnDoScenario41(); fnDoScenario42 DoScenario42 = new fnDoScenario42(); fnDoScenario43 DoScenario43 = new fnDoScenario43(); fnDoScenario47 DoScenario47 = new fnDoScenario47(); // Other fnDoScenario50 DoScenario50 = new fnDoScenario50(); fnUpdateItemMDB UpdateItemMDB = new fnUpdateItemMDB(); Global.LogText = "RUN STARTED - IN fnDoScenarios Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); // Decide if limited by number of iterations or time if (Global.IterationsToDo != -1) { // not equal to zero is based on number of iterations Global.StopByTime = false; } else { // equal to -1 means drive by stop time Global.StopByTime = true; } Global.DoDumpStats = false; Global.CurrentScenario = 0; Global.RetechScenariosPerformed = 0; if (Global.RegisterNumber == "1") { Global.LogText = "Updating SKU quantities"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set Qty = 999999 where Qty < 5000"; UpdateItemMDB.Run(); } // If Scenario 37 Reserve Pickup then turn flag off for all SKUs EnforceStreetDate if (Global.DoScenarioFlag[37] && Global.RegisterNumber == "1") { Global.LogText = "Setting all EnforceStreetDates to false"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set EnforceStreetDate = false where EnforceStreetDate = true"; UpdateItemMDB.Run(); Global.LogText = "Setting all IsStreetDateOverridden to true"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set IsStreetDateOverridden = true where IsStreetDateOverridden = false"; UpdateItemMDB.Run(); } // ########## Start the main scenario looping here ########## do { GetStartTime.Run(); // Get Scenario start time InitScenarioStart(); DoScenario13.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario14.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario15.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario16.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario18.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario19.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario20.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario21.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario33.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario34.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario36.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario37.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario38.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario41.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario42.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario43.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario47.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario50.Run(); EndScenarioCleanup(); GetEndTime.Run(); // Get Scenario end time // Dump stats for all scenarios to the stats file Global.CurrentScenario = 0; if (Global.DoDumpStats) { DumpStats.Run(); } Global.CurrentIteration++; // See if time to quit if (!Global.LoopingDone) { if (!Global.StopByTime) { if (Global.CurrentIteration > Global.IterationsToDo) { Global.LoopingDone = true; } } else { System.DateTime DateTimeNow = System.DateTime.Now; string TimeToStopExecution = Global.TimeToStopExecution; int CommaOffset = TimeToStopExecution.IndexOf(","); if (CommaOffset != -1) { TimeToStopExecution = Global.TimeToStopExecution.Substring(0, CommaOffset); } int TimeUp = System.DateTime.Compare(DateTimeNow, Convert.ToDateTime(TimeToStopExecution)); if (TimeUp > 0) { Global.LoopingDone = true; } } } Global.IterationsToday++; // PAL Status Monitor UpdatePALStatusMonitor.Run(); Global.LogText = "Next Iteration"; WriteToLogFile.Run(); } while (!Global.LoopingDone); Global.WavFilePath = "Register" + Global.RegisterNumber + "Finished.wav"; PlayWavFile.Run(); Global.LogText = "RUN FINISHED - OUT fnDoScenarios Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); }
public void Run() { //*****************Start Scenario 37 - Retech - Reserve Pickup ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); FnProductionIssueFunctions ProductionIssueFunctions = new FnProductionIssueFunctions(); Global.CurrentScenario = 37; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } } Global.ScenarioExecuted = true; //string ReservePickupPhoneNumber = "9727651234"; string ReservePickupPhoneNumber = "406254111" + Global.RegisterNumber; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Global.LogText = @"---> fnDoScenario37 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 37 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); //#### Reserve the item StartTransaction.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Start Transaction"; Global.Module = "Reserve:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Reserve Item"; WriteToLogFile.Run(); repo.Retech.FindAProductCtrlPlusS.Click("19;5"); // click in search box Thread.Sleep(100); Keyboard.Press("{F2}"); // Upcoming Thread.Sleep(100); // ######################################################## // Line item: repo.RetechQuickSearchView.SearchResultsView.ListBoxItem; // Price: repo.RetechQuickSearchView.SearchResultsView.NewPrice; // PreOrder: repo.RetechQuickSearchView.SearchResultsView.PreOrder; // SKU: repo.RetechQuickSearchView.SearchResultsView.NewSku; // Number of items in list: repo.RetechQuickSearchView.DisplayedCount; // string SearchCount = repo.RetechQuickSearchView.DisplayedCount.TextValue; // NumberRecordsFound = Convert.ToInt32(SearchCount.Substring(0,SearchCount.IndexOf(" "))); //repo.RetechQuickSearchView.FirstPreOrderItem.Click(); // Click on first pre-order item bool PreOrderFound = false; Global.LogText = @"Searching for PreOrder item in list"; WriteToLogFile.Run(); while (!PreOrderFound) { // Search for and select the first PRE-ORDER item > $10.00 List list = "/form[@automationid='QuickSearchView']/?/?/list[@automationid='SearchResultsView']"; IList <ListItem> items = list.Items; foreach (ListItem EachItem in list.Items) { string TextAmt = EachItem.Children[1].Children[0].GetAttributeValue <string>("Caption"); // Price TextAmt = TextAmt.Substring(1, TextAmt.Length - 1); // remove $ decimal DecAmt = Convert.ToDecimal(TextAmt); // convert to decimal string TheCaption = EachItem.Children[1].Children[1].GetAttributeValue <string>("Caption"); // Item type looking for PRE-ORDER if (DecAmt > 10.00m && TheCaption == "PRE-ORDER") { EachItem.Click(); PreOrderFound = true; break; } } if (!PreOrderFound) { // page down on list of items repo.ShellView.SearchResultsView.Click("627;44"); Delay.Milliseconds(200); Keyboard.Press("{Next}"); } } Thread.Sleep(100); Keyboard.Press("{Escape}"); // Escape from search box Thread.Sleep(100); // Process age verification if exists if (Host.Local.TryFindSingle(repo.Retech.AgeVerifiedCommand1Info.AbsolutePath.ToString(), out element)) { repo.Retech.AgeVerifiedCommand1.Click(); Thread.Sleep(100); } // Get the Initial Deposit amout from the screen Global.SpecialPayThisAmount = repo.Retech.DepositText.TextValue.Substring(1); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Reserve Item"; Global.Module = "Reserve:"; DumpStatsQ4.Run(); // Select Customer MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.Retech.SelectCustomer.Click(); Thread.Sleep(100); repo.Retech.ButtonContent.Click("105;10"); // Search for Customer Thread.Sleep(100); // repo.RetechFindCustomerView.CustomerLookupTxt.PressKeys("9727651234{Enter}"); 12-13-18 repo.RetechFindCustomerView.CustomerLookupTxt.TextValue = ReservePickupPhoneNumber; repo.RetechFindCustomerView.Self.PressKeys("{Enter}"); while (!Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } repo.RetechFindCustomerView.ListBoxItem.Click(); // accept customer Thread.Sleep(500); while (Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Process continue 1 if (Host.Local.TryFindSingle(repo.Retech.ContinueButtonCommand1Info.AbsolutePath.ToString(), out element)) { repo.Retech.ContinueButtonCommand1.Click(); Thread.Sleep(200); } // Process continue 2 if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(200); } // Process SMS text message - not interested if (Host.Local.TryFindSingle(repo.Retech.NotInterestedCommandInfo.AbsolutePath.ToString(), out element)) { repo.Retech.NotInterestedCommand.Click(); Thread.Sleep(200); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Select Customer"; Global.Module = "Reserve:"; DumpStatsQ4.Run(); // Check for Product Replacement Plan if (Host.Local.TryFindSingle(repo.Retech.ProductReplacementContinueInfo.AbsolutePath.ToString(), out element)) { repo.Retech.ProductReplacementContinue.Click(); Thread.Sleep(200); } if (Host.Local.TryFindSingle(repo.Retech.ContinueButtonCommand1Info.AbsolutePath.ToString(), out element)) { repo.Retech.ContinueButtonCommand1.Click(); Thread.Sleep(100); } if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(100); } // Checkout and pay required deposit MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.SpecialCheckingOut = false; Global.PayWithMethod = "Cash"; ProductionIssueFunctions.SpecialPreCheckOut(); ProductionIssueFunctions.SpecialCheckForCodeF4Alert(); repo.RetechLoginView.TxtPassword.PressKeys("{Escape}"); // initial sign on screen TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Pay deposit and checkout"; Global.Module = "Reserve:"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.NowCustomerLookup = Global.AdjustedTime; Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Reserve:"; DumpStatsQ4.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); // ##### Now do the pickup MystopwatchQ4.Reset(); MystopwatchQ4.Start(); StartTransaction.Run(); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Start Transaction 2"; Global.Module = "Pick Up:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // repo.Retech.FindCustomerTextBox.PressKeys("9727651234{Enter}"); // get the customer 12-13-18 repo.Retech.FindCustomerTextBox.TextValue = ReservePickupPhoneNumber; repo.Retech.FindCustomerTextBox.PressKeys("{Enter}"); while (!Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } repo.RetechFindCustomerView.ListBoxItem.Click(); // accept customer while (Host.Local.TryFindSingle(repo.RetechFindCustomerView.ListBoxItemInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // View customer details to get reserve item repo.Retech.ShowCustomerDetails.Click(); while (!Host.Local.TryFindSingle(repo.CustomerDetailsView.OpenReservationListItemControlInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Get the reserved item repo.CustomerDetailsView.OpenReservationListItemControl.Click(); // Click on first reserved item repo.CustomerDetailsView.PickupReservation.Click(); Thread.Sleep(100); repo.OptionSelectorView.StreetDatedProductConfirm.Click(); // Yes sell this street dated itme Thread.Sleep(100); Keyboard.Press("{Escape}"); if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(200); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Get customer and pick up item"; Global.Module = "Pick Up:"; DumpStatsQ4.Run(); /* * // Price override * MystopwatchQ4.Reset(); * MystopwatchQ4.Start(); * * ProductionIssueFunctions.SpecialPriceOverride(1.00m); // lower the price so not so many code F4 alerts * * TimeMinusOverhead.Run((float) MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine * Global.CurrentMetricDesciption = "Price Overide"; * Global.Module = "Pick Up:"; * DumpStatsQ4.Run(); */ // Process age verification if exists if (Host.Local.TryFindSingle(repo.Retech.AgeVerifiedCommand1Info.AbsolutePath.ToString(), out element)) { repo.Retech.AgeVerifiedCommand1.Click(); Thread.Sleep(100); } // Process continue 2 if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(200); } // Now pickup and pay total for item MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.SpecialCheckingOut = false; Global.PayWithMethod = "Cash"; Global.SpecialPayThisAmount = "All"; repo.Retech.DataContextShowCheckoutViewCommand.Click(); ProductionIssueFunctions.SpecialPreCheckOut(); ProductionIssueFunctions.SpecialCheckForCodeF4Alert(); repo.RetechLoginView.TxtPassword.PressKeys("{Escape}"); // initial sign on screen TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Pay for picked up item"; Global.Module = "Pick Up:"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.NowCustomerLookup = Global.AdjustedTime; Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Pick Up:"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 37"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Global.LogText = "<--- fnDoScenario37 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 37 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 37***************** }
public void EnterGPGSKU() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchGPGPRP = new Stopwatch(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } } // Enter SKU MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { while (!repo.AddItemText.Enabled) { Thread.Sleep(100); } if (Global.CurrentSKUOveride) // 12-3-18 { repo.AddItemText.TextValue = Global.CurrentSKUOverideValue; } else { repo.AddItemText.TextValue = "919322"; } repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); Global.LogText = @"Item added"; WriteToLogFile.Run(); Global.LogText = "Adding GPG"; WriteToLogFile.Run(); MystopwatchGPGPRP.Reset(); MystopwatchGPGPRP.Start(); repo.Retech.AddGPGCommand.Click(); while (!repo.Retech.GPGCheckMark.Enabled) { Thread.Sleep(100); } if (!Global.DoingCollectible) { while (!repo.ContinueButtonCommand.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); repo.Retech.ButtonContent2.Click("32;11"); } } else { // International SKU OBS Mass Effect repo.IPOSScreen.InternationalOutsideSKUField.PressKeys("611547{Enter}"); WriteToLogFile.Run(); Thread.Sleep(100); // while(!repo.IPOS20167172.OBSMASSEFFECTEDGECARDInfo.Exists()) // { Thread.Sleep(100); } if (Host.Local.TryFindSingle(repo.ReservationDeposit.RawTextESCCloseInfo.AbsolutePath.ToString(), out element)) { repo.ReservationDeposit.RawTextESCClose.Click(); } } TimeMinusOverhead.Run((float)MystopwatchGPGPRP.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Add GPG"; Global.Module = "Add GPG"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnBrowserGoHome BrowserGoHome = new fnBrowserGoHome(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); SpeechSynthesizer Speech = new SpeechSynthesizer(); Global.LogFileIndentLevel++; Global.LogText = "IN fnWaitForBrowserToLoad"; WriteToLogFile.Run(); Global.POSBrowserFlush = false; Thread.Sleep(5000); int AttemptsCounter = 0; while (!repo.POSBrowserV25StorePortal.HomeF6.Enabled || !repo.StorePortal.QAPOSReCommerce.Enabled || !(repo.POSBrowserV25StorePortal.ProgressBar.Value == 100)) { Thread.Sleep(100); double aaaa = repo.POSBrowserV25StorePortal.ProgressBar.Value; // Check for Oops Game Over Report.Log(ReportLevel.Info, "WaitStatus", "Ck Oops"); if (Host.Local.TryFindSingle(repo.RecommerceTradeLink.OopsGameOverWhatYouWereAttemptingToDoInfo.AbsolutePath.ToString(), out element)) { AttemptsCounter++; GlobalOverhead.Stopwatch.Start(); Global.TempErrorString = "Browser Oops Game Over - pressing home and retrying"; if (Global.DoRegisterSoundAlerts) { Speech.Speak(Global.TempErrorString + " try number " + AttemptsCounter.ToString()); } WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); Global.WavFilePath = "BrowserOopsGameOver.wav "; PlayWavFile.Run(); BrowserGoHome.Run(); GlobalOverhead.Stopwatch.Stop(); } // Check for browser unavailable Report.Log(ReportLevel.Info, "WaitStatus", "Ck browser unavailable"); if (Host.Local.TryFindSingle(repo.StorePortal.POSBrowsingIsCurrentlyUnavailableInfo.AbsolutePath.ToString(), out element)) { AttemptsCounter++; GlobalOverhead.Stopwatch.Start(); Global.TempErrorString = "Browser Unavailable - try go home"; if (Global.DoRegisterSoundAlerts) { Speech.Speak(Global.TempErrorString + " try number " + AttemptsCounter.ToString()); } WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); BrowserGoHome.Run(); GlobalOverhead.Stopwatch.Stop(); } // Check for server error Report.Log(ReportLevel.Info, "WaitStatus", "Ck browser server error"); if (Host.Local.TryFindSingle(repo.RecommerceTradeLink.ServerErrorInApplicationInfo.AbsolutePath.ToString(), out element)) { AttemptsCounter++; GlobalOverhead.Stopwatch.Start(); Global.TempErrorString = "Browser Server Error In Application - try go home"; if (Global.DoRegisterSoundAlerts) { Speech.Speak(Global.TempErrorString + " try number " + AttemptsCounter.ToString()); } WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); BrowserGoHome.Run(); GlobalOverhead.Stopwatch.Stop(); } Report.Log(ReportLevel.Info, "WaitStatus", "look for recommerce link"); if (!Host.Local.TryFindSingle(repo.StorePortal.QAPOSReCommerceInfo.AbsolutePath.ToString(), out element)) { if (AttemptsCounter > Global.MaxRetries) { Global.LogText = "Flushing wait for browser to load"; WriteToLogFile.Run(); Global.POSBrowserFlush = true; } else { } } } Global.LogText = "OUT fnWaitForBrowserToLoad"; WriteToLogFile.Run(); Global.LogFileIndentLevel--; }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTrade = new Stopwatch(); Global.LogFileIndentLevel++; Global.LogText = "IN fnCheckout"; WriteToLogFile.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); // Click on CheckOut F12 button Global.LogText = @"Clicking on F12 Checkout"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // while(!repo.Retech.ButtonCheckout.Enabled) // change 1/8/18 // while( !Host.Local.TryFindSingle(repo.Retech.ButtonCheckoutInfo.AbsolutePath.ToString(), out element) ) while (!Host.Local.TryFindSingle(repo.Retech.DataContextShowCheckoutViewCommandInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Global.LogText = @"Clicked on Continue Button - 1 in fnCheckout()"; WriteToLogFile.Run(); } Thread.Sleep(100); } // Keyboard.Press("{F12}"); // Try fix 1/31/18 while (!Host.Local.TryFindSingle(repo.Retech.RequestCashSettlementInfo.AbsolutePath.ToString(), out element)) { // 07-25-18 check for "Pick Up At Store Requests" pop-up if (!Host.Local.TryFindSingle(repo.PickupAtStorePopupNotifier.PickupAtStoreRequestPopUpInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(10); } else { Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Down item 'PopupNotifierView' at 434;30.", repo.PickupAtStorePopupNotifier.SelfInfo, new RecordItemIndex(0)); repo.PickupAtStorePopupNotifier.Self.MoveTo("434;30"); Keyboard.Press("{ENTER}"); //Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left); Delay.Milliseconds(200); // repo.PopupNotifierView.Self.Click(); Thread.Sleep(100); } if (Host.Local.TryFindSingle(repo.Retech.NotInterestedCommandInfo.AbsolutePath.ToString(), out element)) { repo.Retech.NotInterestedCommand.Click(); Thread.Sleep(100); } if (repo.Retech.DataContextShowCheckoutViewCommand.Enabled) { repo.Retech.DataContextShowCheckoutViewCommand.Click(); } Thread.Sleep(300); if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Global.LogText = @"Clicked on Continue Button - 1 in fnCheckout()"; WriteToLogFile.Run(); } Thread.Sleep(100); } // repo.Retech.DataContextShowCheckoutViewCommand.Click(); } else { // while(!repo.IPOS20167172.Self.Enabled) // { Thread.Sleep(100); } // repo.IPOS20167172.Self.PressKeys("{F12}"); if (repo.IPOS34069.F12TotalInfo.Exists(5000)) // 02-08-18 { } repo.IPOS34069.F12Total.PressKeys("{F12}"); // 02-08-18 if (Global.CurrentScenario == 47) { while (!repo.CustomerLookupPhone_Number.Enabled) { Thread.Sleep(100); } MystopwatchQ4.Start(); MystopwatchQ4.Reset(); // repo.CustomerLookupScreen.EdgePowerUpNumber.PressKeys("6364916031910400011"); repo.CustomerLookupPhone_Number.PressKeys("9727651234"); repo.CustomerLookupScreen.BtnSearch.Click(); while (!repo.CustomerLookupSelectF5.Enabled) { Thread.Sleep(100); } repo.CustomerLookupSelectF5.Click(); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Search for Customer"; Global.Module = "Finalize"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.TransactionCustomerInformation.Email.Click("160;2"); Delay.Milliseconds(200); repo.TransactionCustomerInformation.Email.PressKeys("301 My Street"); Delay.Milliseconds(0); repo.TransactionCustomerInformation.LastName.Click("114;1"); Delay.Milliseconds(200); repo.TransactionCustomerInformation.LastName.PressKeys("9727651234"); Delay.Milliseconds(0); repo.TransactionCustomerInformation.Address1.Click("41;6"); Delay.Milliseconds(200); repo.TransactionCustomerInformation.Address1.PressKeys("My City"); Delay.Milliseconds(0); repo.TransactionCustomerInformation.Open.Click(); Delay.Milliseconds(200); repo.TransactionCustomerInformation.Open.Click(); Delay.Milliseconds(200); repo.ListItemsValues.ListItemAB.Click(); Delay.Milliseconds(200); repo.TransactionCustomerInformation.BtnAcceptButton.Click("23;27"); Delay.Milliseconds(200); repo.PopUpCustomerLookupUnavailable.OKF5.Click("17;22"); Delay.Milliseconds(200); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Enter Customer Information"; Global.Module = "Finalize"; DumpStatsQ4.Run(); } } Thread.Sleep(1000); // Check for Please select a charity to donate if (Host.Local.TryFindSingle(repo.RetechPeripheralHostWindow.PleaseSelectACharityToDonateInfo.AbsolutePath.ToString(), out element)) { repo.RetechPeripheralHostWindow.DeclineDonateNoThanks.Click(); Thread.Sleep(100); } if (Global.DomesticRegister) { Global.LogText = @"Waiting on Time to Check Out - in fnCheckout()"; WriteToLogFile.Run(); Thread.Sleep(300); while (!Host.Local.TryFindSingle(repo.Retech.TimeToCheckOutInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Global.LogText = @"Clicked on Continue Button - 2 in fnCheckout()"; WriteToLogFile.Run(); Thread.Sleep(100); } Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.Retech.AcknowledgeRelatedProductsCommandInfo.AbsolutePath.ToString(), out element)) { if (Host.Local.TryFindSingle(repo.Retech.AcknowledgeRelatedProductsCommandInfo.AbsolutePath.ToString(), out element)) { if (repo.Retech.AcknowledgeRelatedProductsCommand.Enabled) { Global.LogText = @"Clicking on acknowledge related products before F12"; WriteToLogFile.Run(); repo.Retech.AcknowledgeRelatedProductsCommand.Click(); Thread.Sleep(100); } } } else if (Host.Local.TryFindSingle(repo.Retech.ContinueF5_5_6_0_103Info.AbsolutePath.ToString(), out element)) { if (repo.Retech.ContinueF5_5_6_0_103.Enabled) { Global.LogText = @"Clicking on F5 Continue before F12"; WriteToLogFile.Run(); repo.Retech.ContinueF5_5_6_0_103.Click(); Thread.Sleep(100); repo.Retech.ButtonCheckout.Click(); Thread.Sleep(100); } } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F12] wait for payment icons"; Global.Module = "Finalize"; DumpStatsQ4.Run(); } MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // Click on screen to make sure in focust - .focus not work //if(Global.DomesticRegister) 1-22-19 // repo.Retech.PaymentView.Click("689;82"); switch (Global.PayWithMethod) { case "Cash": Global.LogText = @"Waiting on Cash F5"; WriteToLogFile.Run(); if (Global.DomesticRegister) { repo.Retech.Self.Focus(); } Thread.Sleep(100); if (Global.DomesticRegister) { while (!repo.Retech.RequestCashSettlement.Enabled) { Thread.Sleep(500); } } else { while (!Host.Local.TryFindSingle(repo.FormPOS1.SelfInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(500); } //while(!repo.EnterSerialNumber.F5Cash.Enabled) { Thread.Sleep(500); } } Global.LogText = @"Found Cash F5 Enabled"; WriteToLogFile.Run(); break; case "Credit": case "PURCC": Global.LogText = @"Waiting on Manual Card F6"; WriteToLogFile.Run(); if (Global.DomesticRegister) { repo.Retech.Self.Focus(); } Thread.Sleep(100); if (Global.DomesticRegister) { while (!repo.Retech.RequestManualCardSettlement.Enabled) { Thread.Sleep(500); } } else { while (!repo.EnterSerialNumber.F5Cash.Enabled) { Thread.Sleep(500); } } Global.LogText = @"Found Manual Card F6 Enabled"; WriteToLogFile.Run(); break; } // Check for cash back if (Global.DomesticRegister && repo.Retech.AmountDue.TextValue.Substring(0, 1) == "(" && (Global.CurrentScenario == 37 || Global.CurrentScenario == 47) ) { Global.LogText = @"Clicking on Cash F5 button"; WriteToLogFile.Run(); // fix 1//22/18 while (!Host.Local.TryFindSingle(repo.Retech.RequestCashSettlementInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // end fix repo.Retech.RequestCashSettlement.Click(); Thread.Sleep(100); Global.LogText = @"Waiting on CashPaymentView"; WriteToLogFile.Run(); while (!repo.RetechCardPaymentView.CashPaymentView.Enabled) { Thread.Sleep(100); } Keyboard.Press("{Enter}"); } else { string BalanceDueText = ""; string BalTemp = ""; float BalanceDueAmount = 0.0F; string BalanceDueAmountTxt = ""; // Read Remaining Balance from screen if (Global.DomesticRegister) { BalanceDueText = repo.Retech.BalanceDue.TextValue; BalTemp = BalanceDueText.Substring(1, BalanceDueText.Length - 1); BalanceDueAmount = float.Parse(BalTemp); BalanceDueAmountTxt = Convert.ToString(BalanceDueAmount); } else { BalanceDueText = repo.IntListItemAmountDue.ToString(); BalanceDueText = BalanceDueText.Replace("\t", " "); BalTemp = BalanceDueText.Substring(35, 8); BalanceDueAmount = float.Parse(BalTemp); BalanceDueAmountTxt = Convert.ToString(BalanceDueAmount); } switch (Global.PayWithMethod) { case "Cash": // Click on Cash F5 button Global.LogText = @"Clicking on Cash F5 button"; WriteToLogFile.Run(); if (Global.DomesticRegister) { while (!Host.Local.TryFindSingle(repo.Retech.RequestCashSettlementInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // change 1/8/17 repo.Retech.RequestCashSettlement.Click(); while (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.TxtAmountPaidInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Enter amount paid repo.RetechCardPaymentView.TxtAmountPaid.TextValue = BalanceDueAmountTxt; repo.RetechCardPaymentView.TxtAmountPaid.PressKeys("{Enter}"); } else { repo.EnterSerialNumber.Self.PressKeys("{F5}"); // Enter amount paid repo.Amount.Self.PressKeys("{Enter}"); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F5] enter amount press Enter"; Global.Module = "Finalize"; DumpStatsQ4.Run(); break; case "Credit": if (Global.DomesticRegister) { // Click on Manual Card F6 button Global.LogText = @"Clicking on Manual Card F6 button"; WriteToLogFile.Run(); repo.Retech.RequestManualCardSettlement.Click(); while (!repo.RetechCardPaymentView.RunAsCreditCard.Enabled) { if (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.RetrySameCardInfo.AbsolutePath.ToString(), out element)) { Global.LogText = @"Clicking on Retry same card"; WriteToLogFile.Run(); Global.TempErrorString = Global.LogText; WriteToErrorFile.Run(); repo.RetechCardPaymentView.RetrySameCard.Click(); Thread.Sleep(200); } Thread.Sleep(100); } // Click on Run as Credit button Global.LogText = @"Clicking on Run as Credit button"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.RunAsCreditCardInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // change 1/8/17 repo.RetechCardPaymentView.RunAsCreditCard.Click(); string RetechVersion = Global.RetechVersion; string Sub = Global.RetechVersion.Substring(0, 4); // if(Global.RetechVersion.Substring(0,4) != "5.14") if (Global.RetechVersion.Substring(0, 4) == "5.13") { // ### For Retech 5.13 and below - see else code for Retech 5.14 while (!repo.RetechCardPaymentView.TxtCardNumber.Enabled) { if (Host.Local.TryFindSingle(repo.RetechCardPaymentView.RetrySameCardInfo.AbsolutePath.ToString(), out element)) { repo.RetechCardPaymentView.RetrySameCard.Click(); Thread.Sleep(200); } Thread.Sleep(100); } // Thread.Sleep(500); repo.RetechCardPaymentView.TxtCardNumber.TextValue = Global.CreditCardNumber; string aa = Global.CreditCardMonth + "/" + Global.CreditCardYear; repo.RetechCardPaymentView.TxtExpirationDate.TextValue = Global.CreditCardMonth + "/" + Global.CreditCardYear; repo.RetechCardPaymentView.TxtZipCode.TextValue = Global.CreditCardZip; repo.RetechCardPaymentView.ProcessCreditCardView.PressKeys("{Enter}"); // Thread.Sleep(100); while (!Global.AbortScenario && !Host.Local.TryFindSingle(repo.RetechCardPaymentView.Waiting_for_SignatureInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.RetechCardPaymentView.TryAuthorizingAgainInfo.AbsolutePath.ToString(), out element)) { Global.AbortScenario = true; Global.TempErrorString = "Credit Card Unable to Process Payment - transaction voided"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); Keyboard.Press("{Escape}"); Thread.Sleep(100); repo.Retech.DataContextVoidOrderCommand.Click(); Thread.Sleep(100); repo.GenericDialogView.Yesvoidthistransaction.Click(); Thread.Sleep(100); while (!repo.RetechAnotherTransaction.Visible) { Thread.Sleep(100); } } } } else { // ### This required for Retech 5.14 and above because Ranorex not see detail of new pinpad // 11/6/18 use WPF not UAI repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadAcceptCommand.Click(); Thread.Sleep(100); repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadCardNumber.TextValue = Global.CreditCardNumber; repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadOK.Click(); repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadMonth.TextValue = Global.CreditCardMonth; repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadYear.TextValue = Global.CreditCardYear; repo.RetechPeripheralHostWindow.SomeTabPageList.PinPadOK.Click(); repo.RetechPeripheralHostWindow.PinPadZipCode.TextValue = Global.CreditCardZip; repo.RetechPeripheralHostWindow.SomeTabPageList.AcceptCommand.Click(); // 11/6/18 replace by above // repo.RetechPeripheralHostWindow.TabControl.Click("189;453"); // repo.RetechPeripheralHostWindow.TabControl.Click("31;84"); // Keyboard.Press(Global.CreditCardNumber); // repo.RetechPeripheralHostWindow.TabControl.Click("157;472"); // repo.RetechPeripheralHostWindow.TabControl.Click("44;115"); // Keyboard.Press(Global.CreditCardMonth + "{Tab}" + Global.CreditCardYear); // Thread.Sleep(200); // repo.RetechPeripheralHostWindow.TabControl.Click("93;466"); // Thread.Sleep(200); // repo.RetechPeripheralHostWindow.TabControl.Click("40;126"); // Thread.Sleep(350); // Keyboard.Press(Global.CreditCardZip); // repo.RetechPeripheralHostWindow.TabControl.Click("155;445"); // Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F6] enter Card info"; Global.Module = "Finalize"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (!Global.AbortScenario) { // 11/6/18 use WPF not UAI repo.RetechPeripheralHostWindow.SomeTabPageList.ApplySignatureCommand.Click(); repo.RetechPeripheralHostWindow.SomeTabPageList.AcceptCommand.Click(); repo.RetechCardPaymentView.AcceptSignature.Click(); // 11/6/18 replace by above // while(!Host.Local.TryFindSingle(repo.RetechPeripheralHostWindow.SignOnPinPadInfo.AbsolutePath.ToString(), out element)) // { Thread.Sleep(100); } // repo.RetechPeripheralHostWindow.SignOnPinPad.Click(); // Thread.Sleep(200); // repo.RetechPeripheralHostWindow.AcceptOnPinPad.Click(); // Thread.Sleep(200); // repo.RetechCardPaymentView.Self.Focus(); // Thread.Sleep(100); // repo.RetechCardPaymentView.SignatureAcceptedCommand.Click(); // Thread.Sleep(200); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Sign on pin pad"; Global.Module = "Finalize"; DumpStatsQ4.Run(); } } else { MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.EnterSerialNumber.Self.PressKeys("{F9}"); // Seclect Credit Card TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F9] Seclect Credit Card"; Global.Module = "Finalize"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.Amount.Self.PressKeys("{Enter}"); // Enter amount paid TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Enter amount paid"; Global.Module = "Finalize"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.InternatiuonalCreditCardType.Self.PressKeys("{F1}"); // F1=Visa F2=MasterCard F3=American Express TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F1] Seclect F1=Visa"; Global.Module = "Finalize"; DumpStatsQ4.Run(); repo.F1VISA.InternationalLast4OfCreditCard.PressKeys("9474{F5}"); // Enter last 4 digits of credit card } break; case "PURCC": // Click on Manual Card F6 button Global.LogText = @"Clicking on Manual Card F6 button"; WriteToLogFile.Run(); repo.Retech.RequestManualCardSettlement.Click(); while (!repo.RetechCardPaymentView.RunAsPURCCCard.Enabled) { Thread.Sleep(100); } // Click on Run as PURCC button (Run as PowerUp Rewards Cerdit Cart Global.LogText = @"Clicking on run as PURCC"; WriteToLogFile.Run(); repo.RetechCardPaymentView.RunAsPURCCCard.Click(); while (!Host.Local.TryFindSingle(repo.RetechCardPaymentView.TxtCardNumberInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } // Select ID type and Issuer (Drivers Lenense and State) repo.RetechCardPaymentView.PickIdType.SelectedItemText = "Drivers License"; repo.RetechCardPaymentView.PickIdIssuer.Click(); repo.RetechCardPaymentView.PickIdIssuer.SelectedItemText = "Texas"; repo.RetechCardPaymentView.ProcessPrivateLabelCreditCardView.Click(); // Fill in PowerUp Rewards Credit Card Manual Entry repo.RetechCardPaymentView.TxtCardNumber.TextValue = "7788400030000272"; repo.RetechCardPaymentView.TxtNameFromId.TextValue = "PAL User"; repo.RetechCardPaymentView.ProcessPrivateLabelCreditCardView.Click(); repo.RetechCardPaymentView.Self.PressKeys("{Enter}"); Global.LogText = @"Info entered - watching for Waiting for Signature"; WriteToLogFile.Run(); while (!Global.AbortScenario && !Host.Local.TryFindSingle(repo.RetechCardPaymentView.Waiting_for_SignatureInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.RetechCardPaymentView.PaymentCouldNotBeAuthorizedAnUnknInfo.AbsolutePath.ToString(), out element)) { Global.AbortScenario = true; Global.TempErrorString = "PURCC Unable to Process Payment - transaction voided"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); Keyboard.Press("{Escape}"); Thread.Sleep(100); repo.Retech.DataContextVoidOrderCommand.Click(); Thread.Sleep(100); repo.GenericDialogView.Yesvoidthistransaction.Click(); Thread.Sleep(100); while (!repo.RetechAnotherTransaction.Visible) { Thread.Sleep(100); } } } if (!Global.AbortScenario) { repo.RetechPeripheralHostWindow.SignOnPinPad.Click(); Thread.Sleep(200); repo.RetechPeripheralHostWindow.AcceptOnPinPad.Click(); Thread.Sleep(200); repo.RetechCardPaymentView.Self.Focus(); Thread.Sleep(100); repo.RetechCardPaymentView.SignatureAcceptedCommand.Click(); Thread.Sleep(200); } break; } MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // Wait for Another Transaction pop-up while (!Host.Local.TryFindSingle(repo.RetechAnotherTransactionInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.RetechTillOverageWarningView.CodeF4AlertInfo.AbsolutePath.ToString(), out element) || Host.Local.TryFindSingle(repo.RetechTillOverageWarningView.CodeF4Alert2Info.AbsolutePath.ToString(), out element) ) { GlobalOverhead.Stopwatch.Start(); repo.RetechTillOverageWarningView.DropCashCommand.Click(); while (!repo.RetechLoginView.TxtPassword.Enabled) { Thread.Sleep(100); } repo.RetechLoginView.TxtPassword.PressKeys("advanced{Return}"); while (!repo.RetechTillDepositView.DropBoxAmount.Enabled) { Thread.Sleep(100); } repo.RetechTillDepositView.DropBoxAmount.PressKeys("40000"); repo.RetechTillDepositView.AddCashDropButton.Click(); Thread.Sleep(1000); repo.RetechTillDepositView.DropBoxAmount.PressKeys("{Escape}"); GlobalOverhead.Stopwatch.Stop(); } } } else { // Wait for log on screen if (Global.CurrentScenario == 47 || Global.CurrentScenario == 20 || Global.CurrentScenario == 16 || Global.CurrentScenario == 33 || Global.CurrentScenario == 34 ) { Thread.Sleep(100); while (!Host.Local.TryFindSingle(repo.IPOSScreen.ChangeDueInfo.AbsolutePath.ToString(), out element) && !repo.LogOn.LoginID.HasFocus ) { InternationalCheckForCodeF4Alert(); // 11/1/18 Thread.Sleep(200); } while (Host.Local.TryFindSingle(repo.IPOSScreen.ChangeDueInfo.AbsolutePath.ToString(), out element) && !repo.LogOn.LoginID.HasFocus ) { InternationalCheckForCodeF4Alert(); // 11/1/18 Thread.Sleep(200); } } while (!Host.Local.TryFindSingle(repo.LogOn.LoginIDInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(200); } while (!repo.LogOn.LoginID.Enabled) { Thread.Sleep(200); } } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Wait for another transaction ESC"; Global.Module = "Finalize"; DumpStatsQ4.Run(); switch (Global.PayWithMethod) { case "Cash": Global.NowPayWithCash = Global.AdjustedTime; break; case "Credit": Global.NowPayWithCredit = Global.AdjustedTime; break; case "PURCC": Global.NowPayWithPURCC = Global.AdjustedTime; break; } MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // Press excape key on Another Transaction pop-up while (!Host.Local.TryFindSingle(repo.RetechLoginView.TxtPasswordInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } repo.RetechLoginView.TxtPassword.PressKeys("{Escape}"); } else { // Press escape on log on screen // repo.LogOn.Self.PressKeys("{Escape}"); // repo.LogOn.LogOn.Click("231;6"); // Delay.Milliseconds(200); // Keyboard.Press("{Escape}"); Thread.Sleep(200); while (!repo.LogOn.LogOn.Enabled) { Thread.Sleep(200); } repo.LogOn.LogOn.PressKeys(""); Delay.Milliseconds(200); repo.LogOn.LogOn.PressKeys("{Escape}"); } if (!Global.DomesticRegister) // International Store { // Catch hanging logon Thread.Sleep(100); if (Host.Local.TryFindSingle(repo.LogOn.LogOnInfo.AbsolutePath.ToString(), out element)) { Keyboard.Press("{Escape}"); } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Wait for Start a Transaction ESC"; Global.Module = "Finalize"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Finalize"; DumpStatsQ4.Run(); Global.LogText = "OUT fnCheckout"; WriteToLogFile.Run(); Global.LogFileIndentLevel--; }
public void Run() { //*****************Start Scenario 40 - Retech - PRP ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; //Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); FnProductionIssueFunctions ProductionIssueFunctions = new FnProductionIssueFunctions(); Global.CurrentScenario = 42; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } } Global.ScenarioExecuted = true; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Global.LogText = @"---> fnDoScenario42 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 40 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); StartTransaction.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Add Item"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); // Add PRP EnterPRPSKU(); /* * // Price override * MystopwatchQ4.Reset(); * MystopwatchQ4.Start(); * * string TextAmt = repo.Retech.NetTotal.TextValue.Substring(1,repo.Retech.NetTotal.TextValue.Length - 1); * string TextTotAmt = repo.Retech.TotalPurchases.TextValue.Substring(1,repo.Retech.TotalPurchases.TextValue.Length - 1); * decimal DecAmt = Convert.ToDecimal(TextAmt); * decimal DecTotAmt = Convert.ToDecimal(TextTotAmt); * decimal UseAmt = DecTotAmt - DecAmt + 1.00m; * Global.SpecialPayThisAmount = Convert.ToString(UseAmt); * * ProductionIssueFunctions.SpecialPriceOverride(1.00m); // lower the price so not so many code F4 alerts * * TimeMinusOverhead.Run((float) MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine * Global.CurrentMetricDesciption = "Price Overide"; * Global.Module = "Price Overide"; * DumpStatsQ4.Run(); * Global.CurrentMetricDesciption = "Module Total Time"; * DumpStatsQ4.Run(); */ // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "Cash"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 42"; Global.Module = "Total Time"; DumpStatsQ4.Run(); if (!Global.AbortScenario) { // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); } else { Global.Q4StatBuffer = ""; } Global.LogText = "<--- fnDoScenario42 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 42 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 42***************** }
// // P R E C H E C K O U T ############################################################################## // public void SpecialPreCheckOut() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; bool BalanceIsZero = false; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); Ranorex.Unknown element = null; Global.LogFileIndentLevel++; Global.LogText = "IN fnCheckout"; WriteToLogFile.Run(); // Read Remaining Balance from screen BalanceIsZero = false; if (repo.Retech.AmountDue.TextValue == "$0.00") { BalanceIsZero = true; } // 12-7-18 if (Host.Local.TryFindSingle(repo.Retech.NotInterestedCommandInfo.AbsolutePath.ToString(), out element)) { repo.Retech.NotInterestedCommand.Click(); Thread.Sleep(100); } if (!Host.Local.TryFindSingle(repo.Retech.RequestCashSettlementInfo.AbsolutePath.ToString(), out element)) // if(!Global.SpecialCheckingOut) { // Click on CheckOut F12 button Global.LogText = @"Clicking on F12 Checkout - Prod Issues"; WriteToLogFile.Run(); while (!repo.Retech.DataContextShowCheckoutViewCommand.Enabled) { Thread.Sleep(100); } // Check for GPG Continue if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(100); } // Click on Check Out // repo.Retech.DataContextShowCheckoutViewCommand.Click(); // Keyboard.Press("{F12}"); repo.Retech.OrderWorkspaceView.PressKeys("{F12}"); Thread.Sleep(1000); if (!BalanceIsZero) { while (!repo.Retech.RequestCashSettlement.Enabled) { Thread.Sleep(100); } } } if (!BalanceIsZero) { SpecialPreCheckOutNonZeroBalance(); } Global.LogText = "OUT fnCheckout"; WriteToLogFile.Run(); Global.LogFileIndentLevel--; }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; RanorexRepository repo = new RanorexRepository(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnCommon14and15 CommonScenario14and15 = new FnCommon14and15(); Ranorex.Unknown element = null; Global.AbortScenario = false; //*****************Start Scenario 14 - Shift-F12 Performance Summary ****************** Global.CurrentScenario = 14; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) // if(Global.CurrentScenario != 9999) { return; } } Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); if (Global.CombinedIPOS) { repo.GoToBackOffice.Click(); Thread.Sleep(200); } // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Global.LogText = @"---> fnDoScenario14 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 14 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'IPOS270141HomeScreen.Element1' at 269;333.", repo.BackOffice275111HomeScreen.BackOffice275111HomeScreenInfo, new RecordItemIndex(0)); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Clicking on Back Office link"; WriteToLogFile.Run(); repo.BackOffice275111HomeScreen.BackOffice275111HomeScreen.Click(); Global.LogText = @"Waiting for Back Office home screen"; WriteToLogFile.Run(); while (!repo.BackOffice275111HomeScreen.BackOffice275111HomeScreen.Enabled) { Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Load Back Office"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.BackOffice275111HomeScreen.Self.Click(); Global.LogText = @"Clicking Shift-F12 Performance Summary"; WriteToLogFile.Run(); Keyboard.Press("{LShiftKey down}{F12}{LShiftKey up}"); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Waiting for UserID to be enabled"; WriteToLogFile.Run(); while (!repo.ShellRoot.TxtUserId.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Load Dashboard login"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Log into Back Office"; WriteToLogFile.Run(); repo.ShellRoot.TxtUserId.TextValue = "psu"; repo.ShellRoot.TxtPassword.TextValue = "advanced"; Keyboard.Press("{Return}"); Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Log in"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); CommonScenario14and15.Run(); // All Done Global.LogText = "Press Alt-F4 to exit Dashboard"; Keyboard.Press("{Alt down}{F4}{Alt up}"); while (!repo.BackOffice275111HomeScreen.Self.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchModuleTotal.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Module Total Time"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 14"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Global.LogText = "<--- fnDoScenario14 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 14 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); if (Global.CombinedIPOS) { repo.BackOffice275111HomeScreen.Self.Focus(); repo.BackOffice275111HomeScreen.Self.Click(); Keyboard.Press("{F5}"); Thread.Sleep(200); if (Host.Local.TryFindSingle(repo.ReservationDeposit.WrongBusinessDateInfo.AbsolutePath.ToString(), out element)) { Keyboard.Press("{F5}"); Thread.Sleep(200); } } return; // ***********End Scenario 14***************** }
public void Run() { //*****************Start Scenario 33 - Retech - Simple One SKU Pay with Cash ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); Global.CurrentScenario = 33; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } } Global.ScenarioExecuted = true; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Global.LogText = @"---> fnDoScenario33 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 33 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); StartTransaction.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Add Item"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F1] wait for add item"; Global.Module = "F1 Add Item"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); } Global.CurrentSKU = Global.S4Sku1; EnterSKU.Run(); // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "Cash"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 33"; Global.Module = "Total Time"; DumpStatsQ4.Run(); if (!Global.AbortScenario) { // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); } else { Global.Q4StatBuffer = ""; } Global.LogText = "<--- fnDoScenario33 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 33 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 33***************** }
public void ResumeTransaction() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; RanorexRepository repo = new RanorexRepository(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Start Transaction"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { Global.LogText = @"Clicking on ReTech screen then press F5"; WriteToLogFile.Run(); repo.ReTechStartTransaction.Click(); repo.ReTechStartTransaction.PressKeys("{F6}"); if (Host.Local.TryFindSingle(repo.GenericDialogView.CriticalErrorSavingTransactionCallHInfo.AbsolutePath.ToString(), out element)) { repo.GenericDialogView.ErrorSavingButtonOK.Click(); Thread.Sleep(200); Global.TempErrorString = "Error Saving Transaction"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); } Global.LogText = @"Waiting for logon"; WriteToLogFile.Run(); while (!Host.Local.TryFindSingle(repo.RetechLoginView.TxtPasswordInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(200); if (Host.Local.TryFindSingle(repo.GenericDialogView.CriticalErrorSavingTransactionCallHInfo.AbsolutePath.ToString(), out element)) { repo.GenericDialogView.ErrorSavingButtonOK.Click(); Thread.Sleep(200); Global.TempErrorString = "Error Saving Transaction"; WriteToErrorFile.Run(); Global.LogText = Global.TempErrorString; WriteToLogFile.Run(); } } } else { // Click on F5 POS Register - international repo.IPOSScreen.ContainerF7BackOffice.Click("32;55"); Delay.Milliseconds(200); Keyboard.Press("{F5}"); while (!repo.LogOn.InternationalLoginID.Enabled) { Thread.Sleep(100); } repo.LogOn.InternationalLoginID.PressKeys("psu"); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"[F6] Resume Transaction"; Global.Module = "Log On"; DumpStatsQ4.Run(); // Enter Password MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { Global.LogText = @"Waiting for Password field enabled"; WriteToLogFile.Run(); while (!repo.ReTechLogonPassword.Enabled) { Thread.Sleep(100); } Global.LogText = @"Entering password"; WriteToLogFile.Run(); repo.RetechLoginView.TxtPassword.PressKeys("advanced{Return}"); // If no transactions found cancel and skip to next register so script will not stop if (Host.Local.TryFindSingle(repo.SelectSuspendedOrderView1.NoTransactionsHaveBeenSuspendedTodaInfo.AbsolutePath.ToString(), out element)) { repo.SelectSuspendedOrderView1.CancelCommand.Click(); Thread.Sleep(100); Global.AbortScenario = true; } else { // Wait for add line command 2/2/18 if (repo.SelectSuspendedOrderView.ResumeCommandInfo.Exists(5000)) { } while (!Host.Local.TryFindSingle(repo.SelectSuspendedOrderView.ResumeCommandInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(200); } // 1/31/18 repo.SelectSuspendedOrderView.ResumeCommand.Click(); Thread.Sleep(1000); // If transaction service error - try reclicking on save button if (Host.Local.TryFindSingle(repo.SelectSuspendedOrderView.ErrorMessageTxtInfo.AbsolutePath.ToString(), out element)) { repo.SelectSuspendedOrderView.ResumeCommand.Click(); } // If Customer Info then just skip by continue if (Host.Local.TryFindSingle(repo.Retech.ContinueButtonCommand2Info.AbsolutePath.ToString(), out element)) { repo.Retech.ContinueButtonCommand2.Click(); Thread.Sleep(100); } // If Continue click it if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); Thread.Sleep(100); } } } else { repo.LogOn.InternationalPassword.PressKeys("advanced{Return}"); while (!repo.ReservationDeposit.EnterSerialNumber.Enabled) { Thread.Sleep(100); } repo.ReservationDeposit.EnterSerialNumber.PressKeys("{Escape}"); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter Password"; Global.Module = "Log On"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Log On"; DumpStatsQ4.Run(); }
public void Run() { //*****************Start Scenario 39 - Retech - Enter 10 SKUs - credit card ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); Global.CurrentScenario = 39; if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchF1 = new Stopwatch(); Global.LogText = @"---> fnDoScenario39 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 39 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Start Transaction"; WriteToLogFile.Run(); StartTransaction.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); string[] MySKUs = new string[10]; MySKUs[0] = Global.S9SKU1; MySKUs[1] = Global.S9SKU2; MySKUs[2] = Global.S9SKU3; MySKUs[3] = Global.S9SKU4; MySKUs[4] = Global.S9SKU5; MySKUs[5] = Global.S9SKU6; MySKUs[6] = Global.S9SKU7; MySKUs[7] = Global.S9SKU8; MySKUs[8] = Global.S9SKU9; MySKUs[9] = Global.S9SKU10; MystopwatchF1.Reset(); MystopwatchF1.Start(); Global.LogText = @"Enter SKUs"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); for (int soff = 0; soff <= 9; soff++) { // Press F1 add item Keyboard.Press("{F1}"); MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } // Enter SKU Global.LogText = @"Entering SKU: " + MySKUs[soff]; WriteToLogFile.Run(); repo.AddItemText.TextValue = MySKUs[soff]; repo.RetechQuickEntryView.TxtWatermark.PressKeys("{Enter}"); while (!repo.AddLineItemCommand.Enabled) { if (Host.Local.TryFindSingle(repo.ContinueButtonCommandInfo.AbsolutePath.ToString(), out element)) { repo.ContinueButtonCommand.Click(); } Thread.Sleep(100); } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter SKUs"; Global.Module = "Enter 10 SKUs"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Keyboard.Press("{F5}"); // Continue F5 Recommended Pre-Owned Items Thread.Sleep(200); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F5] Continue"; Global.Module = "Enter 10 SKUs"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Keyboard.Press("{F6}"); // I've explained these related products to the customer F6 Thread.Sleep(100); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F6]: explain related products"; Global.Module = "Enter 10 SKUs"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Keyboard.Press("{F5}"); // Continue F5 Thread.Sleep(200); TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F5]: GPG"; Global.Module = "Enter 10 SKUs"; DumpStatsQ4.Run(); TimeMinusOverhead.Run((float)MystopwatchModuleTotal.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.NowCustomerLookup = Global.AdjustedTime; Global.CurrentMetricDesciption = "Module Total Time"; Global.Module = "Enter 10 SKUs"; DumpStatsQ4.Run(); // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "Credit"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 39"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Global.LogText = "<--- fnDoScenario39 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 39 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 39***************** }
public void Run() { //*****************Start Scenario 38 - Retech - Suspend Resume ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); Global.CurrentScenario = 38; // Get current register allowed to run Scenario 38 - Suspend/Resume string FileToUse = "AllowedSuspendResumeRegister.txt"; string AllowedRegister = "1"; try { // Read in the allowed register using (System.IO.StreamReader RegisterScenarioFileGet = new System.IO.StreamReader(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + FileToUse)) { AllowedRegister = RegisterScenarioFileGet.ReadLine(); RegisterScenarioFileGet.Close(); } } catch { // Write out new allowed register using (System.IO.StreamWriter RegisterScenarioFilePut = new System.IO.StreamWriter(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + FileToUse)) { RegisterScenarioFilePut.WriteLine(AllowedRegister); RegisterScenarioFilePut.Close(); } } bool OkForThisRegisterToRun = true; if (AllowedRegister != Global.RegisterNumber) { OkForThisRegisterToRun = false; } if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario] || !OkForThisRegisterToRun) { return; } } Global.ScenarioExecuted = true; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Stopwatch MystopwatchSusRes = new Stopwatch(); Global.LogText = @"---> fnDoScenario38 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 38 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); StartTransaction.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Add Item"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); if (MystopwatchF1.ElapsedMilliseconds > 1000) { Keyboard.Press("{F1}"); Thread.Sleep(100); MystopwatchF1.Reset(); MystopwatchF1.Start(); } } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F1] wait for add item"; Global.Module = "F1 Add Item"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); } Global.CurrentSKU = Global.S4Sku1; EnterSKU.Run(); Thread.Sleep(100); // Suspend Transaction --------------------------------------------------------------- MystopwatchSusRes.Reset(); MystopwatchSusRes.Start(); //repo.Retech.DataContextSuspendOrderCommand.Click(); Thread.Sleep(100); Keyboard.Press(System.Windows.Forms.Keys.F11 | System.Windows.Forms.Keys.Control, 87, Keyboard.DefaultKeyPressTime, 1, true); repo.UserConfirmationView.ConfirSuspend.Click(); Thread.Sleep(100); while (!repo.RetechLoginView.TxtPassword.Enabled) { Thread.Sleep(100); } Keyboard.Press("{Escape}"); TimeMinusOverhead.Run((float)MystopwatchSusRes.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Suspend"; Global.Module = "Suspend"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); Global.LogText = "Pausing after supend " + Global.CurrentIteration; WriteToLogFile.Run(); Thread.Sleep(4000); // give some time for processkng // Resume Transaction ----------------------------------------------------------------------- MystopwatchSusRes.Reset(); MystopwatchSusRes.Start(); Global.AbortScenario = false; ResumeTransaction(); TimeMinusOverhead.Run((float)MystopwatchSusRes.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Resume"; Global.Module = "Resume"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); if (!Global.AbortScenario) { // @#@#@# C H E C K O U T #@#@#@ ---------------------------------- Global.PayWithMethod = "Cash"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 38"; Global.Module = "Total Time"; DumpStatsQ4.Run(); if (!Global.AbortScenario) { // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); } else { Global.Q4StatBuffer = ""; } Global.LogText = "<--- fnDoScenario38 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 38 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); } // When Suspend/Resume done allow next register to run it string StoreName = Global.RegisterName.Substring(0, 8); int MaxAllowed = 0; switch (StoreName) { case "USA00414": MaxAllowed = 3; break; case "USA04285": MaxAllowed = 3; break; case "USA01763": MaxAllowed = 6; break; case "USA02157": MaxAllowed = 2; break; } decimal DecAllowed = Convert.ToDecimal(AllowedRegister); if (DecAllowed + 1 > MaxAllowed) { DecAllowed = 1; } else { DecAllowed = DecAllowed + 1; } AllowedRegister = DecAllowed.ToString(); // Write out new allowed register using (System.IO.StreamWriter RegisterScenarioFilePut = new System.IO.StreamWriter(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + FileToUse)) { RegisterScenarioFilePut.WriteLine(AllowedRegister); RegisterScenarioFilePut.Close(); } Thread.Sleep(2000); // ***********End Scenario 38***************** }
public void Run() { //*****************Start Scenario 16 - Retech - Returns ****************** Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; Ranorex.Unknown element = null; Global.AbortScenario = false; // Uses same SKU and Customer for Scenarios 3, 4, and 5 RanorexRepository repo = new RanorexRepository(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); FnCheckout Checkout = new FnCheckout(); FnStartTransaction StartTransaction = new FnStartTransaction(); FnEnterSKU EnterSKU = new FnEnterSKU(); Global.CurrentScenario = 16; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) { return; } } Global.ScenarioExecuted = true; Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchF1 = new Stopwatch(); Stopwatch MystopwatchTotal = new Stopwatch(); MystopwatchTotal.Reset(); MystopwatchTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); Global.LogText = @"---> fnDoScenario16 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 16 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); // Start MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); StartTransaction.Run(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Global.LogText = @"Add Item"; WriteToLogFile.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); if (Global.DomesticRegister) { // Press F1 add item Keyboard.Press("{F1}"); MystopwatchF1.Reset(); MystopwatchF1.Start(); while (!Host.Local.TryFindSingle(repo.AddItemTextInfo.AbsolutePath.ToString(), out element)) { Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "[F1] wait for add item"; Global.Module = "F1 Add Item"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); } else { repo.IPOSScreen.Self.Click(); } Global.CurrentSKU = Global.S17Trade5; EnterSKU.Run(); // 8-1-18 var activityRoot = repo.Retech.ActivityRoot; // Press returns if (Global.DomesticRegister) { // while(!repo.Retech.ReturnsF4.Enabled) // 7-23-18 // { Thread.Sleep(100); } // repo.Retech.ReturnsF4.Click(); Keyboard.Press("{F4}"); Thread.Sleep(100); } else // International { repo.IPOSInternationalEnterSKUField.Text.PressKeys("{F3}"); // Returns // while(!repo.FormPOS1.ReturnSKuField.Enabled) // 3/25/19 while (!repo.CodeF4Password.Enabled) { Thread.Sleep(100); } } MystopwatchQ4.Reset(); MystopwatchQ4.Start(); for (int RetNum = 1; RetNum <= 5; RetNum++) { if (Global.DomesticRegister) { // select add item and add the SKU while (!repo.AddLineItemCommand.Enabled) { Thread.Sleep(100); } Thread.Sleep(100); // repo.AddLineItemCommand.Click(); 1-21-19 Keyboard.Press("{F1}"); Thread.Sleep(100); repo.AddItemText.TextValue = Global.S4Sku1; Keyboard.Press("{Enter}"); // Select Defective for retrun reason //repo.ReturnReason.Click(); 1-21-19 repo.ShellView.Rectangle.Click(); Thread.Sleep(200); //repo.Defective.Click(); 1-21-19 repo.Source.Defective.Click(); Thread.Sleep(100); //Click on Scan or select receipt and select no receipt repo.Retech.SelectReceipt.Click(); Thread.Sleep(100); repo.Retech.NoReceiptAvailableCommand.Click(); Thread.Sleep(200); // Press F5 continue Keyboard.Press("{F5}"); } else // International { while (!repo.CodeF4Password.Visible) { Thread.Sleep(100); } repo.CodeF4Password.Click("72;8"); Delay.Milliseconds(200); repo.CodeF4Password.PressKeys("238325{Return}"); Keyboard.Press("n{Return}"); Keyboard.Press("{F5}"); Keyboard.Press("{F12}"); // repo.InternationalReturnSKUField.TextValue = "238325"; // Enter SKU to return // repo.InternationalReturnSKUField.PressKeys("{Return}"); // // repo.ItemSearch.Self.PressKeys("n"); // no box not opened // while(!repo.ItemSearch.Self.Enabled) Thread.Sleep(100); // repo.ItemSearch.Self.PressKeys("{Return}"); // return defective // while(!repo.ItemSearch.Self.Enabled) Thread.Sleep(100); // repo.ItemSearch.Self.PressKeys("{F5}"); // no receipt // while(!repo.ItemSearch.Self.Enabled) Thread.Sleep(100); // repo.ItemSearch.Self.PressKeys("{F12}"); // OK // while(!repo.ItemSearch.Self.Enabled) Thread.Sleep(100); } } if (!Global.DomesticRegister) // if international to final apply for returns { Keyboard.Press("{F12}"); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Enter 5 Returns"; Global.Module = "Returns"; DumpStatsQ4.Run(); Global.CurrentMetricDesciption = "Module Total Time"; DumpStatsQ4.Run(); // @#@#@# C H E C K O U T #@#@#@ Global.PayWithMethod = "Cash"; Checkout.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 16"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); Global.LogText = "<--- fnDoScenario16 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 16 OUT", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); Thread.Sleep(2000); // ***********End Scenario 16***************** }
/// <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() { if (!Global.SwitchUploadOnly) { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; RanorexRepository repo = new RanorexRepository(); fnParseSwitches ParseSwitches = new fnParseSwitches(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); // Get default scenario list // - use DefaultScenarioList.txt for all but last register // - use DefaultScenarioListLastRegister.txt for the last register in a store string ListToUse = ""; string DefaultScenarios = "13,16,18,19,20,33,34,36,37,41,42,43,47"; // if( Global.RegisterNumber == "4" || ( Global.RegisterName == "USA04285-3" ) // ) // ListToUse = "DefaultScenarioListLastRegister.txt"; // else ListToUse = "DefaultScenarioList.txt"; try { // Read in the default Scenario List from Register 1 \Ranorex Automation\DefaultScenarioList.txt using (System.IO.StreamReader RegisterScenarioFileGet = new System.IO.StreamReader(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + ListToUse)) { DefaultScenarios = RegisterScenarioFileGet.ReadLine(); RegisterScenarioFileGet.Close(); } } catch { // Write out default Scenario List to Register 1 \Ranorex Automation\DefaultScenarioList.txt using (System.IO.StreamWriter RegisterScenarioFilePut = new System.IO.StreamWriter(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + ListToUse)) { RegisterScenarioFilePut.WriteLine(DefaultScenarios); RegisterScenarioFilePut.Close(); } } string TextInput; string Prompt = "Enter list of scenarios like 3,5-7,/LX\n\n" + "Back Office ---------------------------------------------------\n" + "Scenario 13: eMail\n" + "Scenario 14: Performance Dashboard\n" + "Scenario 15: Performance Dashboard Loop without exiting\n" + "Scenario 18: Transaction Journal\n" + "Scenario 19: Cover Art\n" + "Scenario 20: HR Workday Employee List\n" + "Scenario 21: WIS Web-In-Store\n\n" + "RETECH --------------------------------------------------------\n" + "Scenario 16: Returns\n" + "Scenario 33: Simple One SKU Cash\n" + "Scenario 34: Simple One SKU Credit\n" + "Scenario 36: Item Search\n" + "Scenario 37: Reserve Pickup\n" + "Scenario 38: Suspend Resume\n" + "Scenario 41: GPG\n" + "Scenario 42: PRP\n" + "Scenario 43: Card Balance\n" + "Scenario 47: Purchase 1 SKU with 5 trades and cach back\n\n" + "Other --------------------------------------------------------\n" + "Scenario 50: Dashboard data init (about 20 minutes)\n\n" + "Switches: put comma in front of switches 2-4,7,/NXS\n" + " N=Phone Numbers NonLoyalty\n" + " L=Phone Numbers Loyalty\n" + " A=All Registers use all Phone Numbers\n" + " X=Skip Customer Lookup (NO 4,7,17,20-23,25)\n" + " M=Metrics file create when no save them\n" + " Q=Quit running when get error\n" + " S=Scenario 9 use 40 SKUs"; if (Global.AutoRun) { if (Global.CommandLineArg3 != "") { TextInput = Global.CommandLineArg3; } else { TextInput = DefaultScenarios; } } else { InputBoxResult BoxInput = InputBox.Show(Prompt, "Scenarios", DefaultScenarios); if (BoxInput.ReturnCode == DialogResult.Cancel) { Environment.Exit(0); } // Exit if cancel pressed TextInput = BoxInput.Text.ToUpper(); } // Write out default Scenario List to Register 1 \Ranorex Automation\DefaultScenarioList.txt using (System.IO.StreamWriter RegisterScenarioFilePut = new System.IO.StreamWriter(Global.Register1DriveLetter + @":\" + Global.AutomationFileDirectory + @"\" + ListToUse)) { RegisterScenarioFilePut.WriteLine(TextInput); RegisterScenarioFilePut.Close(); } // Remove all spaces from the input TextInput = TextInput.Replace(" ", System.String.Empty); // Set flag if just Scenario 32 is selected - it consumes card numbers - so cannot run as part of normal run if (TextInput == "32") { Global.JustScenario32 = true; } // Clear the DoScenarioFlag array for (int Offset = 0; Offset <= Global.MaxScenarioNumber; Offset++) { Global.DoScenarioFlag[Offset] = false; } string[] PromptItems = TextInput.Split(','); string TempText; int PromptItemsCount = PromptItems.Length; int ParseOffset; for (ParseOffset = 0; ParseOffset <= PromptItemsCount - 1; ParseOffset++) { TempText = PromptItems[ParseOffset]; ParseSwitches.Run(TempText); } // If you can connect to the PALDB then provide the option to upload the test. var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MetricsRepository"].ConnectionString); try { Report.Log(ReportLevel.Info, "fnGetScenariosToRun", "Open connection to DB", new RecordItemIndex(0)); connection.Open(); connection.Close(); var mSystemInfo = new FnSystemInfo(); TestModuleRunner.Run(mSystemInfo); } catch (Exception e) { Global.IsPerformanceTest = false; Global.DBAvailable = false; string sayString = ""; if (e.ToString().IndexOf("Thread was being aborted.") == -1) { sayString = e.ToString().Substring(0, 28); Global.TempErrorString = "Cannot connect to Metric DB: " + e.Message; WriteToErrorFile.Run(); //MessageBox.Show(e.ToString(),Global.TempErrorString); } } } }