Пример #1
0
 /// <summary>
 /// Waits for the reference splash to disapear in MM2 UI
 /// </summary>
 public void WaitForReference()
 {
     try
     {
         Label referenceLabel = MainWindow.Get <Label>(SearchCriteria.ByText(Properties.Resources.MeatMasterII_ReferenceLabelName));
         WaitHelpers.WaitForVisible(referenceLabel, TimeSpan.FromSeconds(60));
         WaitHelpers.WaitFor(() => !referenceLabel.Visible, TimeSpan.FromMinutes(10), TimeSpan.FromSeconds(30));
     }
     catch (Exception e)
     {
         logger.LogError($"WaitForReference failed with exception {e.Message} inner: {e.InnerException}");
         throw;
     }
 }
Пример #2
0
        /// <summary>
        /// Starts instrument diagnostic waits for finish dialog, and clicks OK.
        /// </summary>
        public void HandleInstrumentDiagnostic()
        {
            WaitHelpers.WaitForDialog(MainWindow, Properties.Resources.MeatMasterII_InstrumentStartupDialog, TimeSpan.FromMinutes(5));

            MainWindow.ModalWindow(Properties.Resources.MeatMasterII_InstrumentStartupDialog)
            .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentStartupStartButton)).Click();

            WaitHelpers.WaitForDialog(MainWindow, MeatMaster2UiItems.InstrumentDiagnosticDialog, TimeSpan.FromSeconds(30));

            Button instrumentDiagnosticOkButton = MainWindow.ModalWindow(MeatMaster2UiItems.InstrumentDiagnosticDialog)
                                                  .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentDiagnosticOkButton));

            if (WaitHelpers.WaitForVisible(instrumentDiagnosticOkButton, TimeSpan.FromMinutes(60)))
            {
                logger.LogInfo("Button was enabled");
                instrumentDiagnosticOkButton.Click();
            }

            else
            {
                logger.LogInfo("Button was not enabled");
            }
        }
Пример #3
0
        /// <summary>
        /// Starts the instrument diagnostic, and cancels after waitTime
        /// </summary>
        /// <param name="waitTime">Time to let the test run before canceling</param>
        public void CancelStartup(TimeSpan waitTime)
        {
            WaitHelpers.WaitForDialog(MainWindow, Properties.Resources.MeatMasterII_InstrumentStartupDialog, TimeSpan.FromMinutes(5));

            Window instrumentDiagnosticDialog = MainWindow.ModalWindow(Properties.Resources.MeatMasterII_InstrumentStartupDialog);

            instrumentDiagnosticDialog.Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentStartupStartButton))
            .Click();

            WaitHelpers.WaitForDialog(MainWindow, MeatMaster2UiItems.InstrumentDiagnosticDialog, TimeSpan.FromSeconds(30));

            Button instrumentDiagnosticCancelButton = MainWindow.ModalWindow(MeatMaster2UiItems.InstrumentDiagnosticDialog)
                                                      .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentDiagnosticCancelButton));

            if (WaitHelpers.WaitForEnabled(instrumentDiagnosticCancelButton, TimeSpan.FromSeconds(60)))
            {
                Thread.Sleep(waitTime);
                instrumentDiagnosticCancelButton.Click();
                HandlePopup("yes");
            }
            WaitHelpers.WaitForDialog(MainWindow, MeatMaster2UiItems.InstrumentDiagnosticDialog, TimeSpan.FromSeconds(20));

            Button instrumentDiagnosticOkButton = MainWindow.ModalWindow(MeatMaster2UiItems.InstrumentDiagnosticDialog)
                                                  .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentDiagnosticOkButton));

            if (WaitHelpers.WaitForVisible(instrumentDiagnosticOkButton, TimeSpan.FromSeconds(60)))
            {
                logger.LogInfo("Button was enabled");
                instrumentDiagnosticOkButton.Click();
            }

            else
            {
                logger.LogInfo("Button was not enabled");
            }
        }
Пример #4
0
        public void GetDiagnosticsResult()
        {
            WaitHelpers.WaitForDialog(MainWindow, MeatMaster2UiItems.InstrumentDiagnosticDialog, TimeSpan.FromSeconds(30));
            Button instrumentDiagnosticOkButton = MainWindow.ModalWindow(MeatMaster2UiItems.InstrumentDiagnosticDialog)
                                                  .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentDiagnosticOkButton));
            Button instrumentDiagnosticRepeatButton = MainWindow.ModalWindow(MeatMaster2UiItems.InstrumentDiagnosticDialog)
                                                      .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.InstrumentDiagnosticRepeatButton));

            if (WaitHelpers.WaitForVisible(instrumentDiagnosticOkButton, TimeSpan.FromMinutes(60)))
            {
                if (instrumentDiagnosticRepeatButton.Visible)
                {
                    instrumentDiagnosticOkButton.Click();
                    CollectLogs();
                }
                logger.LogInfo("diagnostics passed.");
                instrumentDiagnosticOkButton.Click();
            }

            else
            {
                logger.LogInfo("Button was not enabled");
            }
        }