public async Task LibraryQueueViewRefreshesOnAddItem()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.OpenEmptyPartTab();

                testRunner.AddItemToBedplate();

                var view3D = testRunner.GetWidgetByName("View3DWidget", out _) as View3DWidget;
                var scene  = view3D.Object3DControlLayer.Scene;

                testRunner.WaitFor(() => scene.SelectedItem != null);
                Assert.IsNotNull(scene.SelectedItem, "Expect part selection after Add to Bed action");

                testRunner.ClickByName("Duplicate Button");

                // wait for the copy to finish
                testRunner.Delay(.1);
                testRunner.ClickByName("Remove Button");

                testRunner.SaveBedplateToFolder("0Test Part", "Local Library Row Item Collection");

                // Click Home -> Local Library
                testRunner.NavigateToLibraryHome();
                testRunner.NavigateToFolder("Local Library Row Item Collection");

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

                testRunner.Delay(.5);

                return(Task.CompletedTask);
            }, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items, overrideWidth : 1300);
        }
Esempio n. 2
0
        public async Task PrinterDeletedWhilePrinting()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should exist after add");

                    var printer = testRunner.FirstPrinter();

                    // print a part
                    testRunner.AddItemToBedplate();
                    testRunner.StartPrint(printer, pauseAtLayers: "2");
                    ProfileManager.DebugPrinterDelete = true;

                    // Wait for pause dialog
                    testRunner.ClickResumeButton(printer, true, 1);

                    // Wait for done
                    testRunner.WaitForPrintFinished(printer);
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 180);
        }
        public async Task HasHeatedBedCheckedHidesBedTemperatureOptions()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.WaitForFirstDraw();

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

                // Navigate to Settings Tab and make sure Bed Temp Text box is visible
                testRunner.SwitchToSliceSettings();

                testRunner.SelectSliceSettingsField("Advanced", SettingsKey.bed_temperature);
                testRunner.SelectSliceSettingsField("Advanced", SettingsKey.temperature);

                // Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
                testRunner.SwitchToPrinterSettings();

                testRunner.SelectSliceSettingsField("Printer", SettingsKey.has_heated_bed);
                testRunner.Delay(.5);

                testRunner.SwitchToSliceSettings();
                testRunner.NavigateToSliceSettingsField("Advanced", SettingsKey.temperature);
                Assert.IsFalse(testRunner.WaitForName("Bed Temperature Textbox", .5), "Filament -> Bed Temp should not be visible after Heated Bed unchecked");

                // Make sure Bed Temperature Options are not visible in printer controls
                testRunner.SwitchToControlsTab();

                Assert.IsFalse(testRunner.WaitForName("Bed Temperature Controls Widget", .5), "Controls -> Bed Temp should not be visible after Heated Bed unchecked");

                return(Task.CompletedTask);
            });
        }
        public async Task RenameButtonRenamesLocalLibraryFolder()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.AddAndSelectPrinter();

                // Navigate to Local Library
                testRunner.NavigateToFolder("Local Library Row Item Collection");

                // Create New Folder
                string folderID = testRunner.CreateChildFolder("New Folder");

                testRunner.ClickByName(folderID);
                testRunner.Delay(.2);

                testRunner.LibraryRenameSelectedItem();

                testRunner.Delay(.5);
                testRunner.Type("Renamed Library Folder");

                testRunner.ClickByName("InputBoxPage Action Button");
                testRunner.Delay(.2);

                // Make sure the renamed Library Folder exists
                Assert.IsTrue(testRunner.WaitForName("Renamed Library Folder Row Item Collection"), "Renamed folder should exist");

                return(Task.CompletedTask);
            });
        }
Esempio n. 5
0
        public async Task CreateFolderStarsOutWithTextFiledFocusedAndEditable()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                testRunner.ClickByName("Library Tab");
                testRunner.NavigateToFolder("Local Library Row Item Collection");
                testRunner.ClickByName("Create Folder From Library Button");

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

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

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Esempio n. 6
0
        public async Task ClickQueueRowItemViewAndRemove()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                testRunner.Delay(2);

                Assert.AreEqual(4, QueueData.Instance.ItemCount, "Queue should initially have four items");
                Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 1));
                Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));

                testRunner.ClickByName("Queue Item Batman", 1);
                testRunner.ClickByName("Queue Item Batman Remove");
                testRunner.Delay(2);

                Assert.AreEqual(3, QueueData.Instance.ItemCount, "Batman item removed");
                Assert.IsFalse(testRunner.NameExists("Queue Item Batman"), "Batman item removed");

                Assert.IsFalse(testRunner.NameExists("Queue Item 2013-01-25_Mouthpiece_v2 Part Preview"), "Mouthpiece Part Preview should not initially be visible");
                testRunner.ClickByName("Queue Item 2013-01-25_Mouthpiece_v2", 1);
                testRunner.Delay(2);
                testRunner.ClickByName("Queue Item 2013-01-25_Mouthpiece_v2 View", 1);

                Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2 Part Preview", 2), "The Mouthpiece Part Preview should appear after the view button is clicked");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items, overrideWidth : 600);
        }
Esempio n. 7
0
        public async Task ExportDesignTabAsSTL()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.WaitForFirstDraw();

                // save from design tab
                var gcodeOutputPath     = MatterControlUtilities.PathToExportGcodeFolder;
                var fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Cube2");
                Directory.CreateDirectory(gcodeOutputPath);
                testRunner.EnsureWelcomePageClosed()
                .ClickByName("Create New")
                .AddItemToBed()
                .ClickByName("Bed Options Menu")
                .ClickByName("Export Menu Item")
                .WaitForName("Export Item Window");

                testRunner.ClickByName("STL File Button")
                .ClickByName("Export Button")
                .Delay()
                .Type(fullPathToGcodeFile)
                .Type("{Enter}")
                .WaitFor(() => File.Exists(fullPathToGcodeFile + ".stl"), 10);

                testRunner.WaitFor(() => File.Exists(fullPathToGcodeFile + ".stl"), 10);
                Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".stl"), "Exported file not found");

                return(Task.FromResult(0));
            });
        }
Esempio n. 8
0
        public async Task RenameDownloadsPrintItem()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                // Navigate to Downloads Library Provider
                testRunner.NavigateToFolder("Downloads Row Item Collection");
                testRunner.NavigateToFolder("-Temporary Row Item Collection");
                testRunner.InvokeLibraryAddDialog();

                testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Batman.stl"), 2);

                // Rename added item
                testRunner.ClickByName("Row Item Batman.stl");

                testRunner.LibraryRenameSelectedItem();

                testRunner.WaitForName("InputBoxPage Action Button");
                testRunner.Type("Batman Renamed");

                testRunner.ClickByName("InputBoxPage Action Button");

                Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed.stl", 2));

                return(Task.CompletedTask);
            });
        }
        public async Task PrinterRecoveryTest()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should exist after add");

                    var printer = testRunner.FirstPrinter();
                    printer.Settings.SetValue(SettingsKey.recover_is_enabled, "1");
                    printer.Settings.SetValue(SettingsKey.has_hardware_leveling, "0");

                    // TODO: Delay needed to work around timing issue in MatterHackers/MCCentral#2415
                    testRunner.Delay(1);

                    Assert.IsTrue(printer.Connection.RecoveryIsEnabled);

                    // print a part
                    testRunner.AddItemToBedplate();
                    testRunner.StartPrint(pauseAtLayers: "2;4;6");

                    // Wait for pause dialog
                    testRunner.WaitForName("Yes Button", 15);                     // the yes button is 'Resume'

                    // validate the current layer
                    Assert.AreEqual(1, printer.Connection.CurrentlyPrintingLayer);

                    // Resume
                    testRunner.ClickByName("Yes Button");

                    // the printer is now paused
                    // close the pause dialog pop-up do not resume
                    ClickDialogButton(testRunner, printer, "No Button", 3);

                    // Disconnect
                    testRunner.ClickByName("Disconnect from printer button");

                    // Reconnect
                    testRunner.WaitForName("Connect to printer button", 10);
                    testRunner.ClickByName("Connect to printer button");

                    testRunner.WaitFor(() => printer.Connection.CommunicationState == CommunicationStates.Connected);

                    // Assert that recovery happens
                    Assert.IsTrue(PrintRecovery.RecoveryAvailable(printer), "Recovery should be enabled after Disconnect while printing");

                    // Recover the print
                    ClickDialogButton(testRunner, printer, "Yes Button", -1);

                    // The first pause that we get after recovery should be layer 6.
                    // wait for the pause and continue
                    ClickDialogButton(testRunner, printer, "Yes Button", 5);

                    // Wait for done
                    testRunner.WaitForPrintFinished(printer);
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 180);
        }
        public async Task RenameButtonRenameLocalLibraryItem()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.AddAndSelectPrinter();

                testRunner.AddTestAssetsToLibrary(new[] { "Rook.amf" });

                testRunner.ClickByName("Row Item Rook");

                // Open and wait rename window
                testRunner.LibraryRenameSelectedItem();
                testRunner.WaitForName("InputBoxPage Action Button");

                testRunner.Delay(1);

                // Rename item
                testRunner.Type("Rook Renamed");
                testRunner.ClickByName("InputBoxPage Action Button");

                // Confirm
                Assert.IsTrue(testRunner.WaitForName("Row Item Rook Renamed"));
                Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 1));

                return(Task.CompletedTask);
            }, overrideWidth : 600);
        }
Esempio n. 11
0
        public async Task DownloadsAddButtonAddsMultipleFiles()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                // Navigate to Downloads Library Provider
                testRunner.NavigateToFolder("Downloads Row Item Collection");
                testRunner.NavigateToFolder("-Temporary Row Item Collection");

                // Add both files to the FileOpen dialog
                testRunner.InvokeLibraryAddDialog();
                testRunner.CompleteDialog(
                    string.Format(
                        "\"{0}\" \"{1}\"",
                        MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
                        MatterControlUtilities.GetTestItemPath("Batman.stl")),
                    5);

                Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Fennec Fox item exists");
                Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Batman item exists");

                return(Task.CompletedTask);
            });
        }
Esempio n. 12
0
        public async Task PrinterRecoveryTest()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    ActiveSliceSettings.Instance.SetValue(SettingsKey.recover_is_enabled, "1");
                    ActiveSliceSettings.Instance.SetValue(SettingsKey.has_hardware_leveling, "0");

                    Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null);

                    // TODO: Delay needed to work around timing issue in MatterHackers/MCCentral#2415
                    testRunner.Delay(1);

                    testRunner.OpenPrintPopupMenu();
                    testRunner.ClickByName("Layer(s) To Pause Field");
                    testRunner.Type("2;4;6");

                    Assert.IsTrue(ApplicationController.Instance.ActivePrinter.Connection.RecoveryIsEnabled);

                    // print a part
                    testRunner.AddItemToBedplate();
                    testRunner.StartPrint();

                    // Dismiss pause dialog
                    testRunner.WaitForName("No Button", 90);                     // the no button is 'Resume'

                    // validate the current layer
                    Assert.AreEqual(1, ApplicationController.Instance.ActivePrinter.Connection.CurrentlyPrintingLayer);
                    testRunner.ClickByName("No Button");

                    // the printer is now paused
                    // close the pause dialog pop-up do not resume
                    ClickDialogButton(testRunner, "Yes Button", 3);

                    // Disconnect
                    testRunner.ClickByName("Disconnect from printer button");

                    // Reconnect
                    testRunner.WaitForName("Connect to printer button", 10);
                    testRunner.ClickByName("Connect to printer button");

                    testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.CommunicationState == CommunicationStates.Connected);

                    // Assert that recovery happens

                    // Recover the print
                    ClickDialogButton(testRunner, "Yes Button", -1);

                    // The first pause that we get after recovery should be layer 6.
                    // wait for the pause and continue
                    ClickDialogButton(testRunner, "No Button", 5);

                    // Wait for done
                    testRunner.WaitForPrintFinished();
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 180);
        }
Esempio n. 13
0
        public async Task CompletingPrintTurnsoffHeat()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.WaitForName("Cancel Wizard Button", 1);

                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null);

                    testRunner.SelectSliceSettingsField("Printer", "end_gcode");

                    testRunner.Type("^a");
                    testRunner.Type("{BACKSPACE}");
                    testRunner.Type("G28");

                    testRunner.SelectSliceSettingsField("Printer", "start_gcode");

                    // Validate GCode fields persist values
                    Assert.AreEqual(
                        "G28",
                        ApplicationController.Instance.ActivePrinter.Settings.GetValue(SettingsKey.end_gcode),
                        "Failure persisting GCode/MultilineTextField value");

                    testRunner.AddItemToBedplate();

                    // Shorten the delay so the test runs in a reasonable time
                    ApplicationController.Instance.ActivePrinter.Connection.TimeToHoldTemperature = 5;

                    testRunner.StartPrint();

                    // Wait for print to finish
                    testRunner.WaitForPrintFinished();

                    // Wait for expected temp
                    testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0, 10);
                    Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0), 30);

                    // Wait for expected temp
                    testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature <= 10);
                    Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature, 10);

                    // Make sure we can run this whole thing again
                    testRunner.StartPrint();

                    // Wait for print to finish
                    testRunner.WaitForPrintFinished();

                    // Wait for expected temp
                    testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0) <= 0, 10);
                    Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.GetActualHotendTemperature(0), 30);

                    // Wait for expected temp
                    testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature <= 10);
                    Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature, 10);
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 95);
        }
        public async Task HasHardwareLevelingHidesLevelingSettings()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                //Add printer that has hardware leveling
                MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");

                MatterControlUtilities.SwitchToAdvancedSettings(testRunner);

                testRunner.ClickByName("Printer Tab", 1);
                testRunner.Delay(1);

                //Make sure Print Leveling tab is not visible
                bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
                Assert.IsTrue(testPrintLeveling == false);

                //Add printer that does not have hardware leveling
                MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");

                testRunner.ClickByName("Slice Settings Tab", 1);

                testRunner.ClickByName("Printer Tab", 1);

                //Make sure Print Leveling tab is visible
                bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
                Assert.IsTrue(printLevelingVisible == true);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, overrideHeight : 800);
        }
Esempio n. 15
0
        public async Task RemoveAllMenuItemClickedRemovesAll()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();
                Assert.AreEqual(4, QueueData.Instance.ItemCount, "Queue has expected 4 items, including default Coin");

                // Assert that widgets exists
                Assert.IsTrue(testRunner.WaitForName("Queue Item Batman"), "Batman part exists");
                Assert.IsTrue(testRunner.WaitForName("Queue Item Fennec_Fox"), "Fox part exists");
                Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part exists");

                // Act - remove all print queue items
                testRunner.RemoveAllFromQueue();

                testRunner.Delay(() => QueueData.Instance.ItemCount == 0, 5);

                // Assert that object model has been cleared
                Assert.AreEqual(0, QueueData.Instance.ItemCount, "Queue is empty after RemoveAll action");

                // Assert that widgets have been removed
                testRunner.Delay(.5);

                Assert.IsFalse(testRunner.NameExists("Queue Item Batman"), "Batman part removed");
                Assert.IsFalse(testRunner.NameExists("Queue Item Fennec_Fox"), "Fox part removed");
                Assert.IsFalse(testRunner.NameExists("Queue Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part removed");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
Esempio n. 16
0
        public void SaveAsToDownloads()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Navigate to Downloads
                    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);

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

                    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 Downloads
                    testRunner.Type("Save As Downloads");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Save Button");

                    //Make sure there is a new Downloads item with a name that matches the new opart
                    testRunner.Wait(1);
                    testRunner.ClickByName("Library Tab");
                    testRunner.ClickByName("Bread Crumb Button Home");
                    testRunner.Wait(1);
                    MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Save As Downloads", 5));

                    //Do clean up for Downloads
                    testRunner.ClickByName("Row Item Save As Downloads", 2);
                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("Library Remove Item Button");

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 1);             // make sure we ran all our tests
        }
Esempio n. 17
0
        public async Task ClickingCreateButtonOpensPluginWindow()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();
                // Tests that clicking the create button opens create tools plugin window
                testRunner.CloseSignInAndPrinterSelect();

                //Make sure that plugin window does not exist
                bool pluginWindowExists1 = testRunner.WaitForName("Plugin Chooser Window", 0);
                Assert.IsTrue(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);
                Assert.IsTrue(pluginWindowExists != null, "Plugin Chooser Window");
                pluginWindowExists.CloseOnIdle();
                testRunner.Delay(.5);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Esempio n. 18
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
        }
Esempio n. 19
0
        public async Task QueueAddButtonAddsGcodeFile()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                int initialQueueCount = QueueData.Instance.ItemCount;

                // Click Add button
                testRunner.ClickByName("Queue Add Button");
                testRunner.Delay(1);

                testRunner.Type(MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                // Widget should exist
                Assert.IsTrue(testRunner.WaitForName("Queue Item chichen-itza_pyramid", 5), "Widget for added item should exist in control tree");

                // Queue count should increases by one
                Assert.AreEqual(initialQueueCount + 1, QueueData.Instance.ItemCount, "After adding item, queue count should increase by one");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Esempio n. 20
0
        public async Task QueueExportIsDisabledIfEmpty()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                SystemWindow systemWindow;

                testRunner.ClickByName("Queue... Menu", 2);

                var exportButton = testRunner.GetWidgetByName(" Export to Zip Menu Item", out systemWindow, 5);
                Assert.IsNotNull(exportButton, "Export button should exist");
                Assert.IsTrue(exportButton.Enabled, "Export button should be enabled");

                testRunner.ClickByName(" Remove All Menu Item", 2);

                testRunner.Delay(1);

                testRunner.ClickByName("Queue... Menu", 2);
                testRunner.Delay(() => !exportButton.Enabled, 4);
                Assert.IsFalse(exportButton.Enabled, "Export button should be disabled after Queue Menu -> Remove All");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Esempio n. 21
0
        public async Task HasHardwareLevelingHidesLevelingSettings()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.WaitForFirstDraw();

                // Add printer that has hardware leveling
                testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");

                testRunner.SwitchToPrinterSettings();
                testRunner.ClickByName("Features Tab");
                testRunner.ClickByName("Slice Settings Overflow Menu");
                testRunner.ClickByName("Expand All Menu Item");
                Assert.IsFalse(testRunner.WaitForName("print_leveling_solution Row", .5), "Print leveling should not exist for an Airwolf HD");

                // Add printer that does not have hardware leveling
                testRunner.AddAndSelectPrinter("3D Factory", "MendelMax 1.5");

                testRunner.SwitchToPrinterSettings();
                testRunner.ClickByName("Features Tab");
                testRunner.ClickByName("Slice Settings Overflow Menu");
                testRunner.ClickByName("Expand All Menu Item");
                Assert.IsTrue(testRunner.WaitForName("print_leveling_solution Row"), "Print leveling should exist for a 3D Factory MendelMax");

                return(Task.CompletedTask);
            }, overrideHeight : 800);
        }
Esempio n. 22
0
        public async Task RemoveButtonRemovesSingleItem()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                testRunner.Delay(1);

                int expectedQueueCount = QueueData.Instance.ItemCount - 1;

                // Assert exists
                Assert.IsTrue(testRunner.NameExists("Queue Item 2013-01-25_Mouthpiece_v2"), "Target item should exist before Remove");

                // Remove target item
                testRunner.ClickByName("Queue Remove Button", 2);
                testRunner.Delay(1);

                // Assert removed
                Assert.AreEqual(expectedQueueCount, QueueData.Instance.ItemCount, "After Remove button click, Queue count should be 1 less");
                Assert.IsFalse(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1), "Target item should not exist after Remove");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
Esempio n. 23
0
        public async Task LocalLibraryAddButtonAddZipToLibrary()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.AddAndSelectPrinter();

                // Navigate to Local Library
                testRunner.NavigateToFolder("Local Library Row Item Collection");

                // Make sure that Item does not exist before the test begins
                Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part should not exist at test start");
                Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25 Mouthpiece V2", 1), "Mouthpiece part should not exist at test start");

                // Add Library item
                testRunner.InvokeLibraryAddDialog();
                testRunner.Delay(2);
                testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.zip"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                testRunner.WaitForName("Batman Row Item Collection");

                testRunner.DoubleClickByName("Batman Row Item Collection");

                Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Batman part should exist after adding");
                Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2.stl"), "Mouthpiece part should exist after adding");

                return(Task.CompletedTask);
            });
        }
Esempio n. 24
0
        public async Task RemoveLastItemInListChangesSelection()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                testRunner.Delay(1);

                int expectedQueueCount = QueueData.Instance.ItemCount - 1;

                Assert.AreEqual(QueueData.Instance.SelectedIndex, 0);

                testRunner.ClickByName("Queue Item Calibration - Box", 2);

                Assert.AreEqual(QueueData.Instance.SelectedIndex, 3);

                // Remove target item
                testRunner.ClickByName("Queue Remove Button", 2);
                testRunner.Delay(.5);

                // after remove we select the next up the list
                Assert.AreEqual(QueueData.Instance.SelectedIndex, 0);

                // Assert removed
                Assert.AreEqual(expectedQueueCount, QueueData.Instance.ItemCount, "After Remove button click, Queue count should be 1 less");
                Assert.IsFalse(testRunner.WaitForName("Queue Item MatterControl - Coin", .5), "Target item should not exist after Remove");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
Esempio n. 25
0
        public async Task PrinterRequestsResumeWorkingAsExpected()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should be defined after add");

                    // print a part
                    testRunner.AddItemToBedplate();

                    testRunner.StartPrint(testRunner.FirstPrinter(), pauseAtLayers: "2;6");

                    // turn on line error simulation
                    emulator.SimulateLineErrors = true;

                    // close the pause dialog pop-up (resume)
                    testRunner.WaitForName("Yes Button", 20);                     // the yes button is 'Resume'
                    testRunner.ClickByName("Yes Button");

                    // simulate board reboot
                    emulator.SimulateReboot();

                    // close the pause dialog pop-up (resume)
                    testRunner.Delay(3);
                    testRunner.WaitForName("Yes Button", 20);
                    testRunner.ClickByName("Yes Button");

                    // Wait for done
                    testRunner.WaitForPrintFinished(testRunner.FirstPrinter());
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 90);
        }
Esempio n. 26
0
        public async Task DoneButtonTurnsOffEditMode()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                SystemWindow systemWindow;

                testRunner.CloseSignInAndPrinterSelect();

                SearchRegion searchRegion = testRunner.GetRegionByName("Queue Item 2013-01-25_Mouthpiece_v2", 3);

                // Enter Edit mode and confirm checkboxes exist
                testRunner.ClickByName("Queue Edit Button", 2);
                testRunner.Delay(.3);
                Assert.IsNotNull(
                    testRunner.GetWidgetByName("Queue Item Checkbox", out systemWindow, 3, searchRegion),
                    "While in Edit mode, checkboxes should exist on queue items");

                // Exit Edit mode and confirm checkboxes are missing
                testRunner.ClickByName("Queue Done Button", 1);
                testRunner.Delay(.3);
                Assert.IsNull(
                    testRunner.GetWidgetByName("Queue Item Checkbox", out systemWindow, 1, searchRegion),
                    "After exiting Edit mode, checkboxes should not exist on queue items");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
Esempio n. 27
0
        public async Task PrinterRecoveryTest()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should exist after add");

                    var printer = testRunner.FirstPrinter();
                    printer.Settings.SetValue(SettingsKey.recover_is_enabled, "1");
                    printer.Settings.SetValue(SettingsKey.has_hardware_leveling, "0");

                    Assert.IsTrue(printer.Connection.RecoveryIsEnabled);

                    // print a part
                    testRunner.AddItemToBedplate()
                    .StartPrint(printer, pauseAtLayers: "2;4;6")
                    .ClickResumeButton(printer, true, 1)                             // Resume
                    .ClickResumeButton(printer, false, 3)                            // close the pause dialog pop-up do not resume
                    .ClickByName("Disconnect from printer button")
                    .ClickByName("Connect to printer button")                        // Reconnect
                    .WaitFor(() => printer.Connection.CommunicationState == CommunicationStates.Connected);

                    // Assert that recovery happens
                    Assert.IsTrue(PrintRecovery.RecoveryAvailable(printer), "Recovery should be enabled after Disconnect while printing");

                    // Recover the print
                    testRunner.ClickButton("Yes Button", "Recover Print")
                    .ClickResumeButton(printer, true, 5)                             // The first pause that we get after recovery should be layer 6.
                    .WaitForPrintFinished(printer);
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 180);
        }
Esempio n. 28
0
        public async Task SendMenuClickedWithoutCloudPlugins()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                SystemWindow parentWindow;

                testRunner.CloseSignInAndPrinterSelect();

                Assert.IsTrue(QueueData.Instance.ItemCount > 0, "Queue is not empty at test startup");

                testRunner.ClickByName("More...  Menu", 2);
                testRunner.Delay(.2);

                testRunner.ClickByName("Send Menu Item", 2);
                testRunner.Delay(.2);

                // WaitFor Ok button and ensure parent window has expected title and named button
                testRunner.WaitForName("Ok Button", 2);
                var widget = testRunner.GetWidgetByName("Ok Button", out parentWindow);
                Assert.IsTrue(widget != null &&
                              parentWindow.Title == "MatterControl - Alert", "Send Disabled warning appears when no plugins exists to satisfy behavior");

                testRunner.Delay(.2);

                // Close dialog before exiting
                testRunner.ClickByName("Ok Button");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
        public async Task PauseOnLayerDoesPauseOnPrint()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.WaitForName("Cancel Wizard Button");

                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
                {
                    Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null);

                    testRunner.OpenPrintPopupMenu();
                    testRunner.ClickByName("Layer(s) To Pause Field");
                    testRunner.Type("4;2;a;not;6");

                    testRunner.AddItemToBedplate();

                    // Toggle Sync-to-print
                    testRunner.SwitchToGCodeTab();
                    testRunner.ClickByName("Sync To Print Toggle");

                    testRunner.StartPrint();

                    WaitForLayerAndResume(testRunner, 2);
                    WaitForLayerAndResume(testRunner, 4);
                    WaitForLayerAndResume(testRunner, 6);

                    testRunner.WaitForPrintFinished();
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 120);
        }
Esempio n. 30
0
        public async Task RelativeRetractionExecutesCorrectly()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.WaitForName("Cancel Wizard Button");

                using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator("Other", "Other"))
                {
                    var printer = testRunner.FirstPrinter();

                    var farthestE = 0.0;
                    printer.Connection.LineReceived += (e, line) =>
                    {
                        // make sure the extrusion never goes back very far
                        Assert.Greater(printer.Connection.CurrentExtruderDestination, farthestE - 10);
                        farthestE = Math.Max(farthestE, printer.Connection.CurrentExtruderDestination);
                    };

                    testRunner.AddItemToBedplate()
                    .StartPrint(printer)
                    .WaitFor(() => printer.Connection.Printing, 60)                             // wait for the print to start
                    .WaitFor(() => !printer.Connection.Printing, 60);                           // wait for the print to finish
                }

                return(Task.CompletedTask);
            }, maxTimeToRun : 120);
        }