Added tests for saving to Local Library and Downloads folders. Also fixed regression(could not add gcode files to the queue)

This commit is contained in:
Greg 2016-03-02 12:43:45 -08:00
parent c41fd49cc0
commit d33c785fe2
2 changed files with 120 additions and 3 deletions

View file

@ -348,8 +348,6 @@ namespace MatterHackers.MatterControl.UI
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -396,5 +394,124 @@ namespace MatterHackers.MatterControl.UI
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
}
[Test, RequiresSTA, RunInApplicationDomain]
public void SaveAsToLocalLibrary()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.ClickByName("Row Item Calibration - Box");
testRunner.ClickByName("Row Item Calibration - Box Print Button");
testRunner.Wait(1);
//Click Edit button to make edit controls visible
testRunner.ClickByName("3D View Edit");
testRunner.Wait(1);
for (int i = 0; i <= 2; i++)
{
testRunner.ClickByName("3D View Copy");
testRunner.Wait(1);
}
//Click Save As button to save changes to the part
testRunner.ClickByName("Save As Menu");
testRunner.Wait(1);
testRunner.ClickByName("Save As Menu Item");
testRunner.Wait(1);
//Type in name of new part and then save to Local Library
testRunner.Type("Save As Local Library");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.ClickByName("Save As Save Button");
//Make sure there is a new Local Library item with a name that matcheds the new opart
testRunner.Wait(1);
testRunner.ClickByName("Library Tab");
testRunner.Wait(10);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Save As Local Library", 5));
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
}
[Test, RequiresSTA, RunInApplicationDomain]
public void SaveAsToDownloads()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
//Navigate to Downloads
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.ClickByName("Row Item Calibration - Box");
testRunner.ClickByName("Row Item Calibration - Box Print Button");
testRunner.Wait(1);
//Click Edit button to make edit controls visible
testRunner.ClickByName("3D View Edit");
testRunner.Wait(1);
for (int i = 0; i <= 2; i++)
{
testRunner.ClickByName("3D View Copy");
testRunner.Wait(1);
}
//Click Save As button to save changes to the part
testRunner.ClickByName("Save As Menu");
testRunner.Wait(1);
testRunner.ClickByName("Save As Menu Item");
testRunner.Wait(1);
//Type in name of new part and then save to Downloads
testRunner.Type("Save As Downloads");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
testRunner.Wait(1);
testRunner.ClickByName("Save As Save Button");
//Make sure there is a new Downloads item with a name that matches the new opart
testRunner.Wait(1);
testRunner.ClickByName("Library Tab");
testRunner.ClickByName("Bread Crumb Button Home");
testRunner.Wait(1);
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Save As Downloads", 5));
//Do clean up for Downloads
testRunner.ClickByName("Row Item Save As Downloads", 2);
testRunner.ClickByName("Library Edit Button");
testRunner.ClickByName("Library Remove Item Button");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
}
}
}