public void AddToQueueMenuItemAddsSingleFile() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { 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 ExportAsGcode() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true); 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 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 DownloadsAddButtonAddsMultipleFiles() { // 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(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 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 LocalLibraryAddButtonAddSingleItemToLibrary() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { 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.PathToQueueItemsFolder("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 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(8)); }
public void PauseOnLayerDoesPauseOnPrint() { Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(); { MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect); var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner); resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile != null); MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); resultsHarness.AddTestResult(testRunner.ClickByName("General Tab", 1)); resultsHarness.AddTestResult(testRunner.ClickByName("Single Print Tab", 1)); resultsHarness.AddTestResult(testRunner.ClickByName("Layer(s) To Pause:" + " Edit")); testRunner.Type("4;2;a;not;6"); resultsHarness.AddTestResult(testRunner.ClickByName("Layer View Tab")); resultsHarness.AddTestResult(testRunner.ClickByName("Generate Gcode Button", 1)); resultsHarness.AddTestResult(testRunner.ClickByName("Display Checkbox", 10)); resultsHarness.AddTestResult(testRunner.ClickByName("Sync To Print Checkbox", 1)); resultsHarness.AddTestResult(testRunner.ClickByName("Start Print Button", 1)); WaitForLayerAndResume(resultsHarness, testRunner, 2); WaitForLayerAndResume(resultsHarness, testRunner, 4); WaitForLayerAndResume(resultsHarness, testRunner, 6); resultsHarness.AddTestResult(testRunner.WaitForName("Done Button", 30)); resultsHarness.AddTestResult(testRunner.WaitForName("Print Again Button", 1)); try { emualtorProccess.Kill(); } catch {} MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200); Assert.IsTrue(testHarness.AllTestsPassed(19)); }
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 LibraryQueueViewRefreshesOnAddItem() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { testRunner.ClickByName("Library Tab", 5); MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"); 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("Test Part"); resultsHarness.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection")); resultsHarness.AddTestResult(testRunner.ClickByName("Save As Save Button", 1)); // ensure that it is now in the library folder (that the folder updated) resultsHarness.AddTestResult(testRunner.WaitForName("Row Item " + "Test Part", 5), "The part we added should be in the library"); 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 AddSingleItemToQueue() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* * Tests that Queue Add button adds a single part to queue: * 1. The Queue count is increased by 1 * 2. A QueueRowItem is created and added to the queue */ bool queueDataCountEqualsZero = false; bool addedPartIncreasesQueueDataCount = false; int queueCountBeforeAdd = QueueData.Instance.Count; //Make Sure Queue Count = 0 if(queueCountBeforeAdd == 0) { queueDataCountEqualsZero = true; } resultsHarness.AddTestResult(queueDataCountEqualsZero == true, "Queue count is zero before the test starts"); testRunner.Wait(3); //Click Add Button and Add Part To Queue testRunner.ClickByName("Queue Add Button", 2); testRunner.Wait(2); string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.Type(queueItemPath); testRunner.Wait(1); testRunner.Type("{Enter}"); //Make sure single part is added and queue count increases by one bool fennecFoxPartWasAdded = testRunner.WaitForName("Queue Item " + "Fennec_Fox", 2); resultsHarness.AddTestResult(fennecFoxPartWasAdded == true); int queueCountAfterAdd = QueueData.Instance.Count; if (queueCountAfterAdd == queueCountBeforeAdd + 1) { addedPartIncreasesQueueDataCount = true; } resultsHarness.AddTestResult(addedPartIncreasesQueueDataCount == true); 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 QueueAddButtonAddsGcodeFile() { Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* Tests that when the Queue Copy button is clicked: * 1. QueueCount = Zero * 2. Add button can add single .gcode file to the queue * 3. Queue count inceases by one */ int queueCountBeforeTest = QueueData.Instance.Count; bool queueCountEqualsZero = false; if (queueCountBeforeTest == 0) { queueCountEqualsZero = true; } //Make sure queue count equals zero before test begins resultsHarness.AddTestResult(queueCountEqualsZero = true); //Click Add button testRunner.ClickByName("Queue Add Button", 2); testRunner.Wait(1); string pathToType = MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"); testRunner.Type(pathToType); testRunner.Wait(1); testRunner.Type("{Enter}"); int queueCountAfterGcodeIsAdded = QueueData.Instance.Count; bool oneItemAddedToQueue = false; if (queueCountAfterGcodeIsAdded == 1) { oneItemAddedToQueue = true; } resultsHarness.AddTestResult(oneItemAddedToQueue = true); //stl queue item is added to the queue bool firstQueueItemExists = testRunner.WaitForName("Queue Item " + "chichen-itza_pyramid", 1); resultsHarness.AddTestResult(firstQueueItemExists == true); 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 QueueAddButtonAddsZipFile() { Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* Tests that when the Queue Copy button is clicked: * 1. QueueCount = Zero * 2. All files in zip are added to queue */ int queueCountBeforeTest = QueueData.Instance.Count; bool queueCountEqualsZero = false; if (queueCountBeforeTest == 0) { queueCountEqualsZero = true; } //Make sure queue count equals zero before test begins resultsHarness.AddTestResult(queueCountEqualsZero = true); //Click Add button testRunner.ClickByName("Queue Add Button", 2); testRunner.Wait(1); string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip"); testRunner.Type(pathToType); testRunner.Wait(1); testRunner.Type("{Enter}"); int queueCountAfterZipIsAdded = QueueData.Instance.Count; bool twoItemsAddedToQueue = false; if(queueCountAfterZipIsAdded == 2) { twoItemsAddedToQueue = true; } resultsHarness.AddTestResult(twoItemsAddedToQueue = true); //Mouthpiece & Batman part bool firstQueueItemExists = testRunner.WaitForName("Queue Item " + "Batman", 1); resultsHarness.AddTestResult(firstQueueItemExists == true); bool secondQueueItemExists = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2", 1); resultsHarness.AddTestResult(secondQueueItemExists == 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 AddToQueueMenuItemAddsMultipleFiles() { // 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"); string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl"); string textForBothQueueItems = String.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem); int queueBeforeAddCount = QueueData.Instance.Count; testRunner.Type(textForBothQueueItems); testRunner.Wait(2); testRunner.Type("{Enter}"); testRunner.Wait(2); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2)); resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman", 2)); int queueAfterAddCount = QueueData.Instance.Count; resultsHarness.AddTestResult(queueAfterAddCount == queueBeforeAddCount + 2); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(3)); }
public void RenameButtonRenameLocalLibraryItem() { // 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"); //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"); testRunner.ClickByName("Rename From Library Button"); testRunner.Wait(1); 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 LocalLibraryAddButtonAddsMultipleItemsToLibrary() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { //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.PathToQueueItemsFolder("Fennec_Fox.stl"); string secondRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("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 ClickCreatePartSheetButton() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* *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); Assert.IsTrue(testHarness.TestCount == 5); // 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 RemoveButtonClickedRemovesMultipleItems() { // 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); testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl"); testRunner.ClickByName("Library Add Button"); testRunner.Wait(2); testRunner.Type(rowItemPath); testRunner.Type("{Enter}"); string rowItemOne = "Row Item " + "Calibration - Box"; testRunner.ClickByName(rowItemOne); string rowItemTwo = "Row Item " + "Fennec Fox"; testRunner.ClickByName(rowItemTwo); 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); testRunner.ClickByName("Library Remove Item Button"); 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 CreateFolderStarsOutWithTextFiledFocusedAndEditable() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages); // Now do the actions specific to this test. (replace this for new tests) { testRunner.ClickByName("Library Tab"); testRunner.ClickByName("Create Folder 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); CloseMatterControl(testRunner); } }; #if !__ANDROID__ // Set the static data to point to the directory of MatterControl StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData")); #endif bool showWindow; MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 10); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }
public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model) { string manufacturer = make + " Menu Item"; string printer = model + " Menu Item"; string printerProfile = String.Format("{0} {1} Profile", make, model); testRunner.ClickByName("Printers... Menu", 2); testRunner.ClickByName("Add New Printer... Menu Item", 2); testRunner.ClickByName("Connection Wizard Skip Sign In Button", 2); testRunner.ClickByName("Select Make", 2); testRunner.Wait(.2); testRunner.Type(make); testRunner.ClickByName(manufacturer, 2); testRunner.ClickByName("Select Model", 2); testRunner.ClickByName(printer, 2); testRunner.ClickByName("Save & Continue Button", 2); testRunner.Wait(2); testRunner.ClickByName("Cancel Wizard Button", 2); testRunner.Wait(1); }
public void AddMuiltipleItemsToQueue() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* * Tests that Add button can add multiple files to the print queue: * 1. The Queue count is increased by 2 * 2. 2 QueueRowItems are created and added to the queue */ bool queueDataCountEqualsZero = false; bool addedPartIncreasesQueueDataCount = false; int queueCountBeforeAdd = QueueData.Instance.Count; //Make Sure Queue Count = 0 if (queueCountBeforeAdd == 0) { queueDataCountEqualsZero = true; } resultsHarness.AddTestResult(queueDataCountEqualsZero == true, "Queue count is zero before the test starts"); //Click Add Button and Add Part To Queue testRunner.ClickByName("Queue Add Button", 2); string pathToFirstQueueItem = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"); testRunner.Wait(1); string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl"); string textForBothQueueItems = String.Format("\"{0}\" \"{1}\"", pathToFirstQueueItem, pathToSecondQueueItem); testRunner.Type(textForBothQueueItems); testRunner.Wait(2); testRunner.Type("{Enter}"); testRunner.Wait(2); //Confirm that both items were added and that the queue count increases by the appropriate number int queueCountAfterAdd = QueueData.Instance.Count; bool queueCountIncreasedByTwo = false; if (queueCountAfterAdd == 2) { queueCountIncreasedByTwo = true; } resultsHarness.AddTestResult(queueCountIncreasedByTwo == true); bool firstQueueItemWasAdded = testRunner.WaitForName("Queue Item " + "Fennec_Fox", 2); bool secondQueueItemWasAdded = testRunner.WaitForName("Queue Item " + "Batman", 2); resultsHarness.AddTestResult(firstQueueItemWasAdded == true); resultsHarness.AddTestResult(secondQueueItemWasAdded == 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 ExportToZipMenuItemClicked() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* *Tests Export to Zip menu item is clicked the queue is compressed and exported to location on disk *1. Check that there are items in the queue *2. Export Queue and make sure file exists on disk */ bool queueEmpty = true; int queueItemCountBeforeRemoveAllClicked = QueueData.Instance.Count; if (queueItemCountBeforeRemoveAllClicked == 3) { queueEmpty = false; } resultsHarness.AddTestResult(queueEmpty == false); testRunner.ClickByName("Queue... Menu", 2); testRunner.ClickByName(" Export to Zip Menu Item", 2); testRunner.Wait(2); //Type in Absolute Path to Save string exportZipPath = MatterControlUtilities.GetTestItemPath("TestExportZip"); // Ensure file does not exist before save if(File.Exists(exportZipPath)) { File.Delete(exportZipPath); } testRunner.Type(exportZipPath); testRunner.Wait(2); testRunner.Type("{Enter}"); testRunner.Wait(1); string validateExportPath = Path.Combine("..", "..", "..", "TestData", "QueueItems", "TestExportZip.zip"); bool queueWasExportedToZip = File.Exists(validateExportPath); testRunner.Wait(2); resultsHarness.AddTestResult(queueWasExportedToZip == true); //Add the exprted zip file to the Queue and confirm that the Queue Count increases by 3 testRunner.ClickByName("Queue Add Button"); testRunner.Wait(1); testRunner.Type(exportZipPath + ".zip"); testRunner.Wait(1); testRunner.Type("{Enter}"); int queueCountAfterZipIsAdded = QueueData.Instance.Count; bool allItemsInZipWereAddedToTheQueue = false; if(queueCountAfterZipIsAdded == 6) { allItemsInZipWereAddedToTheQueue = true; } resultsHarness.AddTestResult(allItemsInZipWereAddedToTheQueue == true); if (File.Exists(validateExportPath)) { File.Delete(validateExportPath); } MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests }
public void AddToQueueFromLibraryButtonAddsItemsToQueue() { // 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"); //Add an item to the library string libraryItemToAdd = MatterControlUtilities.PathToQueueItemsFolder("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); //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); testRunner.ClickByName("Library Add To Queue Button"); testRunner.Wait(2); //Make sure Queue Count increases by the correct amount int queueCountAfterAdd = QueueData.Instance.Count; bool queueCountIncreasedByTwo = false; if (queueCountAfterAdd == 2) { queueCountIncreasedByTwo = true; } resultsHarness.AddTestResult(queueCountIncreasedByTwo == true); //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); Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests }
public void AddToQueueMenuItemAddsZipFiles() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { testRunner.ClickByName("File Menu"); testRunner.Wait(1); testRunner.ClickByName("Add File To Queue Menu Item"); testRunner.Wait(2); 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 == 2); 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 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 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 RenameButtonRenameLocalLibraryItem() { // 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 rowItemToRename = "Row Item " + "Calibration - Box"; testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); testRunner.ClickByName(rowItemToRename); testRunner.ClickByName("Rename From Library Button"); 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 static void CreateAndRenameLocalLibraryFolder(GuiWidget container, double secondsBetweenClicks = .1) { AutomationRunner testrunner; DrawEventHandler beforeDraw = null; beforeDraw = (sender, e) => { testrunner = new AutomationRunner(); Task.Run(() => { testrunner.ClickByName("Library Tab"); NavigateToFolder(testrunner, "Local Library Row Item Collection"); testrunner.ClickByName("Create Folder From Library Button"); testrunner.Wait(2); testrunner.Type("New Folder"); testrunner.ClickByName("Create Folder Button"); testrunner.ClickByName("Library Edit Button"); testrunner.ClickByName("Row Item New Folder"); testrunner.ClickByName("Rename From Library Button"); testrunner.Wait(2); testrunner.Type("Renamed Folder"); testrunner.ClickByName("Rename Button"); }); container.DrawBefore -= beforeDraw; }; container.DrawBefore += beforeDraw; }
public void RenameDownloadsPrintItem() { 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); testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl")); testRunner.Wait(1); testRunner.Type("{Enter}"); //Rename added item testRunner.ClickByName("Library Edit Button", .5); testRunner.ClickByName("Row Item Batman"); MatterControlUtilities.LibraryRenameSelectedItem(testRunner); testRunner.Wait(.5); 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.DeleteDownloadsSubFolder(); } Assert.IsTrue(testHarness.AllTestsPassed(1)); }