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)); }
public void ClickLibraryEditButtonOpensPartPreviewWindow() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { //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); testRunner.ClickByName("Library Edit Item Button"); //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 }
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 }
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 }
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 }
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 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 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 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)); }
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 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 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)); }
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 RaftEnabledPassedToSliceEngine() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true); //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); testRunner.ClickByName("Layer View Tab"); testRunner.ClickByName("Bread Crumb Button Home"); testRunner.Wait(1); testRunner.ClickByName("SettingsAndControls"); testRunner.Wait(1); testRunner.ClickByName("User Level Dropdown"); testRunner.Wait(1); testRunner.ClickByName("Advanced Menu Item"); testRunner.Wait(1); testRunner.ClickByName("Skirt and Raft Tab"); testRunner.Wait(1); testRunner.ClickByName("Create Raft Checkbox"); testRunner.Wait(1.5); testRunner.ClickByName("Save Slice Settings Button"); testRunner.ClickByName("Generate Gcode Button"); testRunner.Wait(5); //Call compare slice settings methode here resultsHarness.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "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 }
public void RenameDownloadsPrintItem() { Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { 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); testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl")); testRunner.Wait(1); testRunner.Type("{Enter}"); //Rename added item testRunner.ClickByName("Library Edit Button", 2); testRunner.ClickByName("Row Item Batman"); testRunner.ClickByName("Rename From Library Button", 2); testRunner.Wait(2); testRunner.Type("Batman Renamed"); testRunner.ClickByName("Rename Button"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder); } Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 1); }
public void LocalLibraryAddButtonAddZipToLibrary() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); //Items in Batman.zip string firstItemName = "Row Item " + "Batman"; string secondItemName = "Row Item " + "2013-01-25 Mouthpiece v2"; //Navigate to Local Library testRunner.ClickByName("Library Tab"); MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"); //Make sure that Item does not exist before the test begins bool firstItemInZipExists = testRunner.WaitForName(firstItemName, 1); bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1); resultsHarness.AddTestResult(firstItemInZipExists == false); resultsHarness.AddTestResult(firstItemInZipExists == false); //Click Local Library Add Button testRunner.ClickByName("Library Add Button"); //Get Library Item to Add string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip"); testRunner.Wait(2); testRunner.Type(rowItemPath); testRunner.Wait(1); testRunner.Type("{Enter}"); bool firstItemInZipWasAdded = testRunner.WaitForName(firstItemName, 2); bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2); resultsHarness.AddTestResult(firstItemInZipWasAdded == true); resultsHarness.AddTestResult(secondItemInZipWasAdded == 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 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 }
public void DownloadsAddButtonAddsMultipleFiles() { // Run a copy of MatterControl 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); 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}"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2) == true); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2) == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder); } Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }
public void DownloadsAddButtonAddsZipFiles() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { 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 dialogues testRunner.Wait(2); testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip")); testRunner.Wait(1); testRunner.Type("{Enter}"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2) == true); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2) == true); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2) == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder); } Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 3); }
public void RenameButtonRenameLocalLibraryItem() { // 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"); //Create New Folder testRunner.ClickByName("Create Folder From Library Button"); testRunner.Wait(.5); testRunner.Type("New Folder"); testRunner.Wait(.5); testRunner.ClickByName("Create Folder Button"); //Check for Created Folder string newLibraryFolder = "New Folder Row Item Collection"; bool newFolderWasCreated = testRunner.WaitForName(newLibraryFolder, 1); resultsHarness.AddTestResult(newFolderWasCreated == true); testRunner.ClickByName("Library Edit Button"); testRunner.ClickByName("New Folder Row Item Collection"); MatterControlUtilities.LibraryRenameSelectedItem(testRunner); testRunner.Wait(.5); testRunner.Type("Renamed Library Folder"); testRunner.ClickByName("Rename Button"); //Make sure that renamed Library Folder Exists bool renamedLibraryFolderExists = testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2); resultsHarness.AddTestResult(renamedLibraryFolderExists == 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 DownloadsAddButtonAddsAMFFiles() { 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 dialogues testRunner.Wait(2); testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf")); testRunner.Wait(1); testRunner.Type("{Enter}"); resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists"); testRunner.Wait(1); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.DeleteDownloadsSubFolder(); } Assert.IsTrue(testHarness.AllTestsPassed(1)); }
public void RaftEnabledPassedToSliceEngine() { // 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 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); testRunner.ClickByName("Layer View Tab"); testRunner.ClickByName("Bread Crumb Button Home", 1); MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); testRunner.ClickByName("Raft / Priming Tab", 1); testRunner.ClickByName("Create Raft Checkbox", 1); testRunner.Wait(1.5); testRunner.ClickByName("Generate Gcode Button", 1); testRunner.Wait(5); //Call compare slice settings methode here resultsHarness.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True")); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 800); Assert.IsTrue(testHarness.AllTestsPassed(3)); }
public void RenameButtonRenameLocalLibraryItem() { // 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 rowItemToRename = "Row Item " + "Calibration - Box"; testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); testRunner.ClickByName(rowItemToRename); MatterControlUtilities.LibraryRenameSelectedItem(testRunner); testRunner.Wait(2); testRunner.Type("Library Item Renamed"); testRunner.ClickByName("Rename Button"); string renamedRowItem = "Row Item " + "Library Item Renamed"; bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2); bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2); resultsHarness.AddTestResult(libraryItemWasRenamed == true); resultsHarness.AddTestResult(libraryItemBeforeRenameExists == false); 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 CreateFolder() { 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"); string newFolderName = "New Folder"; testRunner.ClickByName("Create Folder From Library Button"); testRunner.Wait(2); testRunner.Type(newFolderName); testRunner.ClickByName("Create Folder Button"); testRunner.Wait(2); resultsHarness.AddTestResult(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.DeleteDownloadsSubFolder(); } Assert.IsTrue(testHarness.AllTestsPassed(1)); }
public void LocalLibraryAddButtonAddSingleItemToLibrary() { // Run a copy of MatterControl Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); string itemName = "Row Item " + "Fennec Fox"; //Navigate to Local Library testRunner.ClickByName("Library Tab"); MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"); //Make sure that Item does not exist before the test begins bool rowItemExists = testRunner.WaitForName(itemName, 1); resultsHarness.AddTestResult(rowItemExists == false); //Click Local Library Add Button testRunner.ClickByName("Library Add Button"); //Get Library Item to Add string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.Wait(2); testRunner.Type(rowItemPath); testRunner.Wait(1); testRunner.Type("{Enter}"); bool rowItemWasAdded = testRunner.WaitForName(itemName, 2); resultsHarness.AddTestResult(rowItemWasAdded == 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 LibraryItemThumbnailClickedOpensPartPreview() { // 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"); //Make sure Part Preview Window does not exists before we click the view button bool partPreviewExistsOne = testRunner.WaitForName("Part Preview Window", 1); resultsHarness.AddTestResult(partPreviewExistsOne == false); string libraryRowItemName = "Row Item " + "Calibration - Box"; testRunner.ClickByName(libraryRowItemName); testRunner.Wait(1); //Click Library Item View Button string libraryItemViewButton = "Row Item " + "Calibration - Box" + " View Button"; testRunner.ClickByName(libraryItemViewButton); //Make sure that Part Preview Window opens after View button is clicked bool partPreviewWindowExists = testRunner.WaitForName("Part Preview Window", 1.5); resultsHarness.AddTestResult(partPreviewWindowExists == 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 CreateFolder() { 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("Create Folder From Library Button"); testRunner.Wait(2); testRunner.Type("New Folder"); testRunner.ClickByName("Create Folder Button"); testRunner.Wait(2); resultsHarness.AddTestResult(testRunner.WaitForName("New Folder Row Item Collection", 2) == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = null; try { testHarness = MatterControlUtilities.RunTest(testToRun); } catch { } finally { MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder); } Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 1); }
public void AddToQueueFromLibraryButtonAddsItemsToQueue() { // 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"); //Add an item to the library string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.ClickByName("Library Add Button"); testRunner.Wait(2); testRunner.Type(libraryItemToAdd); testRunner.Wait(2); testRunner.Type("{Enter}"); testRunner.Wait(1); testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); int queueCountBeforeAdd = QueueData.Instance.Count; //Select both Library Items string rowItemOne = "Row Item " + "Calibration - Box"; testRunner.ClickByName(rowItemOne); string rowItemTwo = "Row Item " + "Fennec Fox"; testRunner.ClickByName(rowItemTwo); //Click the Add To Queue button testRunner.Wait(1); MatterControlUtilities.LibraryAddSelectionToQueue(testRunner); testRunner.Wait(2); //Make sure Queue Count increases by the correct amount int queueCountAfterAdd = QueueData.Instance.Count; resultsHarness.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 2); //Navigate to the Print Queue testRunner.ClickByName("Queue Tab"); testRunner.Wait(1); //Test that both added print items exist string queueItemOne = "Queue Item " + "Calibration - Box"; string queueItemTwo = "Queue Item " + "Fennec_Fox"; bool queueItemOneWasAdded = testRunner.WaitForName(queueItemOne, 2); bool queueItemTwoWasAdded = testRunner.WaitForName(queueItemTwo, 2); resultsHarness.AddTestResult(queueItemOneWasAdded == true); resultsHarness.AddTestResult(queueItemTwoWasAdded == true); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(3)); }
public void UndoRedoCopy() { // 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); } testRunner.Wait(1); for (int x = 0; x <= 4; x++) { int meshCountBeforeUndo = view3D.MeshGroups.Count(); testRunner.ClickByName("3D View Undo"); System.Threading.Thread.Sleep(2000); int meshCountAfterUndo = view3D.MeshGroups.Count(); resultsHarness.AddTestResult(meshCountAfterUndo == meshCountBeforeUndo - 1); } testRunner.Wait(1); for (int z = 0; z <= 4; z++) { int meshCountBeforeRedo = view3D.MeshGroups.Count(); testRunner.ClickByName("3D View Redo"); System.Threading.Thread.Sleep(2000); int meshCountAfterRedo = view3D.MeshGroups.Count(); resultsHarness.AddTestResult(meshCountAfterRedo == meshCountBeforeRedo + 1); } MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 11); // make sure we ran all our tests }