Use WaitForName defaults

This commit is contained in:
John Lewin 2017-06-14 14:02:29 -07:00
parent c96e1d363c
commit 43656d4501
7 changed files with 34 additions and 36 deletions

View file

@ -22,7 +22,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(1);
testRunner.ClickByName("Add Printer Menu Item");
testRunner.Delay(1);
Assert.IsTrue(testRunner.WaitForName("Select Make", 3));
Assert.IsTrue(testRunner.WaitForName("Select Make"));
testRunner.ClickByName("Cancel Wizard Button");
@ -83,8 +83,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Print Queue Row Item Collection");
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox", 2));
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 2));
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox"));
Assert.IsTrue(testRunner.WaitForName("Row Item Batman"));
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by two after adding Fennec and Batman parts");
@ -113,8 +113,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Print Queue Row Item Collection");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 1));
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2", 1));
Assert.IsTrue(testRunner.WaitForName("Row Item Batman"));
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2"));
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by two after adding contents of Batmap.zip");

View file

@ -21,7 +21,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Printer Tab");
testRunner.Delay(1);
Assert.IsFalse(testRunner.WaitForName("Print Leveling Tab", 3), "Print leveling should not exist for an Airwolf HD");
Assert.IsFalse(testRunner.WaitForName("Print Leveling Tab"), "Print leveling should not exist for an Airwolf HD");
// Add printer that does not have hardware leveling
testRunner.AddAndSelectPrinter("3D Factory", "MendelMax 1.5");
@ -29,7 +29,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Slice Settings Tab");
testRunner.ClickByName("Printer Tab");
Assert.IsTrue(testRunner.WaitForName("Print Leveling Tab", 3), "Print leveling should exist for a 3D Factory MendelMax");
Assert.IsTrue(testRunner.WaitForName("Print Leveling Tab"), "Print leveling should exist for a 3D Factory MendelMax");
return Task.CompletedTask;
}, overrideHeight: 800);
@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
// make sure it is showing the correct button
Assert.IsFalse(testRunner.WaitForName("Start Print Button", .5), "Start Print should not be visible if PrintLeveling is required");
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup should be visible if PrintLeveling is required");
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible if PrintLeveling is required");
// do print leveling
testRunner.ClickByName("Next Button");
@ -62,8 +62,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Done Button");
// make sure the button has changed to start print
Assert.IsTrue(testRunner.WaitForName("Start Print Button", 5), "Start Print should be visible after leveling the printer");
Assert.IsFalse(testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup should not be visible after leveling the printer");
Assert.IsTrue(testRunner.WaitForName("Start Print Button"), "Start Print should be visible after leveling the printer");
Assert.IsFalse(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should not be visible after leveling the printer");
// reset to defaults and make sure print leveling is cleared
testRunner.SwitchToAdvancedSliceSettings();
@ -74,8 +74,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(1);
// make sure it is showing the correct button
Assert.IsTrue(!testRunner.WaitForName("Start Print Button", 1), "Start Print should be visible after reset to Defaults");
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup should not be visible after reset to Defaults");
Assert.IsTrue(!testRunner.WaitForName("Start Print Button"), "Start Print should be visible after reset to Defaults");
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should not be visible after reset to Defaults");
}
return Task.CompletedTask;

View file

@ -67,8 +67,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(1);
testRunner.Type("{Enter}");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 2), "Batman part should exist after adding");
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25 Mouthpiece V2", 2), "Mouthpiece part should exist after adding");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman"), "Batman part should exist after adding");
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25 Mouthpiece V2"), "Mouthpiece part should exist after adding");
return Task.CompletedTask;
});
@ -96,8 +96,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Rename Button");
// Confirm
Assert.IsTrue(testRunner.WaitForName("Row Item Rook Renamed", 5));
Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 2));
Assert.IsTrue(testRunner.WaitForName("Row Item Rook Renamed"));
Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 1));
return Task.CompletedTask;
}, overrideWidth: 600);
@ -127,7 +127,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.2);
// Confirm newly created folder exists
Assert.IsTrue(testRunner.WaitForName("New Folder Row Item Collection", 1), "New folder should appear as GuiWidget");
Assert.IsTrue(testRunner.WaitForName("New Folder Row Item Collection"), "New folder should appear as GuiWidget");
testRunner.ClickByName("New Folder Row Item Collection");
testRunner.Delay(.2);
@ -141,7 +141,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.2);
// Make sure the renamed Library Folder exists
Assert.IsTrue(testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2), "Renamed folder should exist");
Assert.IsTrue(testRunner.WaitForName("Renamed Library Folder Row Item Collection"), "Renamed folder should exist");
return Task.CompletedTask;
});
@ -217,7 +217,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Print Queue Row Item Collection");
// Make sure that the item exists in the PrintQueueContainer
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 5), "Rook item should exist in the Queue after Add");
Assert.IsTrue(testRunner.WaitForName("Row Item Rook"), "Rook item should exist in the Queue after Add");
return Task.CompletedTask;
});
@ -255,8 +255,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Print Queue Row Item Collection");
// Make sure that the items exist in the PrintQueueContainer
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 5), "Rook item should exist in the Queue after Add");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 5), "Batman item should exist in the Queue after Add");
Assert.IsTrue(testRunner.WaitForName("Row Item Rook"), "Rook item should exist in the Queue after Add");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman"), "Batman item should exist in the Queue after Add");
return Task.CompletedTask;
});

View file

@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Select3DPart("Calibration - Box.stl");
// Click Edit button to make edit controls visible
testRunner.WaitForName("3D View Copy", 3);
testRunner.WaitForName("3D View Copy");
testRunner.Delay(1); // wait for window to finish opening
Assert.AreEqual(1, view3D.Scene.Children.Count, "Should have 1 part before copy");

View file

@ -215,8 +215,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.WaitForName("Cancel Wizard Button", 1);
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
{
Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null);
@ -238,12 +236,15 @@ namespace MatterHackers.MatterControl.Tests.Automation
emulator.SimulateLineErrors = true;
// close the pause dialog pop-up (resume)
testRunner.WaitForName("No Button", 90);
testRunner.ClickByName("No Button");
// simulate board reboot
emulator.SimulateReboot();
// close the pause dialog pop-up (resume)
testRunner.Delay(3);
testRunner.WaitForName("No Button", 90);
testRunner.ClickByName("No Button");
// Wait for done
@ -264,9 +265,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
await MatterControlUtilities.RunTest((testRunner) =>
{
SystemWindow systemWindow;
testRunner.WaitForName("Cancel Wizard Button", 1);
testRunner.WaitForName("Cancel Wizard Button");
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
{
@ -282,7 +281,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Start Print Button");
var container = testRunner.GetWidgetByName("ManualPrinterControls.ControlsContainer", out systemWindow, 5);
var container = testRunner.GetWidgetByName("ManualPrinterControls.ControlsContainer", out _, 5);
// Scroll the widget into view
var scrollable = container.Parents<ManualPrinterControls>().First().Children<ScrollableWidget>().First();
@ -353,7 +352,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.WaitForName("Cancel Wizard Button", 1);
testRunner.WaitForName("Cancel Wizard Button");
// Set custom adjustment values
FeedRateMultiplyerStream.FeedRateRatio = initialFeedRate;
@ -437,7 +436,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.WaitForName("Cancel Wizard Button", 1);
testRunner.WaitForName("Cancel Wizard Button");
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
{
@ -481,7 +480,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.WaitForName("Cancel Wizard Button", 1);
testRunner.WaitForName("Cancel Wizard Button");
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator())
{

View file

@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Local Library Row Item Collection");
// ensure that it is now in the library folder (that the folder updated)
Assert.IsTrue(testRunner.WaitForName("Row Item 0Test Part", 5), "The part we added should be in the library");
Assert.IsTrue(testRunner.WaitForName("Row Item 0Test Part"), "The part we added should be in the library");
testRunner.Delay(.5);

View file

@ -204,8 +204,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
emulator.Startup();
// edit the com port
SystemWindow containingWindow;
var editButton = testRunner.GetWidgetByName("Edit Printer Button", out containingWindow);
var editButton = testRunner.GetWidgetByName("Edit Printer Button", out _);
testRunner.Delay(() => editButton.Enabled, 5); // Wait until the edit button is ready to click it. Ensures the printer is loaded.
testRunner.ClickByName("Edit Printer Button");
@ -219,7 +218,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// connect to the created printer
testRunner.ClickByName("Connect to printer button");
testRunner.WaitForName("Disconnect from printer button", 5);
testRunner.WaitForName("Disconnect from printer button");
return emulator;
}
@ -609,7 +608,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
foreach (string assetName in assetNames)
{
string friendlyName = Path.GetFileNameWithoutExtension(assetName);
Assert.IsTrue(testRunner.WaitForName($"Row Item {friendlyName}", 2), $"{friendlyName} part should exist after adding");
Assert.IsTrue(testRunner.WaitForName($"Row Item {friendlyName}", 0.5), $"{friendlyName} part should exist after adding");
}
}