Пример #1
0
        private void HandleModeShiftDialog(bool quickModeChange)
        {
            if (WaitHelpers.WaitFor(
                    () => MainWindow.ModalWindows().Any(d => d.Name.StartsWith(FossIntegratorUiItems.ModeChangeDialogTitle)),
                    TimeSpan.FromMinutes(1)))
            {
                logger.LogInfo("Modeshift dialog found, clicking Ok.");
                Window modeShiftDialog =
                    MainWindow.ModalWindows().Find(d => d.Name.StartsWith(FossIntegratorUiItems.ModeChangeDialogTitle));
                if (quickModeChange)
                {
                    CheckBox quickChangeCheckBox =
                        modeShiftDialog.Get <CheckBox>(
                            SearchCriteria.ByAutomationId(FossIntegratorUiItems.ModeChangeQuickChangeCehckBoxAutoId));
                    SetCheckBox(quickChangeCheckBox, true);
                }

                modeShiftDialog.Get <Button>(SearchCriteria.ByAutomationId(FossIntegratorUiItems.ModeChangeOkButtonAutoId))
                .Click();
            }
            else
            {
                logger.LogInfo("Modeshift dialog was not found");
            }
        }
Пример #2
0
        private bool WaitForMode(FiMode mode, TimeSpan timeout)
        {
            logger.LogInfo($"Waiting for mode {mode}");

            if (WaitHelpers.WaitFor(() => GetMode().Equals(mode.ToString()), timeout))
            {
                logger.LogInfo($"Changed to {mode} in time");
                return(true);
            }

            return(false);
        }
Пример #3
0
        public void WaitForServiceToStart(string serviceName, int timeOutMinutes)
        {
            logger.LogInfo("Waiting for {0} service to start.", serviceName);

              if (!WaitHelpers.WaitFor(() => ServiceIsRunning(serviceName), TimeSpan.FromMinutes(timeOutMinutes), TimeSpan.FromSeconds(30)))
              {
            logger.LogError("{0} Service did not start in time.", serviceName);
              }
              else
              {
            logger.LogInfo("{0} Service started.", serviceName);
              }
        }
Пример #4
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;
     }
 }
Пример #5
0
        public void StartAndWaitForCheckSample(int minutesToWait = 5)
        {
            Window startCheckSampleDialog = MainWindow.ModalWindow(MeatMaster2UiItems.MessageBoxPopup);

            Button startCsButton =
                startCheckSampleDialog.Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.PopupRightButton));

            startCsButton.Click();

            WaitHelpers.WaitFor(CheckSampleIsDone, TimeSpan.FromMinutes(minutesToWait));

            Window removeCsWindow = MainWindow.ModalWindow(MeatMaster2UiItems.MessageBoxPopup);

            removeCsWindow.Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.PopupLeftButton)).Click();
        }
Пример #6
0
        /// <summary>
        /// Envoked to close the current batch in Manta
        /// </summary>
        public void CloseBatch()
        {
            ClickButton(SearchCriteria.ByText(UiItems.MantaLolipopButtonName));

            while (!WaitHelpers.WaitFor(() => MainWindow.ModalWindows().Any(), TimeSpan.FromMinutes(2)))
            {
                ClickButton(SearchCriteria.ByText(UiItems.MantaLolipopButtonName));
            }

            //WaitHelpers.WaitForDialog(MainWindow, "", TimeSpan.FromSeconds(60));
            Window batchControlDialog = MainWindow.ModalWindows()[0];

            ClickButton(SearchCriteria.ByText("BatchDialogCloseBatchButton"), batchControlDialog);

            Thread.Sleep(TimeSpan.FromSeconds(10));
        }
Пример #7
0
        public void HandlePopup(string answer)
        {
            WaitHelpers.WaitForDialog(MainWindow, UiItems.MessageBoxPopup, TimeSpan.FromSeconds(30));
            Window messagePopup = MainWindow.ModalWindow(UiItems.MessageBoxPopup);

            answer = answer.ToLower();

            if (answer == "yes")
            {
                ClickButton(UiItems.MessageBoxPopupYesButton, messagePopup);
                return;
            }

            ClickButton(UiItems.MessageBoxPopupNoButton, messagePopup);

            WaitHelpers.WaitFor(() => messagePopup.IsClosed, TimeSpan.FromSeconds(30));
        }
Пример #8
0
 public Window GetMainWindow(string processName, string windowName)
 {
     try
     {
         logger.LogInfo("Finding window {0} in {1}", windowName, processName);
         Application novaApp = GetApplication(processName);
         WaitHelpers.WaitFor(() => WindowsForProcess(processName).Contains(windowName), TimeSpan.FromMinutes(30), TimeSpan.FromMinutes(1));
         WaitHelpers.WaitSeconds(10);
         // WaitHelpers.WaitFor(() => novaApp.GetWindows().Count > 0, TimeSpan.FromMinutes(30));
         logger.LogInfo("Window for {0} is found.", novaApp.Name);
         Window window = novaApp.GetWindow(windowName);
         logger.LogInfo("Nova window {0} is found", window.Title);
         return(window);
     }
     catch (Exception e)
     {
         logger.LogError("GetMainWindow failed with exception: {0}. \nInner exception {1}", e.Message,
                         e.InnerException.Message);
         throw;
     }
 }
Пример #9
0
        /// <summary>
        /// Closes down Nova
        /// </summary>
        /// <param name="restartWindows">If true, windows will restart during the shutdown, before it is done.</param>
        public void CloseDown(bool restartWindows)
        {
            ClickRadioButton(MeatMaster2UiItems.CareViewButton, MainWindow);
            Button closeButton = MainWindow.Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.CloseDownButton));

            WaitHelpers.WaitForEnabled(closeButton, TimeSpan.FromSeconds(30));

            closeButton.Click();

            WaitHelpers.WaitForDialog(MainWindow, MeatMaster2UiItems.MessageBoxPopup, TimeSpan.FromMinutes(2));

            MainWindow.ModalWindow(MeatMaster2UiItems.MessageBoxPopup)
            .Get <Button>(SearchCriteria.ByText(MeatMaster2UiItems.PopupLeftButton))
            .Click();

            if (restartWindows)
            {
                applicationHelpers.RestartWindows();
            }

            WaitHelpers.WaitFor(() => !applicationHelpers.ProcessIsRunning(MeatMaster2UiItems.Mm2ProcessName),
                                TimeSpan.FromMinutes(20), TimeSpan.FromMinutes(1));
        }
Пример #10
0
        private bool WaitForManta()
        {
            if (!WaitHelpers.WaitFor(
                    () => applicationHelpers.ProcessIsRunning(UiItems.MantaProcessname),
                    TimeSpan.FromSeconds(60)))
            {
                logger.LogError("Manta process did not start in time");
                return(false);
            }

            logger.LogInfo("Manta process started.");

            if (
                !WaitHelpers.WaitFor(
                    () => applicationHelpers.WindowIsVisible(UiItems.MantaProcessname, UiItems.MantaWindowtitle),
                    TimeSpan.FromSeconds(60)))
            {
                logger.LogError("Manta window did not show within 60 secs.");
                return(false);
            }

            logger.LogInfo("Manta started in time.");
            return(true);
        }