Ensure spawned emulator process is always killed via using/Dispose

- LaunchAndConnectToPrinterEmulator -> TestRunner extension method
This commit is contained in:
John Lewin 2016-10-26 07:27:16 -07:00
parent 3c1066b0aa
commit b54b73db7f
4 changed files with 72 additions and 83 deletions

View file

@ -21,11 +21,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
string copyButtonName = "3D View Copy";
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
testRunner.NavigateToFolder("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);
@ -34,33 +36,25 @@ namespace MatterHackers.MatterControl.Tests.Automation
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();
Assert.IsTrue(partCountBeforeCopy == 1);
Assert.AreEqual(view3D.MeshGroups.Count(), 1, "Should have 1 part before copy");
//Click Copy button and count MeshGroups
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterCopy = view3D.MeshGroups.Count();
Assert.IsTrue(partCountAfterCopy == 2);
testRunner.Wait(1);
testRunner.Wait(.5);
Assert.AreEqual(view3D.MeshGroups.Count(), 2, "Should have 2 parts after copy");
//Click Copy button a second time and count MeshGroups again
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
Assert.IsTrue(partCountAfterSecondCopy == 3);
view3D.CloseOnIdle();
testRunner.Wait(.5);
Assert.AreEqual(view3D.MeshGroups.Count(), 3, "Should have 3 parts after 2nd copy");
return Task.FromResult(0);
};
await MatterControlUtilities.RunTest(testToRun);
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 800);
}
[Test, Apartment(ApartmentState.STA)]