Example #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");
                }
            }
        }
Example #2
0
        public static void NavigateToFolder(this AutomationRunner testRunner, string libraryRowItemName)
        {
            testRunner.EnsureContentMenuOpen();
            testRunner.EnsureFoldersVisible();

            switch (libraryRowItemName)
            {
            case "Calibration Parts Row Item Collection":
            case "Cloud Library Row Item Collection":
            case "Print Queue Row Item Collection":
            case "Local Library Row Item Collection":
                if (!testRunner.NameExists("Library Row Item Collection"))
                {
                    testRunner.ClickByName("Bread Crumb Button Home");
                    testRunner.Delay();
                }

                // If visible, navigate into Libraries container before opening target
                if (testRunner.NameExists("Library Row Item Collection"))
                {
                    testRunner.DoubleClickByName("Library Row Item Collection");
                }

                break;
            }

            testRunner.DoubleClickByName(libraryRowItemName);
        }
Example #3
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>());
        }
Example #4
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);
 }
Example #5
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);
            }
        }
        private void ShowPrintLevelSettings()
        {
            AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);

            testRunner.TimeToMoveMouse = 0;
            testRunner.UpDelaySeconds  = 0;

            if (testRunner.NameExists("SettingsAndControls"))
            {
                testRunner.ClickByName("SettingsAndControls", 5);
                testRunner.Wait(.2);
            }
            testRunner.ClickByName("Slice Settings Tab", .1);
            testRunner.ClickByName("Options Tab", .2);

            SystemWindow containingWindow;
            var          autoLevelRowItem = testRunner.GetWidgetByName("AutoLevelRowItem", out containingWindow, .2);

            if (autoLevelRowItem != null)
            {
                new AttentionGetter(autoLevelRowItem);
            }

            testRunner.Dispose();
        }
Example #7
0
        public static void NavigateToLibraryHome(this AutomationRunner testRunner)
        {
            while (!testRunner.NameExists("Local Library Row Item Collection", .5))
            {
                testRunner.ClickByName("Library Up Button");
                testRunner.Delay(1);
            }

            testRunner.Delay(.5);
        }
Example #8
0
 public static void SwitchToAdvancedSettings(AutomationRunner testRunner, AutomationTesterHarness resultsHarness)
 {
     if (testRunner.NameExists("SettingsAndControls"))
     {
         testRunner.ClickByName("SettingsAndControls", 1);
         testRunner.Wait(.5);
     }
     resultsHarness.AddTestResult(testRunner.ClickByName("User Level Dropdown", 1), "Click Settings Mode dropdown");
     resultsHarness.AddTestResult(testRunner.ClickByName("Advanced Menu Item", 1), "Click 'Advanced' settings");
     testRunner.Wait(.5);
 }
Example #9
0
        /// <summary>
        /// Switch to printer settings
        /// </summary>
        /// <param name="testRunner"></param>
        public static void SwitchToPrinterSettings(this AutomationRunner testRunner)
        {
            testRunner.SwitchToSliceSettings();

            if (!testRunner.NameExists("Printer Tab", 0.1))
            {
                testRunner.ClickByName("Printer Overflow Menu");
                testRunner.ClickByName("Configure Printer Menu Item");
            }
            testRunner.ClickByName("Printer Tab");
        }
Example #10
0
        public static void Select3DPart(this AutomationRunner testRunner, string partNameToSelect)
        {
            if (testRunner.NameExists("3D View Edit", .2))
            {
                testRunner.ClickByName("3D View Edit");
            }
            testRunner.DragDropByName("InteractionLayer", "InteractionLayer", offsetDrop: new Agg.Point2D(10, 15), mouseButtons: MouseButtons.Right);

            testRunner.Delay(1);
            testRunner.ClickByName(partNameToSelect);
        }
Example #11
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>());
        }
Example #12
0
        /// <summary>
        /// Switch to Printer -> Terminal
        /// </summary>
        /// <param name="testRunner"></param>
        public static void SwitchToTerminalTab(this AutomationRunner testRunner)
        {
            // Change to Printer Controls
            EnsurePrinterSidebarOpen(testRunner);

            if (!testRunner.NameExists("Terminal Tab", 0.2))
            {
                testRunner.ClickByName("Printer Overflow Menu");
                testRunner.ClickByName("Show Terminal Menu Item");
            }

            testRunner.ClickByName("Terminal Tab");
        }
Example #13
0
        private void ShowPrinterSettings()
        {
            AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);

            testRunner.TimeToMoveMouse = 0;
            testRunner.UpDelaySeconds  = 0;

            if (testRunner.NameExists("SettingsAndControls"))
            {
                testRunner.ClickByName("SettingsAndControls", 5);
                testRunner.Wait(.2);
            }
            testRunner.ClickByName("Slice Settings Tab", .1);
            testRunner.ClickByName("Printer Tab", .2);
            testRunner.ClickByName("Connection Tab", .1);
            testRunner.Dispose();
        }
        public void MatterControlRuns()
        {
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner();
                {
                    MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);

                    resultsHarness.AddTestResult(testRunner.NameExists("SettingsAndControls"));

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);

            Assert.IsTrue(testHarness.AllTestsPassed(1));
        }
        public void PrinterNameStaysChanged()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);

                // Now do the actions specific to this test. (replace this for new tests)
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");

                    MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);

                    resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab");

                    string widgetName = "Printer Name Edit";
                    testRunner.ClickByName(widgetName);

                    SystemWindow window;
                    var          textWidget = testRunner.GetWidgetByName(widgetName, out window);
                    string       newName    = "Updated name";
                    textWidget.Text = newName;
                    testRunner.ClickByName("Printer Tab", 1);
                    testRunner.Wait(4);

                    //Check to make sure the Printer dropdown gets the name change
                    testRunner.ClickByName("Printers... Menu", 2);
                    testRunner.Wait(1);
                    resultsHarness.AddTestResult(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists");

                    //Make sure the Active profile name changes as well
                    resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(5));
        }
        public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model)
        {
            if (!testRunner.NameExists("Select Make"))
            {
                testRunner.ClickByName("Printers... Menu", 2, delayBeforeReturn: .5);
                testRunner.ClickByName("Add New Printer... Menu Item", 5, delayBeforeReturn: .5);
            }

            testRunner.ClickByName("Select Make", 5);
            testRunner.Type(make);
            testRunner.Type("{Enter}");

            testRunner.ClickByName("Select Model", 5);
            testRunner.Type(model);
            testRunner.Type("{Enter}");

            // 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.
            WaitForReloadAll(testRunner, () => testRunner.ClickByName("Save & Continue Button", 2));

            testRunner.ClickByName("Cancel Wizard Button", 5);
            testRunner.Delay(1);
        }