Remove excess blocks

This commit is contained in:
John Lewin 2016-10-19 11:10:30 -07:00
parent 5005e91f3b
commit e216457ef5
16 changed files with 1406 additions and 1669 deletions

View file

@ -42,41 +42,37 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void ClickOnLibraryCheckBoxes()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab", 3);
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Library Tab", 3);
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
SystemWindow systemWindow;
string itemName = "Row Item " + "Calibration - Box";
SystemWindow systemWindow;
string itemName = "Row Item " + "Calibration - Box";
GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);
GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);
SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);
SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);
testRunner.ClickByName("Library Edit Button", 3);
testRunner.Wait(.5);
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;
testRunner.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
testRunner.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out systemWindow, 3, searchRegion: rowItemRegion);
CheckBox checkBoxWidget = foundWidget as CheckBox;
testRunner.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
testRunner.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
testRunner.ClickByName("Library Tab");
testRunner.AddTestResult(checkBoxWidget.Checked == true, "currently checked");
testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
testRunner.ClickByName("Library Tab");
testRunner.AddTestResult(checkBoxWidget.Checked == true, "currently checked");
testRunner.ClickByName(itemName, 3);
testRunner.ClickByName("Library Tab");
testRunner.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
testRunner.ClickByName(itemName, 3);
testRunner.ClickByName("Library Tab");
testRunner.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);

View file

@ -42,35 +42,30 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Create Folder From Library Button");
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);
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;
testRunner.AddTestResult(textWidgetMH != null, "Found Text Widget");
testRunner.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
SystemWindow containingWindow;
GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
testRunner.AddTestResult(textWidgetMH != null, "Found Text Widget");
testRunner.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}

View file

@ -14,56 +14,51 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void ExportAsGcode()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
string firstItemName = "Row Item Batman";
//Navigate to Downloads Library Provider
testRunner.ClickByName("Queue Tab");
testRunner.ClickByName("Queue Add Button", 2);
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");
//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}");
//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
testRunner.AddTestResult(testRunner.WaitForName(firstItemName, 2) == true);
//Get test results
testRunner.AddTestResult(testRunner.WaitForName(firstItemName, 2) == true);
testRunner.ClickByName("Queue Edit Button");
testRunner.ClickByName(firstItemName);
testRunner.ClickByName("Queue Export Button");
testRunner.Wait(2);
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);
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);
string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
testRunner.Type(gcodeExportPath);
testRunner.Type("{Enter}");
testRunner.Wait(2);
Console.WriteLine(gcodeExportPath);
Console.WriteLine(gcodeExportPath);
testRunner.AddTestResult(File.Exists(gcodeExportPath) == true);
Debugger.Break();
testRunner.AddTestResult(File.Exists(gcodeExportPath) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}

View file

@ -13,139 +13,123 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void FileMenuAddPrinter()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add Printer Menu Item");
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.WaitForName("Select Make", 3));
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add Printer Menu Item");
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.WaitForName("Select Make", 3));
testRunner.ClickByName("Cancel Wizard Button");
testRunner.ClickByName("Cancel Wizard Button");
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void AddToQueueMenuItemAddsSingleFile()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add File To Queue Menu Item");
testRunner.Wait(2);
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 queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
int queueBeforeCount = QueueData.Instance.Count;
int queueBeforeCount = QueueData.Instance.Count;
testRunner.Type(queueItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
testRunner.Type(queueItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
int queueAfterCount = QueueData.Instance.Count;
int queueAfterCount = QueueData.Instance.Count;
testRunner.AddTestResult(queueAfterCount == queueBeforeCount + 1);
testRunner.AddTestResult(queueAfterCount == queueBeforeCount + 1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void AddToQueueMenuItemAddsMultipleFiles()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add File To Queue Menu Item");
testRunner.Wait(2);
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 queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
string textForBothQueueItems = string.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem);
string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
string textForBothQueueItems = string.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem);
int queueBeforeAddCount = QueueData.Instance.Count;
int queueBeforeAddCount = QueueData.Instance.Count;
testRunner.Type(textForBothQueueItems);
testRunner.Wait(2);
testRunner.Type("{Enter}");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Batman", 2));
int queueAfterAddCount = QueueData.Instance.Count;
testRunner.Type(textForBothQueueItems);
testRunner.Wait(2);
testRunner.Type("{Enter}");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Batman", 2));
testRunner.AddTestResult(queueAfterAddCount == queueBeforeAddCount + 2);
int queueAfterAddCount = QueueData.Instance.Count;
MatterControlUtilities.CloseMatterControl(testRunner);
}
testRunner.AddTestResult(queueAfterAddCount == queueBeforeAddCount + 2);
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void AddToQueueMenuItemAddsZipFiles()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add File To Queue Menu Item");
testRunner.Wait(2);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add File To Queue Menu Item");
testRunner.Wait(2);
int beforeCount = QueueData.Instance.Count;
int beforeCount = QueueData.Instance.Count;
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
testRunner.Type(pathToType);
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.Wait(1);
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
testRunner.Type(pathToType);
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Batman", 1));
testRunner.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
testRunner.AddTestResult(QueueData.Instance.Count == beforeCount + 2);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Batman", 1));
testRunner.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
testRunner.AddTestResult(QueueData.Instance.Count == beforeCount + 2);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
}

View file

@ -15,38 +15,35 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Add printer that has hardware leveling
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.PrepForTestRun(testRunner);
//Add printer that has hardware leveling
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.ClickByName("Printer Tab", 1);
testRunner.Wait(1);
testRunner.ClickByName("Printer Tab", 1);
testRunner.Wait(1);
//Make sure Print Leveling tab is not visible
bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
testRunner.AddTestResult(testPrintLeveling == false);
//Make sure Print Leveling tab is not visible
bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
testRunner.AddTestResult(testPrintLeveling == false);
//Add printer that does not have hardware leveling
MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");
//Add printer that does not have hardware leveling
MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");
testRunner.ClickByName("Slice Settings Tab",1);
testRunner.ClickByName("Slice Settings Tab", 1);
testRunner.ClickByName("Printer Tab",1);
testRunner.ClickByName("Printer Tab", 1);
//Make sure Print Leveling tab is visible
bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
testRunner.AddTestResult(printLevelingVisible == true);
//Make sure Print Leveling tab is visible
bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
testRunner.AddTestResult(printLevelingVisible == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideHeight: 800, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(4));
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
@ -56,60 +53,57 @@ namespace MatterHackers.MatterControl.Tests.Automation
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
MatterControlUtilities.PrepForTestRun(testRunner);
// make a jump start printer
emulatorProcess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1");
// make sure it is showing the correct button
testRunner.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
testRunner.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
// do print leveling
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
for (int i = 0; i < 3; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
// make a jump start printer
emulatorProcess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1");
// make sure it is showing the correct button
testRunner.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
testRunner.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
// do print leveling
testRunner.ClickByName("Move Z positive", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
for (int i = 0; i < 3; i++)
{
testRunner.ClickByName("Move Z positive", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
}
testRunner.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button");
// make sure the button has changed to start print
testRunner.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing");
testRunner.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden");
// reset to defaults and make sure print leveling is cleared
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options" );
testRunner.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
testRunner.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
testRunner.Wait(1);
// make sure it is showing the correct button
testRunner.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
testRunner.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
MatterControlUtilities.CloseMatterControl(testRunner);
}
testRunner.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button");
// make sure the button has changed to start print
testRunner.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing");
testRunner.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden");
// reset to defaults and make sure print leveling is cleared
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options");
testRunner.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
testRunner.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
testRunner.Wait(1);
// make sure it is showing the correct button
testRunner.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
testRunner.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(12));
Assert.IsTrue(testHarness.AllTestsPassed(1));
try
{
emulatorProcess?.Kill();
}
catch { }
}
}
}

View file

@ -14,37 +14,36 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
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);
//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);
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")));
// 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}");
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
testRunner.Wait(1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
// TODO: The standard assignment without a try/catch should be used and DeleteDownloadsSubFolder should be called from a TearDown method
AutomationRunner testHarness = null;
try
@ -66,29 +65,26 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
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);
//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}");
//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}");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
testRunner.Wait(1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = null;
@ -112,32 +108,31 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
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);
// 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}");
// 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}");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");
testRunner.Wait(1);
testRunner.Wait(1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = null;
try
@ -163,33 +158,32 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
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);
//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}");
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");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true);
//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");
testRunner.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = null;
try
@ -211,28 +205,25 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
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");
//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";
string newFolderName = "New Folder";
testRunner.ClickByName("Create Folder From Library Button");
testRunner.Wait(2);
testRunner.Type(newFolderName);
testRunner.ClickByName("Create Folder Button");
testRunner.ClickByName("Create Folder From Library Button");
testRunner.Wait(2);
testRunner.Type(newFolderName);
testRunner.ClickByName("Create Folder Button");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists");
testRunner.Wait(2);
testRunner.AddTestResult(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists");
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = null;

View file

@ -1,6 +1,5 @@
using System;
using System.Threading;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.GuiAutomation;
using MatterHackers.MatterControl.PrintQueue;
using NUnit.Framework;
@ -13,42 +12,37 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LocalLibraryAddButtonAddSingleItemToLibrary()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
string itemName = "Row Item " + "Fennec Fox";
string itemName = "Row Item " + "Fennec Fox";
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//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);
testRunner.AddTestResult(rowItemExists == false);
//Make sure that Item does not exist before the test begins
bool rowItemExists = testRunner.WaitForName(itemName, 1);
testRunner.AddTestResult(rowItemExists == false);
//Click Local Library Add Button
testRunner.ClickByName("Library Add Button");
//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}");
//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);
testRunner.AddTestResult(rowItemWasAdded == true);
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
testRunner.AddTestResult(rowItemWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
@ -59,51 +53,45 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Names of Items to be added
string firstItemName = "Row Item " + "Fennec Fox";
string secondItemName = "Row Item " + "Batman";
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");
//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);
testRunner.AddTestResult(firstItemExists == false);
testRunner.AddTestResult(secondItemExists == false);
//Make sure both Items do not exist before the test begins
bool firstItemExists = testRunner.WaitForName(firstItemName, 1);
bool secondItemExists = testRunner.WaitForName(secondItemName, 1);
testRunner.AddTestResult(firstItemExists == false);
testRunner.AddTestResult(secondItemExists == false);
//Click Local Library Add Button
testRunner.ClickByName("Library Add Button");
//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");
//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}");
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);
testRunner.AddTestResult(firstRowItemWasAdded == true);
testRunner.AddTestResult(secondRowItemWasAdded == true);
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
testRunner.AddTestResult(firstRowItemWasAdded == true);
testRunner.AddTestResult(secondRowItemWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(4));
}
}
@ -114,42 +102,37 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LocalLibraryAddButtonAddAMFToLibrary()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
string itemName = "Row Item " + "Rook";
string itemName = "Row Item " + "Rook";
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//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);
testRunner.AddTestResult(rowItemExists == false);
//Make sure that Item does not exist before the test begins
bool rowItemExists = testRunner.WaitForName(itemName, 1);
testRunner.AddTestResult(rowItemExists == false);
//Click Local Library Add Button
testRunner.ClickByName("Library Add Button");
//Click Local Library Add Button
testRunner.ClickByName("Library Add Button");
//Get Library Item to Add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get Library Item to Add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
testRunner.AddTestResult(rowItemWasAdded == true);
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
testRunner.AddTestResult(rowItemWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1024, overrideHeight: 800, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
@ -160,48 +143,43 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LocalLibraryAddButtonAddZipToLibrary()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
//Items in Batman.zip
string firstItemName = "Row Item " + "Batman";
string secondItemName = "Row Item " + "2013-01-25 Mouthpiece v2";
//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");
//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);
testRunner.AddTestResult(firstItemInZipExists == false);
testRunner.AddTestResult(firstItemInZipExists == false);
//Make sure that Item does not exist before the test begins
bool firstItemInZipExists = testRunner.WaitForName(firstItemName, 1);
bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1);
testRunner.AddTestResult(firstItemInZipExists == false);
testRunner.AddTestResult(firstItemInZipExists == false);
//Click Local Library Add Button
testRunner.ClickByName("Library Add Button");
//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}");
//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);
testRunner.AddTestResult(firstItemInZipWasAdded == true);
testRunner.AddTestResult(secondItemInZipWasAdded == true);
bool firstItemInZipWasAdded = testRunner.WaitForName(firstItemName, 2);
bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2);
testRunner.AddTestResult(firstItemInZipWasAdded == true);
testRunner.AddTestResult(secondItemInZipWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(4));
}
}
@ -212,93 +190,83 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RenameButtonRenameLocalLibraryItem()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate To Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//Navigate To Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.Wait(1);
string rowItemToRename = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItemToRename);
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
string rowItemToRename = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItemToRename);
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
testRunner.Wait(2);
testRunner.Wait(2);
testRunner.Type("Library Item Renamed");
testRunner.Type("Library Item Renamed");
testRunner.ClickByName("Rename Button");
testRunner.ClickByName("Rename Button");
string renamedRowItem = "Row Item " + "Library Item Renamed";
bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2);
bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2);
string renamedRowItem = "Row Item " + "Library Item Renamed";
bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2);
bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2);
testRunner.AddTestResult(libraryItemWasRenamed == true);
testRunner.AddTestResult(libraryItemBeforeRenameExists == false);
testRunner.AddTestResult(libraryItemWasRenamed == true);
testRunner.AddTestResult(libraryItemBeforeRenameExists == false);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 600, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class UserCanSuccessfullyCreateAndRenameLibraryFolder
{
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RenameButtonRenameLocalLibraryFolder()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
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");
//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);
testRunner.AddTestResult(newFolderWasCreated == true);
//Check for Created Folder
string newLibraryFolder = "New Folder Row Item Collection";
bool newFolderWasCreated = testRunner.WaitForName(newLibraryFolder, 1);
testRunner.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");
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);
testRunner.AddTestResult(renamedLibraryFolderExists == true);
//Make sure that renamed Library Folder Exists
bool renamedLibraryFolderExists = testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2);
testRunner.AddTestResult(renamedLibraryFolderExists == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
@ -309,34 +277,30 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void ClickLibraryEditButtonOpensPartPreviewWindow()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.Wait(1);
string rowItem = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItem);
string rowItem = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItem);
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
//Make sure that Export Item Window exists after Export button is clicked
bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2);
testRunner.AddTestResult(exportItemWindowExists == true);
//Make sure that Export Item Window exists after Export button is clicked
bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2);
testRunner.AddTestResult(exportItemWindowExists == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
}
@ -347,98 +311,88 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RemoveButtonClickedRemovesSingleItem()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.Wait(1);
string rowItem = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItem);
string rowItem = "Row Item " + "Calibration - Box";
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.ClickByName(rowItem);
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
testRunner.Wait(1);
testRunner.Wait(1);
//Make sure that Export Item Window exists after Export button is clicked
bool rowItemExists = testRunner.WaitForName(rowItem, 1);
testRunner.AddTestResult(rowItemExists == false);
//Make sure that Export Item Window exists after Export button is clicked
bool rowItemExists = testRunner.WaitForName(rowItem, 1);
testRunner.AddTestResult(rowItemExists == false);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
}
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class MultipleLibraryItemsSelectedRemoveButtonRemovesItem
{
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RemoveButtonClickedRemovesMultipleItems()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
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);
testRunner.Wait(1);
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.ClickByName("Library Add Button");
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Type("{Enter}");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Type("{Enter}");
testRunner.Wait(1);
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne, 1);
testRunner.Wait(1);
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne, 1);
string rowItemTwo = "Row Item " + "Fennec Fox";
testRunner.ClickByName(rowItemTwo, 1);
string rowItemTwo = "Row Item " + "Fennec Fox";
testRunner.ClickByName(rowItemTwo, 1);
testRunner.Wait(1);
testRunner.Wait(1);
//Make sure row items exist before remove
bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2);
bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2);
testRunner.AddTestResult(rowItemOneExistsBeforeRemove == true);
testRunner.AddTestResult(rowItemTwoExistsBeforeRemove == true);
//Make sure row items exist before remove
bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2);
bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2);
testRunner.AddTestResult(rowItemOneExistsBeforeRemove == true);
testRunner.AddTestResult(rowItemTwoExistsBeforeRemove == true);
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
testRunner.Wait(1);
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);
testRunner.AddTestResult(rowItemOneExists == false);
testRunner.AddTestResult(rowItemTwoExists == false);
//Make sure both selected items are removed
bool rowItemOneExists = testRunner.WaitForName(rowItemOne, 2);
bool rowItemTwoExists = testRunner.WaitForName(rowItemTwo, 2);
testRunner.AddTestResult(rowItemOneExists == false);
testRunner.AddTestResult(rowItemTwoExists == false);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(4));
}
}
@ -449,55 +403,50 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void AddToQueueFromLibraryButtonAddsItemToQueue()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//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);
testRunner.Wait(1);
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
//Select Library Item
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne);
//Select Library Item
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne);
testRunner.Wait(1);
testRunner.Wait(1);
int queueCountBeforeAdd = QueueData.Instance.Count;
int queueCountBeforeAdd = QueueData.Instance.Count;
//Add Library Item to the Print Queue
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
//Add Library Item to the Print Queue
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
testRunner.Wait(2);
testRunner.Wait(2);
//Make sure that the Queue Count increases by one
int queueCountAfterAdd = QueueData.Instance.Count;
//Make sure that the Queue Count increases by one
int queueCountAfterAdd = QueueData.Instance.Count;
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 1);
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 1);
//Navigate to Queue
testRunner.ClickByName("Queue Tab");
//Navigate to Queue
testRunner.ClickByName("Queue Tab");
testRunner.Wait(1);
testRunner.Wait(1);
//Make sure that the Print Item was added
string queueItem = "Queue Item " + "Calibration - Box";
bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2);
testRunner.AddTestResult(queueItemWasAdded == true);
//Make sure that the Print Item was added
string queueItem = "Queue Item " + "Calibration - Box";
bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2);
testRunner.AddTestResult(queueItemWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
@ -508,69 +457,63 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void AddToQueueFromLibraryButtonAddsItemsToQueue()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//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");
//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(2);
testRunner.Type(libraryItemToAdd);
testRunner.Wait(2);
testRunner.Type("{Enter}");
testRunner.Wait(1);
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
testRunner.Wait(1);
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
int queueCountBeforeAdd = QueueData.Instance.Count;
int queueCountBeforeAdd = QueueData.Instance.Count;
//Select both Library Items
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne);
//Select both Library Items
string rowItemOne = "Row Item " + "Calibration - Box";
testRunner.ClickByName(rowItemOne);
string rowItemTwo = "Row Item " + "Fennec Fox";
testRunner.ClickByName(rowItemTwo);
string rowItemTwo = "Row Item " + "Fennec Fox";
testRunner.ClickByName(rowItemTwo);
//Click the Add To Queue button
testRunner.Wait(1);
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
testRunner.Wait(2);
//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;
//Make sure Queue Count increases by the correct amount
int queueCountAfterAdd = QueueData.Instance.Count;
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 2);
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 2);
//Navigate to the Print Queue
testRunner.ClickByName("Queue Tab");
testRunner.Wait(1);
//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);
testRunner.AddTestResult(queueItemOneWasAdded == true);
testRunner.AddTestResult(queueItemTwoWasAdded == true);
//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);
testRunner.AddTestResult(queueItemOneWasAdded == true);
testRunner.AddTestResult(queueItemTwoWasAdded == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
}
@ -581,40 +524,35 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LibraryItemThumbnailClickedOpensPartPreview()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//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);
testRunner.AddTestResult(partPreviewExistsOne == false);
//Make sure Part Preview Window does not exists before we click the view button
bool partPreviewExistsOne = testRunner.WaitForName("Part Preview Window", 1);
testRunner.AddTestResult(partPreviewExistsOne == false);
string libraryRowItemName = "Row Item " + "Calibration - Box";
testRunner.ClickByName(libraryRowItemName);
string libraryRowItemName = "Row Item " + "Calibration - Box";
testRunner.ClickByName(libraryRowItemName);
testRunner.Wait(1);
testRunner.Wait(1);
//Click Library Item View Button
string libraryItemViewButton = "Row Item " + "Calibration - Box" + " View Button";
testRunner.ClickByName(libraryItemViewButton);
//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);
testRunner.AddTestResult(partPreviewWindowExists == true);
//Make sure that Part Preview Window opens after View button is clicked
bool partPreviewWindowExists = testRunner.WaitForName("Part Preview Window", 1.5);
testRunner.AddTestResult(partPreviewWindowExists == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}

View file

@ -13,33 +13,29 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void ClickingShowTerminalButtonOpensTerminal()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.Wait(2);
testRunner.ClickByName("Options Tab", 6);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.Wait(2);
testRunner.ClickByName("Options Tab", 6);
bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
testRunner.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");
bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
testRunner.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");
testRunner.ClickByName("Show Terminal Button", 6);
testRunner.Wait(1);
testRunner.ClickByName("Show Terminal Button", 6);
testRunner.Wait(1);
SystemWindow containingWindow;
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
testRunner.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
SystemWindow containingWindow;
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
testRunner.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}
@ -51,28 +47,24 @@ namespace MatterHackers.MatterControl.Tests.Automation
//DOES NOT WORK
public void ClickingConfigureNotificationSettingsButtonOpensWindow()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.ClickByName("Options Tab", 6);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.ClickByName("Options Tab", 6);
bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
testRunner.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
testRunner.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
testRunner.ClickByName("Configure Notification Settings Button", 6);
bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
testRunner.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
testRunner.ClickByName("Configure Notification Settings Button", 6);
bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
testRunner.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items", defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
}

View file

@ -15,374 +15,348 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void CopyButtonClickedMakesCopyOfPartOnBed()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
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);
//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;
//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();
testRunner.AddTestResult(partCountBeforeCopy == 1);
//Click Copy button and count MeshGroups
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountAfterCopy == 2);
testRunner.Wait(1);
string copyButtonName = "3D View Copy";
//Click Copy button a second time and count MeshGroups again
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountAfterSecondCopy == 3);
view3D.CloseOnIdle();
testRunner.Wait(.5);
//Click Edit button to make edit controls visible
testRunner.ClickByName("3D View Edit");
testRunner.Wait(1);
int partCountBeforeCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountBeforeCopy == 1);
//Click Copy button and count MeshGroups
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountAfterCopy == 2);
testRunner.Wait(1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
//Click Copy button a second time and count MeshGroups again
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountAfterSecondCopy == 3);
view3D.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void GroupAndUngroup()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
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();
testRunner.AddTestResult(partCountBeforeCopy == 1);
for (int i = 0; i <= 4; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName(copyButtonName);
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();
testRunner.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();
testRunner.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();
testRunner.AddTestResult(partsOnBedAfterGroup == 1);
testRunner.ClickByName("3D View Ungroup");
System.Threading.Thread.Sleep(2000);
int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
testRunner.AddTestResult(partsOnBedAfterUngroup == 6);
MatterControlUtilities.CloseMatterControl(testRunner);
}
//Get MeshGroupCount before Group is clicked
System.Threading.Thread.Sleep(2000);
int partsOnBedBeforeGroup = view3D.MeshGroups.Count();
testRunner.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();
testRunner.AddTestResult(partsOnBedAfterGroup == 1);
testRunner.ClickByName("3D View Ungroup");
System.Threading.Thread.Sleep(2000);
int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
testRunner.AddTestResult(partsOnBedAfterUngroup == 6);
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(4));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RemoveButtonRemovesParts()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
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();
testRunner.AddTestResult(partCountBeforeCopy == 1);
for (int i = 0; i <= 4; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName(copyButtonName);
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();
testRunner.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();
testRunner.AddTestResult(partsOnBedBeforeRemove == 6);
//Check that MeshCount decreases by 1
testRunner.ClickByName("3D View Remove");
System.Threading.Thread.Sleep(2000);
int meshCountAfterRemove = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRemove == 5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
//Get MeshGroupCount before Group is clicked
System.Threading.Thread.Sleep(2000);
int partsOnBedBeforeRemove = view3D.MeshGroups.Count();
testRunner.AddTestResult(partsOnBedBeforeRemove == 6);
//Check that MeshCount decreases by 1
testRunner.ClickByName("3D View Remove");
System.Threading.Thread.Sleep(2000);
int meshCountAfterRemove = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRemove == 5);
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
public void UndoRedoCopy()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
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();
testRunner.AddTestResult(partCountBeforeCopy == 1);
for (int i = 0; i <= 4; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName(copyButtonName);
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();
testRunner.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();
testRunner.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();
testRunner.AddTestResult(meshCountAfterRedo == meshCountBeforeRedo + 1);
}
MatterControlUtilities.CloseMatterControl(testRunner);
}
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();
testRunner.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();
testRunner.AddTestResult(meshCountAfterRedo == meshCountBeforeRedo + 1);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(11));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void UndoRedoDelete()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Row Item Calibration - Box", 1);
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
//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", 1);
int partCountBeforeCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountBeforeCopy == 1);
testRunner.Wait(.5);
for (int i = 0; i <= 4; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Row Item Calibration - Box", 1);
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
//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", 1);
int partCountBeforeCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(partCountBeforeCopy == 1);
testRunner.Wait(.5);
for (int i = 0; i <= 4; i++)
{
testRunner.ClickByName(copyButtonName, 1);
testRunner.Wait(.2);
int meshCount = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCount == partCountBeforeCopy + i + 1);
}
int meshCountAfterCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterCopy == 6);
testRunner.ClickByName("3D View Remove", 1);
testRunner.Wait(.1);
int meshCountAfterRemove = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRemove == 5);
testRunner.ClickByName("3D View Undo");
System.Threading.Thread.Sleep(2000);
int meshCountAfterUndo = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterUndo == 6);
testRunner.ClickByName("3D View Redo");
System.Threading.Thread.Sleep(2000);
int meshCountAfterRedo = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRedo == 5);
partPreview.CloseOnIdle();
testRunner.Wait(.1);
MatterControlUtilities.CloseMatterControl(testRunner);
testRunner.ClickByName(copyButtonName, 1);
testRunner.Wait(.2);
int meshCount = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCount == partCountBeforeCopy + i + 1);
}
int meshCountAfterCopy = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterCopy == 6);
testRunner.ClickByName("3D View Remove", 1);
testRunner.Wait(.1);
int meshCountAfterRemove = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRemove == 5);
testRunner.ClickByName("3D View Undo");
System.Threading.Thread.Sleep(2000);
int meshCountAfterUndo = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterUndo == 6);
testRunner.ClickByName("3D View Redo");
System.Threading.Thread.Sleep(2000);
int meshCountAfterRedo = view3D.MeshGroups.Count();
testRunner.AddTestResult(meshCountAfterRedo == 5);
partPreview.CloseOnIdle();
testRunner.Wait(.1);
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 800, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(10));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void SaveAsToQueue()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
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++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("3D View Copy");
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);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Save As Print Queue", 5));
MatterControlUtilities.CloseMatterControl(testRunner);
}
//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);
testRunner.AddTestResult(testRunner.WaitForName("Queue Item Save As Print Queue", 5));
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
}

File diff suppressed because it is too large Load diff

View file

@ -14,43 +14,39 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void PrinterNameStaysChanged()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab");
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab");
string widgetName = "Printer Name Edit";
testRunner.ClickByName(widgetName);
string widgetName = "Printer Name Edit";
testRunner.ClickByName(widgetName);
SystemWindow window;
var textWidget = testRunner.GetWidgetByName(widgetName, out window);
string newName = "Updated name";
textWidget.Text = newName;
testRunner.ClickByName("Printer Tab", 1);
testRunner.Wait(4);
SystemWindow window;
var textWidget = testRunner.GetWidgetByName(widgetName, out window);
string newName = "Updated name";
textWidget.Text = newName;
testRunner.ClickByName("Printer Tab", 1);
testRunner.Wait(4);
//Check to make sure the Printer dropdown gets the name change
testRunner.ClickByName("Printers... Menu", 2);
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists");
//Check to make sure the Printer dropdown gets the name change
testRunner.ClickByName("Printers... Menu", 2);
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists");
//Make sure the Active profile name changes as well
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");
//Make sure the Active profile name changes as well
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(5));
Assert.IsTrue(testHarness.AllTestsPassed());
}
}
}

View file

@ -18,46 +18,41 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void RaftEnabledPassedToSliceEngine()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
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);
//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("Layer View Tab");
testRunner.ClickByName("Bread Crumb Button Home", 1);
testRunner.ClickByName("Bread Crumb Button Home", 1);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.ClickByName("Raft / Priming Tab", 1);
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);
testRunner.ClickByName("Create Raft Checkbox", 1);
testRunner.Wait(1.5);
testRunner.ClickByName("Generate Gcode Button", 1);
testRunner.Wait(5);
//Call compare slice settings method here
testRunner.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));
//Call compare slice settings method here
testRunner.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 800, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(3));
Assert.IsTrue(testHarness.AllTestsPassed(1);
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
@ -67,41 +62,39 @@ namespace MatterHackers.MatterControl.Tests.Automation
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);
MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);
emulatorProcess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner);
emulatorProcess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner);
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfile != null);
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfile != null);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("General Tab", 1));
testRunner.AddTestResult(testRunner.ClickByName("Single Print Tab", 1));
testRunner.AddTestResult(testRunner.ClickByName("Layer(s) To Pause:" + " Edit"));
testRunner.Type("4;2;a;not;6");
testRunner.AddTestResult(testRunner.ClickByName("General Tab", 1));
testRunner.AddTestResult(testRunner.ClickByName("Single Print Tab", 1));
testRunner.AddTestResult(testRunner.ClickByName("Layer(s) To Pause:" + " Edit"));
testRunner.Type("4;2;a;not;6");
testRunner.AddTestResult(testRunner.ClickByName("Layer View Tab"));
testRunner.AddTestResult(testRunner.ClickByName("Layer View Tab"));
testRunner.AddTestResult(testRunner.ClickByName("Generate Gcode Button", 1));
testRunner.AddTestResult(testRunner.ClickByName("Display Checkbox", 10));
testRunner.AddTestResult(testRunner.ClickByName("Sync To Print Checkbox", 1));
testRunner.AddTestResult(testRunner.ClickByName("Generate Gcode Button", 1));
testRunner.AddTestResult(testRunner.ClickByName("Display Checkbox", 10));
testRunner.AddTestResult(testRunner.ClickByName("Sync To Print Checkbox", 1));
testRunner.AddTestResult(testRunner.ClickByName("Start Print Button", 1));
testRunner.AddTestResult(testRunner.ClickByName("Start Print Button", 1));
WaitForLayerAndResume(testRunner, 2);
WaitForLayerAndResume(testRunner, 4);
WaitForLayerAndResume(testRunner, 6);
WaitForLayerAndResume(testRunner, 2);
WaitForLayerAndResume(testRunner, 4);
WaitForLayerAndResume(testRunner, 6);
testRunner.AddTestResult(testRunner.WaitForName("Done Button", 30));
testRunner.AddTestResult(testRunner.WaitForName("Print Again Button", 1));
testRunner.AddTestResult(testRunner.WaitForName("Done Button", 30));
testRunner.AddTestResult(testRunner.WaitForName("Print Again Button", 1));
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);
Assert.IsTrue(testHarness.AllTestsPassed(19));
Assert.IsTrue(testHarness.AllTestsPassed(17));
try
{
@ -118,10 +111,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
GuiWidget layerNumber = testRunner.GetWidgetByName("Current GCode Layer Edit", out containingWindow, 20);
layerNumber.Invalidate();
testRunner.WaitUntil(() =>
{
return layerNumber.Text == indexToWaitFor.ToString();
}, 2);
testRunner.WaitUntil(() => layerNumber.Text == indexToWaitFor.ToString(), 2);
testRunner.AddTestResult(layerNumber.Text == indexToWaitFor.ToString());
testRunner.AddTestResult(testRunner.ClickByName("Resume Button", 1));
@ -131,57 +121,50 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void ClearingCheckBoxClearsUserOverride()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
//Navigate to Local Library
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
//Navigate to Local Library
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Switch to Printers tab");
testRunner.AddTestResult(testRunner.ClickByName("Features Tab", 1), "Switch to Features tab");
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Switch to Printers tab");
testRunner.AddTestResult(testRunner.ClickByName("Features Tab", 1), "Switch to Features tab");
CheckAndUncheckSetting(testRunner, SettingsKey.heat_extruder_before_homing, "Heat Before Homing Checkbox", false);
CheckAndUncheckSetting(testRunner, SettingsKey.heat_extruder_before_homing, "Heat Before Homing Checkbox", false);
CheckAndUncheckSetting(testRunner, SettingsKey.has_fan, "Has Fan Checkbox", true);
CheckAndUncheckSetting(testRunner, SettingsKey.has_fan, "Has Fan Checkbox", true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(20));
Assert.IsTrue(testHarness.AllTestsPassed(18));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void DeleteProfileWorksForGuest()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
// assert no profiles
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
// assert no profiles
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
// assert one profile
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 1);
// assert one profile
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 1);
MatterControlUtilities.DeleteSelectedPrinter(testRunner);
MatterControlUtilities.DeleteSelectedPrinter(testRunner);
// assert no profiles
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
// assert no profiles
testRunner.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900, defaultTestImages: MatterControlUtilities.DefaultTestImages);
@ -216,80 +199,73 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
public void HasHeatedBedCheckUncheck()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
//Navigate to Local Library
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab"));
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.ClickByName("Features Tab"));
testRunner.Wait(2);
for (int i = 0; i <= 1000; i++)
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
//Navigate to Local Library
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Printer Tab"));
testRunner.Wait(1);
testRunner.AddTestResult(testRunner.ClickByName("Features Tab"));
testRunner.Wait(2);
for (int i = 0; i <= 1000; i++)
{
testRunner.AddTestResult(testRunner.ClickByName("Has Heated Bed Checkbox"));
testRunner.Wait(.5);
}
MatterControlUtilities.CloseMatterControl(testRunner);
testRunner.AddTestResult(testRunner.ClickByName("Has Heated Bed Checkbox"));
testRunner.Wait(.5);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(1010));
Assert.IsTrue(testHarness.AllTestsPassed(1008));
}
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void HasHeatedBedCheckedHidesBedTemperatureOptions()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
//Navigate to Settings Tab and make sure Bed Temp Text box is visible
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
//Navigate to Settings Tab and make sure Bed Temp Text box is visible
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.ClickByName("Filament Tab", 1);
testRunner.ClickByName("Temperatures Tab", 1);
testRunner.AddTestResult(testRunner.WaitForName("Bed Temperature Textbox", 2));
testRunner.ClickByName("Filament Tab", 1);
testRunner.ClickByName("Temperatures Tab", 1);
testRunner.AddTestResult(testRunner.WaitForName("Bed Temperature Textbox", 2));
//Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
testRunner.ClickByName("Printer Tab",1);
testRunner.ClickByName("Features Tab", 1);
testRunner.DragByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(-40, 0));
testRunner.MoveToByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(0, 120));
testRunner.Drop();
testRunner.ClickByName("Has Heated Bed Checkbox", 1);
testRunner.Wait(.5);
testRunner.ClickByName("Filament Tab", 1);
bool bedTemperatureTextBoxVisible = testRunner.WaitForName("Bed Temperature Textbox", 2);
testRunner.AddTestResult(bedTemperatureTextBoxVisible == false);
//Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
testRunner.ClickByName("Printer Tab", 1);
testRunner.ClickByName("Features Tab", 1);
testRunner.DragByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(-40, 0));
testRunner.MoveToByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(0, 120));
testRunner.Drop();
testRunner.ClickByName("Has Heated Bed Checkbox", 1);
testRunner.Wait(.5);
testRunner.ClickByName("Filament Tab", 1);
bool bedTemperatureTextBoxVisible = testRunner.WaitForName("Bed Temperature Textbox", 2);
testRunner.AddTestResult(bedTemperatureTextBoxVisible == false);
//Make sure Bed Temperature Options are not visible in printer controls
testRunner.ClickByName("Controls Tab");
bool bedTemperatureControlsWidget = testRunner.WaitForName("Bed Temperature Controls Widget", 2);
testRunner.AddTestResult(bedTemperatureTextBoxVisible == false);
//Make sure Bed Temperature Options are not visible in printer controls
testRunner.ClickByName("Controls Tab");
bool bedTemperatureControlsWidget = testRunner.WaitForName("Bed Temperature Controls Widget", 2);
testRunner.AddTestResult(bedTemperatureTextBoxVisible == false);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 550, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(5));
Assert.IsTrue(testHarness.AllTestsPassed(3));
}
}
}

View file

@ -14,54 +14,50 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
public void LibraryQueueViewRefreshesOnAddItem()
{
// Run a copy of MatterControl
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
{
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab", 5);
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);
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;
SystemWindow systemWindow;
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
View3DWidget view3D = partPreview as View3DWidget;
testRunner.AddTestResult(testRunner.ClickByName("3D View Edit", 3));
testRunner.AddTestResult(testRunner.ClickByName("3D View Edit", 3));
testRunner.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
// wait for the copy to finish
testRunner.Wait(.1);
testRunner.AddTestResult(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
testRunner.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
testRunner.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");
testRunner.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
// wait for the copy to finish
testRunner.Wait(.1);
testRunner.AddTestResult(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
testRunner.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
testRunner.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");
testRunner.Wait(1);
testRunner.Wait(1);
testRunner.Type("0Test Part");
testRunner.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));
testRunner.Type("0Test Part");
testRunner.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));
testRunner.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));
testRunner.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));
view3D.CloseOnIdle();
testRunner.Wait(.5);
view3D.CloseOnIdle();
testRunner.Wait(.5);
// ensure that it is now in the library folder (that the folder updated)
testRunner.AddTestResult(testRunner.WaitForName("Row Item " + "0Test Part", 5), "The part we added should be in the library");
// ensure that it is now in the library folder (that the folder updated)
testRunner.AddTestResult(testRunner.WaitForName("Row Item " + "0Test Part", 5), "The part we added should be in the library");
testRunner.Wait(.5);
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
MatterControlUtilities.CloseMatterControl(testRunner);
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items, defaultTestImages: MatterControlUtilities.DefaultTestImages);
Assert.IsTrue(testHarness.AllTestsPassed(8));
}
}

View file

@ -445,8 +445,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
}
testRunner.ClickByName("User Level Dropdown", 1);
testRunner.ClickByName("Advanced Menu Item", 1);
testRunner.AddTestResult(true);
testRunner.AddTestResult(true);
testRunner.Wait(.5);
}
}

View file

@ -120,7 +120,7 @@ namespace MatterControl.Tests
};
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);
Assert.IsTrue(testHarness.AllTestsPassed(3));
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
#endif

View file

@ -18,24 +18,23 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void CheckIfShouldBeShownParseTests()
{
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "0" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsFalse(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
}
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "1" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
Assert.IsFalse(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
}
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "0" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
@ -43,7 +42,7 @@ namespace MatterControl.Tests.MatterControl
}
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "1" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
@ -51,7 +50,7 @@ namespace MatterControl.Tests.MatterControl
}
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "0" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
@ -59,7 +58,7 @@ namespace MatterControl.Tests.MatterControl
}
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
@ -68,7 +67,7 @@ namespace MatterControl.Tests.MatterControl
{
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1", SettingsKey.has_fan, "1" };
var profile = GettProfile(settings);
var profile = GetProfile(settings);
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&has_fan", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&!has_fan", profile, null));
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect&has_fan", profile, null));
@ -84,19 +83,19 @@ namespace MatterControl.Tests.MatterControl
// percent first layer extrusion width
{
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, "%150", SettingsKey.nozzle_diameter, ".4" };
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .6, .0001);
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .6, .0001);
}
// absolute first layer extrusion width
{
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, ".75", SettingsKey.nozzle_diameter, ".4" };
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .75, .0001);
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .75, .0001);
}
// 0 first layer extrusion width
{
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, "0", SettingsKey.nozzle_diameter, ".4" };
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .4, .0001);
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .4, .0001);
}
}
@ -105,24 +104,24 @@ namespace MatterControl.Tests.MatterControl
// normal single
{
string[] settings = new string[] { SettingsKey.extruder_count, "1", SettingsKey.extruders_share_temperature, "0" };
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
}
// normal multiple
{
string[] settings = new string[] { SettingsKey.extruder_count, "2", SettingsKey.extruders_share_temperature, "0" };
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 2);
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 2);
}
// shared temp
{
string[] settings = new string[] { SettingsKey.extruder_count, "2", SettingsKey.extruders_share_temperature, "1" };
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
}
}
}
PrinterSettings GettProfile(string[] settings)
PrinterSettings GetProfile(string[] settings)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
for(int i=0; i<settings.Length; i+=2)