Beispiel #1
0
        /// <summary>
        /// Switch to the primary SliceSettings tab
        /// </summary>
        /// <param name="testRunner"></param>
        public static void OpenPrintPopupMenu(this AutomationRunner testRunner)
        {
            var printerConnection = ApplicationController.Instance.ActivePrinter.Connection;

            if (printerConnection.CommunicationState != CommunicationStates.Connected &&
                printerConnection.CommunicationState != CommunicationStates.FinishedPrint)
            {
                testRunner.ClickByName("Connect to printer button");
                testRunner.WaitFor(() => printerConnection.CommunicationState == CommunicationStates.Connected);
            }

            // Wait for button to become enabled
            var printerPopup = testRunner.GetWidgetByName("PrintPopupMenu", out _);

            testRunner.WaitFor(() => printerPopup.Enabled);

            // check if the print menu is already open
            if (!testRunner.NameExists("Advanced Section", .2))
            {
                // open it
                testRunner.ClickByName("PrintPopupMenu");

                if (!testRunner.NameExists("Layer(s) To Pause Field", .2))
                {
                    testRunner.ClickByName("Advanced Section");
                }
            }
        }
Beispiel #2
0
        public static void AddItemToBedplate(this AutomationRunner testRunner, string containerName = "Calibration Parts Row Item Collection", string partName = "Row Item Calibration - Box.stl")
        {
            if (!testRunner.NameExists(partName, 1) && !string.IsNullOrEmpty(containerName))
            {
                testRunner.NavigateToFolder(containerName);
            }

            var partWidget = testRunner.GetWidgetByName(partName, out _) as ListViewItemBase;

            if (!partWidget.IsSelected)
            {
                testRunner.ClickByName(partName);
            }
            testRunner.ClickByName("Print Library Overflow Menu");

            var view3D      = testRunner.GetWidgetByName("View3DWidget", out _) as View3DWidget;
            var scene       = view3D.InteractionLayer.Scene;
            var preAddCount = scene.Children.Count();

            testRunner.ClickByName("Add to Bed Menu Item");
            // wait for the object to be added
            testRunner.WaitFor(() => scene.Children.Count == preAddCount + 1);
            // wait for the object to be done loading
            var insertionGroup = scene.Children.LastOrDefault() as InsertionGroupObject3D;

            if (insertionGroup != null)
            {
                testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroupObject3D != null, 10);
            }
        }
Beispiel #3
0
 private static void ClickDialogButton(AutomationRunner testRunner, string buttonName, int expectedLayer)
 {
     testRunner.WaitForName(buttonName, 90);
     Assert.AreEqual(expectedLayer, ApplicationController.Instance.ActivePrinter.Connection.CurrentlyPrintingLayer);
     testRunner.ClickByName(buttonName);
     testRunner.WaitFor(() => !testRunner.NameExists(buttonName), 1);
 }
Beispiel #4
0
        // TODO: Promote to extension method
        private static void WaitForLayerAndResume(AutomationRunner testRunner, PrinterConfig printer, int indexToWaitFor)
        {
            testRunner.WaitForName("Yes Button", 15);

            // Wait for layer
            testRunner.WaitFor(() => printer.Bed.ActiveLayerIndex + 1 == indexToWaitFor, 10, 500);
            Assert.AreEqual(indexToWaitFor, printer.Bed.ActiveLayerIndex + 1, "Active layer index does not match expected");

            testRunner.ClickByName("Yes Button");
            testRunner.Delay();
        }
Beispiel #5
0
        /// <summary>
        /// Switch to the primary SliceSettings tab
        /// </summary>
        /// <param name="testRunner"></param>
        public static void OpenPrintPopupMenu(this AutomationRunner testRunner)
        {
            var printerConnection = ApplicationController.Instance.ActivePrinter.Connection;

            if (printerConnection.CommunicationState != CommunicationStates.Connected &&
                printerConnection.CommunicationState != CommunicationStates.FinishedPrint)
            {
                testRunner.ClickByName("Connect to printer button");
                testRunner.WaitFor(() => printerConnection.CommunicationState == CommunicationStates.Connected);
            }

            // Wait for button to become enabled
            var printerPopup = testRunner.GetWidgetByName("PrintPopupMenu", out _);

            testRunner.WaitFor(() => printerPopup.Enabled);

            testRunner.ClickByName("PrintPopupMenu");

            testRunner.ClickByName("Advanced Section");
        }
Beispiel #6
0
        // TODO: Promote to extension method
        private static void WaitForLayerAndResume(AutomationRunner testRunner, PrinterConfig printer, int indexToWaitFor)
        {
            testRunner.WaitForName("Yes Button", 30);

            // Wait for layer
            testRunner.WaitFor(() => printer.Bed.ActiveLayerIndex + 1 == indexToWaitFor, 30, 500);
            Assert.AreEqual(indexToWaitFor, printer.Bed.ActiveLayerIndex + 1);

            testRunner.ClickByName("Yes Button");
            testRunner.WaitForWidgetDisappear("Yes Button", 10);
        }
        private static void WaitForLayerAndResume(AutomationRunner testRunner, int indexToWaitFor)
        {
            testRunner.WaitForName("No Button", 30);

            var printer = ApplicationController.Instance.ActivePrinter;

            // Wait for layer
            testRunner.WaitFor(() => printer.Bed.ActiveLayerIndex + 1 == indexToWaitFor, 30, 500);
            Assert.AreEqual(indexToWaitFor, printer.Bed.ActiveLayerIndex + 1);

            testRunner.ClickByName("No Button");
            testRunner.WaitForWidgetDisappear("No Button", 10);
        }
Beispiel #8
0
        private static void ConfirmExpectedSpeeds(AutomationRunner testRunner, double targetExtrusionRate, double targetFeedRate, string scope)
        {
            SystemWindow systemWindow;
            SolidSlider  slider;

            // Assert the UI has the expected values
            slider = testRunner.GetWidgetByName("Extrusion Multiplier Slider", out systemWindow, 5) as SolidSlider;
            testRunner.WaitFor(() => targetExtrusionRate == slider.Value);

            Assert.AreEqual(targetExtrusionRate, slider.Value, $"Unexpected Extrusion Rate Slider Value - {scope}");

            slider = testRunner.GetWidgetByName("Feed Rate Slider", out systemWindow, 5) as SolidSlider;
            testRunner.WaitFor(() => targetFeedRate == slider.Value);
            Assert.AreEqual(targetFeedRate, slider.Value, $"Unexpected Feed Rate Slider Value - {scope}");

            // Assert the changes took effect on the model
            testRunner.WaitFor(() => targetExtrusionRate == ExtrusionMultiplyerStream.ExtrusionRatio);
            Assert.AreEqual(targetExtrusionRate, ExtrusionMultiplyerStream.ExtrusionRatio, $"Unexpected Extrusion Rate - {scope}");

            testRunner.WaitFor(() => targetFeedRate == FeedRateMultiplyerStream.FeedRateRatio);
            Assert.AreEqual(targetFeedRate, FeedRateMultiplyerStream.FeedRateRatio, $"Unexpected Feed Rate - {scope}");
        }
        public static void WaitForPage(this AutomationRunner testRunner, string headerText)
        {
            // Helper methods
            bool HeaderExists(string text)
            {
                var header     = testRunner.GetWidgetByName("HeaderRow", out _);
                var textWidget = header.Children <TextWidget>().FirstOrDefault();

                return(textWidget?.Text.StartsWith(text) ?? false);
            }

            testRunner.WaitFor(() => HeaderExists(headerText));

            Assert.IsTrue(HeaderExists(headerText), "Expected page not found: " + headerText);
        }
Beispiel #10
0
        public static Emulator LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD", bool runSlow = false)
        {
            SystemWindow systemWindow;

            testRunner.GetWidgetByName("Hardware Tab", out systemWindow, 10);
            // make sure we wait for MC to be up and running
            testRunner.WaitforDraw(systemWindow);

            // Load the TestEnv config
            var config = TestAutomationConfig.Load();

            // Override the heat up time
            Emulator.DefaultHeatUpTime = config.HeatupTime;

            // Override the temp stabilization time
            WaitForTempStream.WaitAfterReachTempTime = config.TempStabilizationTime;

            // Create the printer
            testRunner.AddAndSelectPrinter(make, model);

            // Force the configured printer to use the emulator driver
            ApplicationController.Instance.ActivePrinter.Settings.SetValue("driver_type", "Emulator");

            // edit the com port
            testRunner.SwitchToPrinterSettings();

            var serialPortDropDown = testRunner.GetWidgetByName("com_port Field", out _, 1);

            testRunner.WaitFor(() => serialPortDropDown.Enabled);             // Wait until the serialPortDropDown is ready to click it. Ensures the printer is loaded.

            testRunner.ClickByName("com_port Field");

            testRunner.ClickByName("Emulator Menu Item");

            // connect to the created printer
            testRunner.ClickByName("Connect to printer button");

            testRunner.WaitForName("Disconnect from printer button");

            // Access through static instance must occur after Connect has occurred and the port has spun up
            Emulator.Instance.RunSlow = runSlow;

            return(Emulator.Instance);
        }
Beispiel #11
0
        /// <summary>
        /// Types the specified text into the dialog and sends {Enter} to complete the interaction
        /// </summary>
        /// <param name="testRunner">The TestRunner to interact with</param>
        /// <param name="textValue">The text to type</param>
        public static void CompleteDialog(this AutomationRunner testRunner, string textValue, double secondsToWait = 2)
        {
            // AutomationDialog requires no delay
            if (AggContext.FileDialogs is AutomationDialogProvider)
            {
                // Wait for text widget to have focus
                var widget = testRunner.GetWidgetByName("Automation Dialog TextEdit", out _, 5);
                testRunner.WaitFor(() => widget.ContainsFocus);
            }
            else
            {
                testRunner.Delay(secondsToWait);
            }

            testRunner.Type(textValue);

            testRunner.Type("{Enter}");
            testRunner.WaitForWidgetDisappear("Automation Dialog TextEdit", 5);
        }
Beispiel #12
0
        public static void AddAndSelectPrinter(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD")
        {
            testRunner.GetWidgetByName("WidescreenPanel", out SystemWindow systemWindow, 10);

            // make sure we wait for MC to be up and running
            testRunner.WaitforDraw(systemWindow);

            // Click 'Add Printer' if not on screen
            if (!testRunner.NameExists("Select Make", 0.2))
            {
                if (!testRunner.NameExists("Create Printer", 0.2))
                {
                    // go to the start page
                    testRunner.ClickByName("Hardware Tab");
                    testRunner.ClickByName("Create Printer");
                }
                else
                {
                    if (testRunner.NameExists("Print Button", .2))
                    {
                        testRunner.ClickByName("Print Button");
                    }
                    else
                    {
                        testRunner.ClickByName("Create Printer");
                    }
                }
            }

            testRunner.ClickByName("Select Make");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(make);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());

            testRunner.ClickByName("Select Model");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(model);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());

            // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller.
            // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded.
            testRunner.ClickByName("Next Button");

            testRunner.WaitFor(() => testRunner.WidgetExists <SetupStepComPortOne>());
            testRunner.ClickByName("Cancel Wizard Button");
            testRunner.WaitFor(() => !testRunner.WidgetExists <SetupStepComPortOne>());
        }
Beispiel #13
0
        public static void AddAndSelectPrinter(this AutomationRunner testRunner, string make, string model)
        {
            SystemWindow systemWindow;

            testRunner.GetWidgetByName("Start Tab", out systemWindow, 10);
            // make sure we wait for MC to be up and running
            testRunner.WaitforDraw(systemWindow);

            // If SelectMake is not visible and the ConnectionWizard is, click Skip
            if (!testRunner.NameExists("Select Make", 0.1))
            {
                if (!testRunner.NameExists("Create Printer", 0.1))
                {
                    // go to the start page
                    testRunner.ClickByName("Start Tab");
                }

                testRunner.ClickByName("Create Printer");
            }

            testRunner.ClickByName("Select Make");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(make);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());


            testRunner.ClickByName("Select Model");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(model);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());

            // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller.
            // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded.
            testRunner.ClickByName("Save & Continue Button");

            testRunner.WaitFor(() => testRunner.WidgetExists <SetupStepComPortOne>());
            testRunner.ClickByName("Cancel Wizard Button");
            testRunner.WaitFor(() => !testRunner.WidgetExists <SetupStepComPortOne>());
        }
Beispiel #14
0
        public static void Complete9StepLeveling(this AutomationRunner testRunner, int numUpClicks = 1)
        {
            // Helper methods
            bool headerExists(string headerText)
            {
                var header     = testRunner.GetWidgetByName("HeaderRow", out _);
                var textWidget = header.Children <TextWidget>().FirstOrDefault();

                return(textWidget?.Text.StartsWith(headerText) ?? false);
            }

            void waitForPage(string headerText)
            {
                testRunner.WaitFor(() => headerExists(headerText));
                Assert.IsTrue(headerExists(headerText), "Expected page not found: " + headerText);
            }

            void waitForPageAndAdvance(string headerText)
            {
                waitForPage(headerText);
                testRunner.ClickByName("Next Button");
            }

            testRunner.Delay();

            testRunner.WaitFor(() => headerExists("Initial Printer Setup"));
            if (headerExists("Initial Printer Setup"))
            {
                // do print leveling steps
                waitForPageAndAdvance("Initial Printer Setup");
            }

            waitForPageAndAdvance("Print Leveling Overview");

            waitForPageAndAdvance("Select Material");

            waitForPageAndAdvance("Homing The Printer");

            waitForPageAndAdvance("Waiting For Printer To Heat");

            for (int i = 0; i < 3; i++)
            {
                var section = (i * 3) + 1;

                waitForPage($"Step {section} of 9");
                for (int j = 0; j < numUpClicks; j++)
                {
                    testRunner.Delay();
                    testRunner.ClickByName("Move Z positive");
                }

                waitForPage($"Step {section} of 9");
                testRunner.ClickByName("Next Button");

                waitForPage($"Step {section + 1} of 9");
                testRunner.ClickByName("Next Button");

                waitForPage($"Step {section + 2} of 9");
                testRunner.ClickByName("Next Button");
            }

            testRunner.ClickByName("Done Button");
        }
Beispiel #15
0
 public static void WaitForCommunicationStateDisconnected(this AutomationRunner testRunner, int maxSeconds = 500)
 {
     testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.CommunicationState == CommunicationStates.Disconnected, maxSeconds);
 }