Revise UndoRedoCopy test

This commit is contained in:
John Lewin 2017-06-05 23:13:53 -07:00
parent b0552685b9
commit 83943be0cc

View file

@ -124,38 +124,28 @@ namespace MatterHackers.MatterControl.Tests.Automation
[Test]
public async Task UndoRedoCopy()
{
AutomationTest testToRun = (testRunner) =>
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
SystemWindow systemWindow;
testRunner.AddDefaultFileToBedplate();
// Navigate to Local Library
testRunner.ClickByName("Library Tab");
testRunner.NavigateToFolder("Local Library Row Item Collection");
testRunner.ClickByName("Row Item Calibration - Box");
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
var view3D = testRunner.GetWidgetByName("View3DWidget", out _) as View3DWidget;
//Get View3DWidget and count Scene.Children before Copy button is clicked
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
View3DWidget view3D = partPreview as View3DWidget;
testRunner.Select3DPart("Calibration - Box.stl");
string copyButtonName = "3D View Copy";
//Click Edit button to make edit controls visible
testRunner.Delay(1);
int partCountBeforeCopy = view3D.Scene.Children.Count();
Assert.IsTrue(partCountBeforeCopy == 1);
Assert.AreEqual(1, view3D.Scene.Children.Count, "There should be 1 part on the bed after AddDefaultFileToBedplate()");
// Add 5 items
for (int i = 0; i <= 4; i++)
{
testRunner.ClickByName(copyButtonName);
testRunner.Delay(() => view3D.Scene.Children.Count() == i + 2, 2);
Assert.AreEqual(view3D.Scene.Children.Count(), i + 2);
testRunner.ClickByName("3D View Copy");
testRunner.Delay(.5);
}
testRunner.Delay(.2);
Assert.AreEqual(6, view3D.Scene.Children.Count, "There should be 6 parts on the bed after the copy loop");
// Perform and validate 5 undos
for (int x = 0; x <= 4; x++)
{
int meshCountBeforeUndo = view3D.Scene.Children.Count();
@ -169,6 +159,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.2);
// Perform and validate 5 redoes
for (int z = 0; z <= 4; z++)
{
int meshCountBeforeRedo = view3D.Scene.Children.Count();
@ -181,9 +172,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
}
return Task.CompletedTask;
};
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 640);
}, overrideWidth: 1300);
}
[Test]