Exemplo n.º 1
0
        public static void EnsureFoldersVisible(this AutomationRunner testRunner)
        {
            var checkBox = (ExpandCheckboxButton)testRunner.GetWidgetByName("Show Folders Toggle", out _, secondsToWait: 0.2);

            if (checkBox?.Checked == false)
            {
                var resetEvent = new AutoResetEvent(false);

                // Wire up event listener
                var          listView        = testRunner.GetWidgetByName("LibraryView", out _) as ListView;
                EventHandler contentReloaded = (s, e) =>
                {
                    resetEvent.Set();
                };
                listView.ContentReloaded += contentReloaded;

                // Start reload
                testRunner.ClickByName("Show Folders Toggle");

                // Wait for reload
                resetEvent.WaitOne();

                // Release event listener
                listView.ContentReloaded -= contentReloaded;
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
        public void EditButtonTurnsOnOffEditMode()
        {
            //Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    /*
                     * Tests that when the edit button is clicked we go into editmode (print queue items have checkboxes on them)
                     * 1. After Edit button is clicked print queue items have check boxes
                     * 2. Selecting multiple queue itema and then clicking the Remove button removes the item
                     * 3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one
                     */

                    bool checkboxExists = testRunner.WaitForName("Queue Item Checkbox", 2);

                    resultsHarness.AddTestResult(checkboxExists == false);

                    resultsHarness.AddTestResult(QueueData.Instance.Count == 4);

                    SystemWindow systemWindow;
                    string       itemName = "Queue Item " + "2013-01-25_Mouthpiece_v2";

                    GuiWidget    queueItem       = testRunner.GetWidgetByName(itemName, out systemWindow, 3);
                    SearchRegion queueItemRegion = testRunner.GetRegionByName(itemName, 3);

                    {
                        testRunner.ClickByName("Queue Edit Button", 2);

                        SystemWindow containingWindow;
                        GuiWidget    foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out containingWindow, 3, searchRegion: queueItemRegion);
                        resultsHarness.AddTestResult(foundWidget != null, "We should have an actual checkbox");
                    }

                    {
                        testRunner.ClickByName("Queue Done Button", 2);

                        testRunner.Wait(.5);

                        SystemWindow containingWindow;
                        GuiWidget    foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out containingWindow, 1, searchRegion: queueItemRegion);
                        resultsHarness.AddTestResult(foundWidget == null, "We should not have an actual checkbox");
                    }

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items, overrideWidth: 600);

            Assert.IsTrue(testHarness.AllTestsPassed(4));
        }
Exemplo n.º 4
0
        public void ClickOnLibraryCheckBoxes()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);

                // Now do the actions specific to this test. (replace this for new tests)
                {
                    testRunner.ClickByName("Library Tab");
                    testRunner.Wait(1);
                    SystemWindow systemWindow;
                    GuiWidget    rowItem = testRunner.GetWidgetByName("Local Library Row Item Collection", out systemWindow);
                    testRunner.Wait(1);

                    SearchRegion rowItemRegion = testRunner.GetRegionByName("Local Library Row Item Collection");

                    testRunner.ClickByName("Library Edit Button");
                    testRunner.Wait(1);

                    SystemWindow containingWindow;
                    GuiWidget    foundWidget    = testRunner.GetWidgetByName("Row Item Select Checkbox", out containingWindow, searchRegion: rowItemRegion);
                    CheckBox     checkBoxWidget = foundWidget as CheckBox;
                    resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

                    testRunner.ClickByName("Row Item Select Checkbox", searchRegion: rowItemRegion);
                    testRunner.Wait(.5);
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked");

                    testRunner.ClickByName("Local Library Row Item Collection");
                    testRunner.Wait(.5);
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

                    MatterControlUITests.CloseMatterControl(testRunner);
                }
            };

#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
            bool showWindow;
            MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness  testHarness         = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 1000);

            // NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable.
            // If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 4);             // make sure we ran all our tests
        }
Exemplo n.º 5
0
        public void ClickOnLibraryCheckBoxes()
        {
            // 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);

                    testRunner.ClickByName("Library Tab", 3);
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

                    SystemWindow systemWindow;
                    string       itemName = "Row Item " + "Calibration - Box";

                    GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);

                    SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);

                    testRunner.ClickByName("Library Edit Button", 3);
                    testRunner.Wait(.5);

                    GuiWidget foundWidget    = testRunner.GetWidgetByName("Row Item Select Checkbox", out systemWindow, 3, searchRegion: rowItemRegion);
                    CheckBox  checkBoxWidget = foundWidget as CheckBox;
                    resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

                    testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
                    testRunner.ClickByName("Library Tab");
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked");

                    testRunner.ClickByName(itemName, 3);
                    testRunner.ClickByName("Library Tab");
                    resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            // NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable.
            // If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 4);             // make sure we ran all our tests
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        public void QueueThumbnailWidgetOpensPartPreview()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    // Tests that clicking a queue item thumbnail opens a Part Preview window

                    bool partPreviewWindowExists1 = testRunner.WaitForName("Part Preview Window Thumbnail", 0);
                    resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");

                    testRunner.ClickByName("Queue Item Thumbnail");

                    SystemWindow containingWindow;
                    GuiWidget    partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window", out containingWindow, 3);
                    resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
                    partPreviewWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
Exemplo n.º 8
0
        //Test Works
        public void ClickOnExportButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    // Tests that clicking the queue export button with a single item selected opens export item window
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    //Make sure that the export window does not exist
                    bool exportWindowExists1 = testRunner.WaitForName("Export Item Window", 0);
                    resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");

                    testRunner.ClickByName("Queue Export Button", 5);
                    SystemWindow containingWindow;
                    GuiWidget    exportWindow = testRunner.GetWidgetByName("Export Item Window", out containingWindow, 5);
                    resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
                    if (exportWindow != null)
                    {
                        exportWindow.CloseOnIdle();
                        testRunner.Wait(.5);
                    }

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
        public static IDisposable LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD", bool runSlow = false)
        {
            // Load the TestEnv config
            var config = TestAutomationConfig.Load();

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

            Emulator emulator = new Emulator();

            emulator.PortName = config.Printer;
            emulator.RunSlow  = runSlow;

            emulator.Startup();

            // edit the com port
            SystemWindow containingWindow;
            var          editButton = testRunner.GetWidgetByName("Edit Printer Button", out containingWindow);

            testRunner.Delay(() => editButton.Enabled, 5);             // Wait until the edit button is ready to click it. Ensures the printer is loaded.
            testRunner.ClickByName("Edit Printer Button", 3);

            testRunner.ClickByName("Serial Port Dropdown", 3);

            testRunner.ClickByName(config.MCPort + " Menu Item", 5);

            testRunner.ClickByName("Cancel Wizard Button");

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

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

            return(emulator);
        }
Exemplo n.º 10
0
        public void SaveAsToQueue()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    //Navigate to Local Library
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Row Item Calibration - Box");
                    MatterControlUtilities.LibraryEditSelectedItem(testRunner);
                    testRunner.Wait(1);

                    //Click Edit button to make edit controls visible
                    testRunner.ClickByName("3D View Edit");
                    testRunner.Wait(1);

                    SystemWindow systemWindow;
                    GuiWidget    partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
                    View3DWidget view3D      = partPreview as View3DWidget;

                    for (int i = 0; i <= 2; i++)
                    {
                        testRunner.ClickByName("3D View Copy");
                        testRunner.Wait(1);
                    }

                    //Click Save As button to save changes to the part
                    testRunner.ClickByName("Save As Menu");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Menu Item");
                    testRunner.Wait(1);

                    //Type in name of new part and then save to Print Queue
                    testRunner.Type("Save As Print Queue");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Print Queue Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Save Button");

                    view3D.CloseOnIdle();
                    testRunner.Wait(.5);

                    //Make sure there is a new Queue item with a name that matches the new part
                    testRunner.Wait(1);
                    testRunner.ClickByName("Queue Tab");
                    testRunner.Wait(1);
                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Save As Print Queue", 5));

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(1));
        }
Exemplo n.º 11
0
        //Test Works
        public void ClickOnCreateButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
                {
                    //Make sure that plugin window does not exist
                    bool pluginWindowExists1 = testRunner.WaitForName("Plugin Chooser Window", 0);
                    resultsHarness.AddTestResult(pluginWindowExists1 == false, "Plugin window does not exist");

                    testRunner.ClickByName("Design Tool Button", 5);

                    //Test that the plugin window does exist after the create button is clicked
                    SystemWindow containingWindow;
                    GuiWidget    pluginWindowExists = testRunner.GetWidgetByName("Plugin Chooser Window", out containingWindow, secondsToWait: 3);
                    resultsHarness.AddTestResult(pluginWindowExists != null, "Plugin Chooser Window");
                    pluginWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUITests.CloseMatterControl(testRunner);
                }
            };

#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
            bool showWindow;
            MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness  testHarness         = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 12
0
        public void QueueThumbnailWidgetOpensPartPreview()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
                {
                    bool partPreviewWindowExists1 = testRunner.WaitForName("Part Preview Window Thumbnail", 0);
                    resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");

                    testRunner.ClickByName("Queue Item Thumbnail");

                    SystemWindow containingWindow;
                    GuiWidget    partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window Thumbnail", out containingWindow, secondsToWait: 3);
                    resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
                    partPreviewWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUITests.CloseMatterControl(testRunner);
                }
            };

#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
            bool   showWindow;
            string testDBFolder = "MC_Three_Queue_Items";
            MatterControlUITests.DataFolderState staticDataState     = MatterControlUITests.MakeNewStaticDataForTesting(testDBFolder);
            MatterControlApplication             matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 300);
            MatterControlUITests.RestoreStaticDataAfterTesting(staticDataState, true);
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 13
0
        //Test Works
        public void ClickOnExportButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
                {
                    //Make sure that the export window does not exist
                    bool exportWindowExists1 = testRunner.WaitForName("Export Window Queue", 0);
                    resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");

                    testRunner.ClickByName("Export Queue Button", 5);
                    SystemWindow containingWindow;
                    GuiWidget    exportWindow = testRunner.GetWidgetByName("Export Window Queue", out containingWindow, secondsToWait: 5);
                    resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
                    exportWindow.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUITests.CloseMatterControl(testRunner);
                }
            };

#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
            bool   showWindow;
            string testDBFolder = "MC_Three_Queue_Items";
            MatterControlUITests.DataFolderState staticDataState     = MatterControlUITests.MakeNewStaticDataForTesting(testDBFolder);
            MatterControlApplication             matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
            MatterControlUITests.RestoreStaticDataAfterTesting(staticDataState, true);
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 14
0
        public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
        {
            // 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)
                {
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.ClickByName("Create Folder From Library Button");

                    testRunner.Wait(.5);
                    testRunner.Type("Test Text");
                    testRunner.Wait(.5);

                    SystemWindow     containingWindow;
                    GuiWidget        textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
                    MHTextEditWidget textWidgetMH    = textInputWidget as MHTextEditWidget;
                    resultsHarness.AddTestResult(textWidgetMH != null, "Found Text Widget");
                    resultsHarness.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
                    containingWindow.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 15
0
        //Test Works
        public void ClickOnExportButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Make sure that the export window does not exist
                    bool exportWindowExists1 = testRunner.WaitForName("Export Window Queue", 0);
                    resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");

                    testRunner.ClickByName("Export Queue Button", 5);
                    SystemWindow containingWindow;
                    GuiWidget    exportWindow = testRunner.GetWidgetByName("Export Window Queue", out containingWindow, 5);
                    resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
                    if (exportWindow != null)
                    {
                        exportWindow.CloseOnIdle();
                        testRunner.Wait(.5);
                    }

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 16
0
        public void ClickingShowTerminalButtonOpensTerminal()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    testRunner.ClickByName("SettingsAndControls", 5);
                    testRunner.Wait(2);
                    testRunner.ClickByName("Options Tab", 6);

                    bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
                    resultsHarness.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");

                    testRunner.ClickByName("Show Terminal Button", 6);
                    testRunner.Wait(1);

                    SystemWindow containingWindow;
                    GuiWidget    terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
                    resultsHarness.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
                    containingWindow.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 17
0
        public void GroupAndUngroup()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    SystemWindow systemWindow;

                    //Navigate to Local Library
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Row Item Calibration - Box");
                    testRunner.ClickByName("Row Item Calibration - Box Print Button");
                    testRunner.Wait(1);

                    //Get View3DWidget and count MeshGroups before Copy button is clicked
                    GuiWidget    partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
                    View3DWidget view3D      = partPreview as View3DWidget;

                    string copyButtonName = "3D View Copy";

                    //Click Edit button to make edit controls visible
                    testRunner.ClickByName("3D View Edit");
                    testRunner.Wait(1);
                    int partCountBeforeCopy = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partCountBeforeCopy == 1);

                    for (int i = 0; i <= 4; i++)
                    {
                        testRunner.ClickByName(copyButtonName);
                        testRunner.Wait(1);
                    }

                    //Get MeshGroupCount before Group is clicked
                    System.Threading.Thread.Sleep(2000);
                    int partsOnBedBeforeGroup = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partsOnBedBeforeGroup == 6);

                    //Click Group Button and get MeshGroup count after Group button is clicked
                    testRunner.ClickByName("3D View Group");
                    System.Threading.Thread.Sleep(2000);
                    int partsOnBedAfterGroup = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partsOnBedAfterGroup == 1);

                    testRunner.ClickByName("3D View Ungroup");
                    System.Threading.Thread.Sleep(2000);
                    int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partsOnBedAfterUngroup == 6);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 4);             // make sure we ran all our tests
        }
Exemplo n.º 18
0
        //Test Works
        public void ClickOnCreateButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Make sure that plugin window does not exist
                    bool pluginWindowExists1 = testRunner.WaitForName("Plugin Chooser Window", 0);
                    resultsHarness.AddTestResult(pluginWindowExists1 == false, "Plugin window does not exist");

                    testRunner.ClickByName("Design Tool Button", 5);

                    //Test that the plugin window does exist after the create button is clicked
                    SystemWindow containingWindow;
                    GuiWidget    pluginWindowExists = testRunner.GetWidgetByName("Plugin Chooser Window", out containingWindow, secondsToWait: 3);
                    resultsHarness.AddTestResult(pluginWindowExists != null, "Plugin Chooser Window");
                    pluginWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 19
0
        public static SliceSettingData NavigateToSliceSettingsField(this AutomationRunner testRunner, string userLevel, string slicerConfigName)
        {
            var rootLevel = SettingsOrganizer.Instance.UserLevels[userLevel];

            var settingData = SettingsOrganizer.Instance.GetSettingsData(slicerConfigName);

            var subGroup = rootLevel.GetContainerForSetting(slicerConfigName);

            var category = subGroup.Group.Category;

            // Click tab
            testRunner.ClickByName(category.Name + " Tab");

            // Open the subGroup if required
            var foundWidget = testRunner.GetWidgetByName(subGroup.Name + " Panel", out _);

            if (foundWidget != null)
            {
                var containerCheckBox = foundWidget.Descendants <ExpandCheckboxButton>().First();
                if (!containerCheckBox.Checked)
                {
                    containerCheckBox.Checked = true;
                    testRunner.Delay();
                }
            }

            return(settingData);
        }
Exemplo n.º 20
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");
                }
            }
        }
Exemplo n.º 21
0
        public void QueueThumbnailWidgetOpensPartPreview()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    bool partPreviewWindowExists1 = testRunner.WaitForName("Part Preview Window Thumbnail", 0);
                    resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");

                    testRunner.ClickByName("Queue Item Thumbnail");

                    SystemWindow containingWindow;
                    GuiWidget    partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window Thumbnail", out containingWindow, 3);
                    resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
                    partPreviewWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Exemplo n.º 22
0
        public static void InlineTitleEdit(this AutomationRunner testRunner, string controlName, string replaceString)
        {
            testRunner.ClickByName(controlName + " Edit");
            testRunner.ClickByName(controlName + " Field");
            var textWidget = testRunner.GetWidgetByName(controlName + " Field", out _);

            textWidget.Text = replaceString;
            testRunner.ClickByName(controlName + " Save");
        }
Exemplo n.º 23
0
        public void CopyButtonClickedMakesCopyOfPartOnBed()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    SystemWindow systemWindow;

                    //Navigate to Local Library
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Row Item Calibration - Box");
                    testRunner.ClickByName("Row Item Calibration - Box View Button");
                    testRunner.Wait(1);

                    //Get View3DWidget and count MeshGroups before Copy button is clicked
                    GuiWidget    partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
                    View3DWidget view3D      = partPreview as View3DWidget;

                    string copyButtonName = "3D View Copy";

                    //Click Edit button to make edit controls visible
                    testRunner.ClickByName("3D View Edit");
                    testRunner.Wait(1);
                    int partCountBeforeCopy = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partCountBeforeCopy == 1);


                    //Click Copy button and count MeshGroups
                    testRunner.ClickByName(copyButtonName);
                    System.Threading.Thread.Sleep(500);
                    int partCountAfterCopy = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partCountAfterCopy == 2);
                    testRunner.Wait(1);

                    //Click Copy button a second time and count MeshGroups again
                    testRunner.ClickByName(copyButtonName);
                    System.Threading.Thread.Sleep(500);
                    int partCountAfterSecondCopy = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partCountAfterSecondCopy == 3);
                    view3D.CloseOnIdle();
                    testRunner.Wait(.5);


                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 3);             // make sure we ran all our tests
        }
Exemplo n.º 24
0
        private static void ConfirmExpectedSpeeds(AutomationRunner testRunner, double targetExtrusionRate, double targetFeedRate)
        {
            SystemWindow systemWindow;
            SolidSlider  slider;

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

            slider = testRunner.GetWidgetByName("Feed Rate Slider", out systemWindow, 5) as SolidSlider;
            Assert.AreEqual(targetFeedRate, slider.Value);

            testRunner.Delay(.2);

            // Assert the changes took effect on the model
            Assert.AreEqual(targetExtrusionRate, ExtrusionMultiplyerStream.ExtrusionRatio);
            Assert.AreEqual(targetFeedRate, FeedRateMultiplyerStream.FeedRateRatio);
        }
Exemplo n.º 25
0
        private static void ConfirmExpectedSpeeds(AutomationRunner testRunner, double targetExtrusionRate, double targetFeedRate)
        {
            SystemWindow systemWindow;
            SolidSlider  slider;

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

            slider = testRunner.GetWidgetByName("Feed Rate Slider", out systemWindow, 5) as SolidSlider;
            Assert.AreEqual(targetFeedRate, slider.Value);

            testRunner.Delay(.2);

            // Assert the changes took effect on the model
            Assert.AreEqual(targetExtrusionRate, ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.extrusion_ratio));
            Assert.AreEqual(targetFeedRate, ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.feedrate_ratio));
        }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
0
        public void RemoveButtonRemovesParts()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    SystemWindow systemWindow;

                    //Navigate to Local Library
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Row Item Calibration - Box");
                    MatterControlUtilities.LibraryEditSelectedItem(testRunner);
                    testRunner.Wait(1);

                    //Get View3DWidget and count MeshGroups before Copy button is clicked
                    GuiWidget    partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
                    View3DWidget view3D      = partPreview as View3DWidget;

                    string copyButtonName = "3D View Copy";

                    //Click Edit button to make edit controls visible
                    testRunner.ClickByName("3D View Edit");
                    testRunner.Wait(1);
                    int partCountBeforeCopy = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partCountBeforeCopy == 1);

                    for (int i = 0; i <= 4; i++)
                    {
                        testRunner.ClickByName(copyButtonName);
                        testRunner.Wait(1);
                    }

                    //Get MeshGroupCount before Group is clicked
                    System.Threading.Thread.Sleep(2000);
                    int partsOnBedBeforeRemove = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(partsOnBedBeforeRemove == 6);

                    //Check that MeshCount decreases by 1
                    testRunner.ClickByName("3D View Remove");
                    System.Threading.Thread.Sleep(2000);
                    int meshCountAfterRemove = view3D.MeshGroups.Count();
                    resultsHarness.AddTestResult(meshCountAfterRemove == 5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(3));
        }
Exemplo n.º 28
0
        private static void HighlightWidget(AutomationRunner testRunner, string widgetNameToHighlight)
        {
            SystemWindow containingWindow;
            var          autoLevelRowItem = testRunner.GetWidgetByName(widgetNameToHighlight, out containingWindow, .2);

            if (autoLevelRowItem != null)
            {
                AttentionGetter.GetAttention(autoLevelRowItem);
            }
        }
Exemplo n.º 29
0
        public static void ExpandEditTool(this AutomationRunner testRunner, string expandCheckboxButtonName)
        {
            var mirrorPanel = testRunner.GetWidgetByName(expandCheckboxButtonName, out _);
            var checkBox    = mirrorPanel.Children <ExpandCheckboxButton>().FirstOrDefault();

            if (checkBox?.Checked != true)
            {
                testRunner.ClickByName(expandCheckboxButtonName);
            }
        }
        public void LibraryQueueViewRefreshesOnAddItem()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    testRunner.ClickByName("Library Tab", 5);

                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Row Item Calibration - Box");
                    testRunner.ClickByName("Row Item Calibration - Box View Button");
                    testRunner.Wait(1);

                    SystemWindow systemWindow;
                    GuiWidget    partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
                    View3DWidget view3D      = partPreview as View3DWidget;

                    resultsHarness.AddTestResult(testRunner.ClickByName("3D View Edit", 3));

                    resultsHarness.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
                    // wait for the copy to finish
                    testRunner.Wait(.1);
                    resultsHarness.AddTestResult(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
                    resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
                    resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");

                    testRunner.Wait(1);

                    testRunner.Type("0Test Part");
                    resultsHarness.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));

                    resultsHarness.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));

                    view3D.CloseOnIdle();
                    testRunner.Wait(.5);

                    // ensure that it is now in the library folder (that the folder updated)
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item " + "0Test Part", 5), "The part we added should be in the library");

                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 8);             // make sure we ran all our tests
        }