Use WaitForName defaults unless exceptional

This commit is contained in:
John Lewin 2017-06-14 10:05:39 -07:00
parent b48041c9bc
commit 53aa468183
5 changed files with 28 additions and 28 deletions

View file

@ -36,12 +36,12 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Type("{Enter}");
//Get test results
Assert.IsTrue(testRunner.WaitForName(firstItemName, 2) == true);
Assert.IsTrue(testRunner.WaitForName(firstItemName));
testRunner.ClickByName("Queue Export Button");
testRunner.Delay(2);
testRunner.WaitForName("Export Item Window", 2);
testRunner.WaitForName("Export Item Window");
testRunner.ClickByName("Export as GCode Button");
testRunner.Delay(2);

View file

@ -194,7 +194,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(() => QueueData.Instance.ItemCount == expectedQueueCount, 3);
Assert.AreEqual(expectedQueueCount, QueueData.Instance.ItemCount, "Copy button increases queue count by one");
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman - copy", 2), "Copied Batman item exists with expected name");
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman - copy"), "Copied Batman item exists with expected name");
testRunner.Delay(.3);
return Task.CompletedTask;
@ -221,7 +221,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.2);
// WaitFor Ok button and ensure parent window has expected title and named button
testRunner.WaitForName("Ok Button", 2);
testRunner.WaitForName("Ok Button");
var widget = testRunner.GetWidgetByName("Ok Button", out parentWindow);
Assert.IsTrue(widget != null
&& parentWindow.Title == "MatterControl - Alert", "Send Disabled warning appears when no plugins exists to satisfy behavior");

View file

@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Click Add button and select files
testRunner.ClickByName("Library Add Button");
testRunner.WaitForName("Automation Dialog TextEdit", 3);
testRunner.WaitForName("Automation Dialog TextEdit");
testRunner.Type(MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"));
testRunner.Delay(1);
testRunner.Type("{Enter}");
@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Assert - one part added and queue count increases by one
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Named widget should exist after add(Fennec_Fox)");
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl"), "Named widget should exist after add(Fennec_Fox)");
return Task.CompletedTask;
});
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Click Add button and select files
testRunner.ClickByName("Library Add Button");
testRunner.WaitForName("Automation Dialog TextEdit", 3);
testRunner.WaitForName("Automation Dialog TextEdit");
testRunner.Type(string.Format(
"\"{0}\" \"{1}\"",
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
@ -98,8 +98,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Assert - two parts added and queue count increases by two
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 2 when adding 2 items");
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Named widget should exist after add(Fennec_Fox)");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Named widget should exist after add(Batman)");
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl"), "Named widget should exist after add(Fennec_Fox)");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Named widget should exist after add(Batman)");
return Task.CompletedTask;
});
@ -126,7 +126,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should decrease by one after clicking Remove");
// Make sure selected item was removed
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2", 1), "Mouthpiece part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part should *not* exist after remove");
return Task.CompletedTask;
}, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
@ -153,8 +153,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should decrease by two after clicking Remove");
// Make sure both selected items are removed
Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2", 1), "Mouthpiece part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item Batman"), "Batman part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2"), "Mouthpiece part should *not* exist after remove");
return Task.CompletedTask;
}, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Click Add button and select files
testRunner.ClickByName("Library Add Button");
testRunner.WaitForName("Automation Dialog TextEdit", 3);
testRunner.WaitForName("Automation Dialog TextEdit");
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
testRunner.Delay(1);
@ -208,7 +208,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Assert - one part added and queue count increases by one
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf", 2), "Named widget should exist after add(Rook)");
Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf"), "Named widget should exist after add(Rook)");
return Task.CompletedTask;
});
@ -228,7 +228,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Click Add button and select files
testRunner.ClickByName("Library Add Button");
testRunner.WaitForName("Automation Dialog TextEdit", 3);
testRunner.WaitForName("Automation Dialog TextEdit");
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
testRunner.Delay(1);
@ -239,7 +239,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Assert - one part added and queue count increases by one
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Named widget should exist after add(Batman)");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Named widget should exist after add(Batman)");
return Task.CompletedTask;
});
@ -259,7 +259,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Click Add button and select files
testRunner.ClickByName("Library Add Button");
testRunner.WaitForName("Automation Dialog TextEdit", 3);
testRunner.WaitForName("Automation Dialog TextEdit");
testRunner.Type(MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"));
testRunner.Delay(1);
@ -270,7 +270,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Assert - one part added and queue count increases by one
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza_pyramid.gcode", 2), "Named widget should exist after add(chichen-itza)");
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza_pyramid.gcode"), "Named widget should exist after add(chichen-itza)");
return Task.CompletedTask;
});

View file

@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
*3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one
*/
bool checkboxExists = testRunner.WaitForName("Queue Item Checkbox", 2);
bool checkboxExists = testRunner.WaitForName("Queue Item Checkbox");
Assert.IsTrue(checkboxExists == false);
@ -201,8 +201,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(2);
Assert.AreEqual(4, QueueData.Instance.ItemCount, "Queue should initially have four items");
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 1));
Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman"));
Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2"));
testRunner.ClickByName("Queue Item Batman");
testRunner.ClickByName("Queue Item Batman Remove");
@ -216,7 +216,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(2);
testRunner.ClickByName("Queue Item 2013-01-25_Mouthpiece_v2 View");
Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2 Part Preview", 2), "The Mouthpiece Part Preview should appear after the view button is clicked");
Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2 Part Preview"), "The Mouthpiece Part Preview should appear after the view button is clicked");
return Task.CompletedTask;
};

View file

@ -48,7 +48,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())
{
@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitForName("Resume Button", 30);
testRunner.ClickByName("Cancel Print Button");
testRunner.WaitForName("Start Print Button", 1);
testRunner.WaitForName("Start Print Button");
Assert.IsTrue(testRunner.NameExists("Start Print Button"));
int g28Count = 0;
@ -274,8 +274,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Filament Tab");
testRunner.ClickByName("Temperatures Tab");
Assert.IsTrue(testRunner.WaitForName("Extruder Temperature Textbox", 2));
Assert.IsTrue(testRunner.WaitForName("Bed Temperature Textbox", 2));
Assert.IsTrue(testRunner.WaitForName("Extruder Temperature Textbox"));
Assert.IsTrue(testRunner.WaitForName("Bed Temperature Textbox"));
// Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
testRunner.ClickByName("Printer Tab");
@ -287,12 +287,12 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.5);
testRunner.ClickByName("Filament Tab");
Assert.IsFalse(testRunner.WaitForName("Bed Temperature Textbox", 2), "Filament -> Bed Temp should not be visible after Heated Bed unchecked");
Assert.IsFalse(testRunner.WaitForName("Bed Temperature Textbox"), "Filament -> Bed Temp should not be visible after Heated Bed unchecked");
// Make sure Bed Temperature Options are not visible in printer controls
testRunner.SwitchToControlsTab();
Assert.IsFalse(testRunner.WaitForName("Bed Temperature Controls Widget", 2), "Controls -> Bed Temp should not be visible after Heated Bed unchecked");
Assert.IsFalse(testRunner.WaitForName("Bed Temperature Controls Widget"), "Controls -> Bed Temp should not be visible after Heated Bed unchecked");
return Task.CompletedTask;
}, overrideWidth: 1300);