public void RemoveAllMenuItemClickedRemovesAll() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(); MatterControlUtilities.PrepForTestRun(testRunner); resultsHarness.AddTestResult(QueueData.Instance.Count == 4, "Queue has expected 3 items, including default Coin"); // Assert that widgets exists resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman"), "Batman part exists"); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox"), "Fox part exists"); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part exists"); // Act - remove all print queue items testRunner.ClickByName("Queue... Menu", 2); testRunner.ClickByName(" Remove All Menu Item", 2); testRunner.Wait(2); // Assert that object model has been cleared resultsHarness.AddTestResult(QueueData.Instance.Count == 0, "Queue is empty after RemoveAll action"); // Assert that widgets have been removed resultsHarness.AddTestResult(!testRunner.WaitForName("Queue Item Batman"), "Batman part removed"); resultsHarness.AddTestResult(!testRunner.WaitForName("Queue Item Fennec_Fox"), "Fox part removed"); resultsHarness.AddTestResult(!testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part removed"); MatterControlUtilities.CloseMatterControl(testRunner); }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed(8)); }
public void ClickLibraryEditButtonOpensPartPreviewWindow() { // 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); string rowItem = "Row Item " + "Calibration - Box"; testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); testRunner.ClickByName(rowItem); MatterControlUtilities.LibraryEditSelectedItem(testRunner); //Make sure that Export Item Window exists after Export button is clicked bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2); resultsHarness.AddTestResult(exportItemWindowExists == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests }
//Test Works public void ClickCreateButton() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); // Tests that clicking the create button opens create tools plugin window MatterControlUtilities.PrepForTestRun(testRunner); //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(2)); }
public void HasHeatedBedCheckUncheck() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD"); //Navigate to Local Library MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab")); testRunner.Wait(1); resultsHarness.AddTestResult(testRunner.ClickByName("Features Tab")); testRunner.Wait(2); for (int i = 0; i <= 1000; i++) { resultsHarness.AddTestResult(testRunner.ClickByName("Has Heated Bed Checkbox")); testRunner.Wait(.5); } MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(1010)); }
public void DeleteProfileWorksForGuest() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); // assert no profiles resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0); MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD"); // assert one profile resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 1); MatterControlUtilities.DeleteSelectedPrinter(testRunner); // assert no profiles resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900); Assert.IsTrue(testHarness.AllTestsPassed(3)); }
public void ClickOnBuyButton() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); //Make sure image does not exist before we click the buy button testRunner.MatchLimit = 500000; bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png"); resultsHarness.AddTestResult(imageExists == false, "Web page is not open"); //Click Buy button and test that the MatterHackers store web page is open testRunner.ClickByName("Buy Materials Button", 5); bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10); resultsHarness.AddTestResult(imageExists2 == true, "Web page is open"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed(2)); }
//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 void FileMenuAddPrinter() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); testRunner.ClickByName("File Menu"); testRunner.Wait(1); testRunner.ClickByName("Add Printer Menu Item"); testRunner.Wait(1); resultsHarness.AddTestResult(testRunner.WaitForName("Select Make", 3)); testRunner.ClickByName("Cancel Wizard Button"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed(1)); }
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) { MatterControlUtilities.PrepForTestRun(testRunner); 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(2)); }
public void RemoveButtonClickedRemovesSingleItem() { // 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); string rowItem = "Row Item " + "Calibration - Box"; testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); testRunner.ClickByName(rowItem); MatterControlUtilities.LibraryRemoveSelectedItem(testRunner); testRunner.Wait(1); //Make sure that Export Item Window exists after Export button is clicked bool rowItemExists = testRunner.WaitForName(rowItem, 1); resultsHarness.AddTestResult(rowItemExists == false); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(1)); }
public void AddToQueueMenuItemAddsZipFiles() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); testRunner.ClickByName("File Menu"); testRunner.Wait(1); testRunner.ClickByName("Add File To Queue Menu Item"); testRunner.Wait(2); int beforeCount = QueueData.Instance.Count; string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip"); testRunner.Type(pathToType); testRunner.Wait(1); testRunner.Type("{Enter}"); testRunner.Wait(1); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman", 1)); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1)); resultsHarness.AddTestResult(QueueData.Instance.Count == beforeCount + 2); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(3)); }
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)); }
//DOES NOT WORK public void ClickingConfigureNotificationSettingsButtonOpensWindow() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); testRunner.ClickByName("SettingsAndControls", 5); testRunner.ClickByName("Options Tab", 6); bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3); resultsHarness.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist"); testRunner.ClickByName("Configure Notification Settings Button", 6); bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3); resultsHarness.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked"); 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 }
public void ClickingShowTerminalButtonOpensTerminal() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); 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 }
public void AddToQueueMenuItemAddsSingleFile() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); testRunner.ClickByName("File Menu"); testRunner.Wait(1); testRunner.ClickByName("Add File To Queue Menu Item"); testRunner.Wait(2); string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.Type(queueItemPath); testRunner.Wait(1); testRunner.Type("{Enter}"); testRunner.Wait(2); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2)); int queueCount = QueueData.Instance.Count; resultsHarness.AddTestResult(queueCount == 1); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }
public void ClearingCheckBoxClearsUserOverride() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD"); //Navigate to Local Library MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Switch to Printers tab"); resultsHarness.AddTestResult(testRunner.ClickByName("Features Tab", 1), "Switch to Features tab"); CheckAndUncheckSetting(resultsHarness, testRunner, SettingsKey.heat_extruder_before_homing, "Heat Before Homing Checkbox", false); CheckAndUncheckSetting(resultsHarness, testRunner, SettingsKey.has_fan, "Has Fan Checkbox", true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900); Assert.IsTrue(testHarness.AllTestsPassed(20)); }
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)); }
public void SoftwareLevelingRequiredCorrectWorkflow() { Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); // make a jump start printer var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1"); // make sure it is showing the correct button resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden"); resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing"); // do print leveling testRunner.ClickByName("Next Button", .5); testRunner.ClickByName("Next Button", .5); testRunner.ClickByName("Next Button", .5); for (int i = 0; i < 3; i++) { testRunner.ClickByName("Move Z positive", .5); testRunner.ClickByName("Next Button", .5); testRunner.ClickByName("Next Button", .5); testRunner.ClickByName("Next Button", .5); } resultsHarness.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button"); // make sure the button has changed to start print resultsHarness.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing"); resultsHarness.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden"); // reset to defaults and make sure print leveling is cleared MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); resultsHarness.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options"); resultsHarness.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults"); resultsHarness.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert"); testRunner.Wait(1); // make sure it is showing the correct button resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden"); resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing"); MatterControlUtilities.CloseMatterControl(testRunner); try { emualtorProccess.Kill(); } catch { } } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(12)); }
public void AddToQueueFromLibraryButtonAddsItemToQueue() { // 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("Library Edit Button"); testRunner.Wait(1); //Select Library Item string rowItemOne = "Row Item " + "Calibration - Box"; testRunner.ClickByName(rowItemOne); testRunner.Wait(1); //Add Library Item to the Print Queue MatterControlUtilities.LibraryAddSelectionToQueue(testRunner); testRunner.Wait(2); //Make sure that the Queue Count increases by one int queueCountAfterAdd = QueueData.Instance.Count; bool queueCountIncreasedByOne = false; if (queueCountAfterAdd == 1) { queueCountIncreasedByOne = true; } resultsHarness.AddTestResult(queueCountIncreasedByOne == true); //Navigate to Queue testRunner.ClickByName("Queue Tab"); testRunner.Wait(1); //Make sure that the Print Item was added string queueItem = "Queue Item " + "Calibration - Box"; bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2); resultsHarness.AddTestResult(queueItemWasAdded == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }
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); Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests }
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 }
public void RemoveButtonClickedRemovesMultipleItems() { // 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("Library Edit Button"); testRunner.Wait(1); string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.ClickByName("Library Add Button"); testRunner.Wait(2); testRunner.Type(rowItemPath); testRunner.Type("{Enter}"); testRunner.Wait(1); string rowItemOne = "Row Item " + "Calibration - Box"; testRunner.ClickByName(rowItemOne, 1); string rowItemTwo = "Row Item " + "Fennec Fox"; testRunner.ClickByName(rowItemTwo, 1); testRunner.Wait(1); //Make sure row items exist before remove bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2); bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2); resultsHarness.AddTestResult(rowItemOneExistsBeforeRemove == true); resultsHarness.AddTestResult(rowItemTwoExistsBeforeRemove == true); MatterControlUtilities.LibraryRemoveSelectedItem(testRunner); testRunner.Wait(1); //Make sure both selected items are removed bool rowItemOneExists = testRunner.WaitForName(rowItemOne, 2); bool rowItemTwoExists = testRunner.WaitForName(rowItemTwo, 2); resultsHarness.AddTestResult(rowItemOneExists == false); resultsHarness.AddTestResult(rowItemTwoExists == false); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests }
public void ExportAsGcode() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD"); string firstItemName = "Row Item Batman"; //Navigate to Downloads Library Provider testRunner.ClickByName("Queue Tab"); testRunner.ClickByName("Queue Add Button", 2); //Get parts to add string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl"); //Add STL part items to Downloads and then type paths into file dialogue testRunner.Wait(1); testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl")); testRunner.Wait(1); testRunner.Type("{Enter}"); //Get test results resultsHarness.AddTestResult(testRunner.WaitForName(firstItemName, 2) == true); testRunner.ClickByName("Queue Edit Button"); testRunner.ClickByName(firstItemName); testRunner.ClickByName("Queue Export Button"); testRunner.Wait(2); testRunner.WaitForName("Export Item Window", 2); testRunner.ClickByName("Export as GCode Button", 2); testRunner.Wait(2); string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder; testRunner.Type(gcodeExportPath); testRunner.Type("{Enter}"); testRunner.Wait(2); Console.WriteLine(gcodeExportPath); resultsHarness.AddTestResult(File.Exists(gcodeExportPath) == true); Debugger.Break(); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); }
public void ClickCreatePartSheetButton() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); /* * Tests that when the Remove All menu item is clicked * 1. Queue Item count is set to zero * 2. All queue row items that were previously in the queue are removed */ bool queueEmpty = true; int queueItemCount = QueueData.Instance.Count; if (queueItemCount == 3) { queueEmpty = false; } resultsHarness.AddTestResult(queueEmpty == false); testRunner.ClickByName("Queue... Menu", 2); testRunner.ClickByName(" Create Part Sheet Menu Item", 2); testRunner.Wait(2); string pathToSavePartSheet = MatterControlUtilities.GetTestItemPath("CreatePartSheet"); string validatePartSheetPath = Path.Combine("..", "..", "..", "TestData", "QueueItems", "CreatePartSheet.pdf"); testRunner.Type(pathToSavePartSheet); testRunner.Wait(1); testRunner.Type("{Enter}"); testRunner.Wait(1); testRunner.Wait(5); bool partSheetCreated = File.Exists(validatePartSheetPath); testRunner.Wait(2); resultsHarness.AddTestResult(partSheetCreated == true); if (File.Exists(validatePartSheetPath)) { File.Delete(validatePartSheetPath); } MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed(5)); }
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 }
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)); }
public void ClickQueueRoWItemViewAndRemove() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); /* * Tests: * 1. When the remove button on a queue item is clicked the queue tab count decreases by one * 2. When the remove button on a queue item is clicked the item is removed * 3. When the View button on a queue item is clicked the part preview window is opened */ testRunner.Wait(2); int currentQueueItemCount = QueueData.Instance.Count; resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item " + "Batman", 1)); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2", 1)); testRunner.ClickByName("Queue Item " + "Batman", 1); testRunner.ClickByName("Queue Item " + "Batman" + " Remove"); testRunner.Wait(2); int queueItemCountAfterRemove = QueueData.Instance.Count; resultsHarness.AddTestResult(currentQueueItemCount - 1 == queueItemCountAfterRemove); bool batmanQueueItemExists = testRunner.WaitForName("Queue Item " + "Batman", 1); resultsHarness.AddTestResult(batmanQueueItemExists == false); bool partPreviewWindowExists1 = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " Part Preview", 1); resultsHarness.AddTestResult(partPreviewWindowExists1 == false); testRunner.ClickByName("Queue Item " + "2013-01-25_Mouthpiece_v2", 1); testRunner.Wait(2); testRunner.ClickByName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " View", 1); bool partPreviewWindowExists2 = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " Part Preview", 2); resultsHarness.AddTestResult(partPreviewWindowExists2 == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items, overrideWidth: 600); Assert.IsTrue(testHarness.AllTestsPassed(6)); }
public void LocalLibraryAddButtonAddsMultipleItemsToLibrary() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); //Names of Items to be added string firstItemName = "Row Item " + "Fennec Fox"; string secondItemName = "Row Item " + "Batman"; //Navigate to Local Library testRunner.ClickByName("Library Tab"); MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"); //Make sure both Items do not exist before the test begins bool firstItemExists = testRunner.WaitForName(firstItemName, 1); bool secondItemExists = testRunner.WaitForName(secondItemName, 1); resultsHarness.AddTestResult(firstItemExists == false); resultsHarness.AddTestResult(secondItemExists == false); //Click Local Library Add Button testRunner.ClickByName("Library Add Button"); //Get Library Item to Add string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl"); string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath); testRunner.Wait(2); testRunner.Type(textForBothRowItems); testRunner.Wait(1); testRunner.Type("{Enter}"); bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2); bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2); resultsHarness.AddTestResult(firstRowItemWasAdded == true); resultsHarness.AddTestResult(secondRowItemWasAdded == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests }
public void DownloadsAddButtonAddsZipFiles() { Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.CreateDownloadsSubFolder(); // Navigate to Downloads Library Provider testRunner.ClickByName("Library Tab"); MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection"); MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection"); testRunner.ClickByName("Library Add Button"); testRunner.Wait(2); // Add AMF part items to Downloads and then type paths into file dialogs testRunner.Wait(2); testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip")); testRunner.Wait(1); testRunner.Type("{Enter}"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists"); testRunner.Wait(1); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } // Give MatterControl a moment to shutdown Thread.Sleep(2000); try { // Then attempt to clean up MatterControlUtilities.DeleteDownloadsSubFolder(); } catch { } Assert.IsTrue(testHarness.AllTestsPassed(3)); }
public void DownloadsAddButtonAddsMultipleFiles() { Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.CreateDownloadsSubFolder(); //Navigate to Downloads Library Provider testRunner.ClickByName("Library Tab"); MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection"); MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection"); testRunner.ClickByName("Library Add Button"); testRunner.Wait(3); testRunner.Wait(2); // Add both files to the FileOpen dialog testRunner.Type( string.Format( "\"{0}\" \"{1}\"", MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"), MatterControlUtilities.GetTestItemPath("Batman.stl"))); testRunner.Wait(1); testRunner.Type("{Enter}"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists"); testRunner.Wait(1); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.DeleteDownloadsSubFolder(); } Assert.IsTrue(testHarness.AllTestsPassed(2)); }