Merge pull request #1723 from jlewin/master

Reduce hard-coded test wait times, use initial dialog to add printers
This commit is contained in:
johnlewin 2016-12-12 17:40:21 -08:00 committed by GitHub
commit ce61d298eb
4 changed files with 21 additions and 22 deletions

View file

@ -118,9 +118,9 @@ namespace MatterHackers.MatterControl.ActionBar
};
disconnectPrinterButton = actionBarButtonFactory.Generate("Disconnect".Localize().ToUpper(), "icon_power_32x32.png");
disconnectPrinterButton.Name = "Disconnect from printer button";
disconnectPrinterButton.ToolTipText = "Disconnect from current printer".Localize();
disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
disconnectPrinterButton.Cursor = Cursors.Hand;
disconnectPrinterButton.Click += (s, e) => UiThread.RunOnIdle(OnIdleDisconnect);

View file

@ -508,7 +508,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationTest testToRun = (testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
testRunner.WaitForName("Cancel Wizard Button", 1);
using (var emulatorProcess = testRunner.LaunchAndConnectToPrinterEmulator())
{
@ -517,13 +517,12 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Local Library Row Item Collection");
testRunner.ClickByName("Row Item Calibration - Box");
testRunner.Wait(1);
int initialQueueCount = QueueData.Instance.ItemCount;
// Click Library Item Print Button
testRunner.ClickByName("Row Item Calibration - Box Print Button");
testRunner.Wait(2);
testRunner.Wait(.5);
Assert.AreEqual(initialQueueCount + 1, QueueData.Instance.ItemCount, "Queue count should increment by one after clicking 'Print'");
Assert.AreEqual("Calibration - Box", QueueData.Instance.PrintItems[0].Name, "Library item should be inserted at queue index 0");
@ -533,7 +532,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Cancel Print Button");
}
testRunner.Wait(1);
testRunner.WaitForName("Start Print Button", 5);
return Task.FromResult(0);

View file

@ -71,7 +71,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationTest testToRun = (testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
testRunner.WaitForName("Cancel Wizard Button", 1);
using (var emulatorProcess = testRunner.LaunchAndConnectToPrinterEmulator())
{

View file

@ -194,10 +194,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
process.Start();
// edit the com port
testRunner.ClickByName("Edit Printer Button");
testRunner.Wait(2);
testRunner.ClickByName("Edit Printer Button", 3);
testRunner.ClickByName("Serial Port Dropdown");
testRunner.ClickByName("Serial Port Dropdown", 3);
testRunner.ClickByName(config.MCPort + " Menu Item", 1);
@ -206,7 +205,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
// connect to the created printer
testRunner.ClickByName("Connect to printer button", 2);
testRunner.Wait(2);
testRunner.WaitForName("Disconnect from printer button", 5);
return process;
}
@ -244,24 +243,25 @@ namespace MatterHackers.MatterControl.Tests.Automation
public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model)
{
testRunner.ClickByName("Printers... Menu", 2, delayBeforeReturn: .5);
testRunner.ClickByName("Add New Printer... Menu Item", 5, delayBeforeReturn: .5);
testRunner.ClickByName("Select Make", 5, delayBeforeReturn: .5);
if (!testRunner.NameExists("Select Make"))
{
testRunner.ClickByName("Printers... Menu", 2, delayBeforeReturn: .5);
testRunner.ClickByName("Add New Printer... Menu Item", 5, delayBeforeReturn: .5);
}
testRunner.ClickByName("Select Make", 5);
testRunner.Type(make);
testRunner.Type("{Enter}");
testRunner.ClickByName("Select Model", 5, delayBeforeReturn: .5);
testRunner.ClickByName(model + " Menu Item", 5, delayBeforeReturn: .5);
testRunner.ClickByName("Select Model", 5);
testRunner.Type(model);
testRunner.Type("{Enter}");
// An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller.
// Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded.
WaitForReloadAll(testRunner, () => testRunner.ClickByName("Save & Continue Button", 2));
testRunner.ClickByName("Cancel Wizard Button", 5, delayBeforeReturn: .5);
testRunner.ClickByName("Cancel Wizard Button", 5);
testRunner.Wait(1);
}
@ -346,11 +346,11 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
SearchRegion libraryRowItemRegion = testRunner.GetRegionByName(libraryRowItemName, 3);
testRunner.ClickByName(libraryRowItemName);
testRunner.MoveToByName(libraryRowItemName);
testRunner.Wait(.5);
//testRunner.MoveToByName(libraryRowItemName);
//testRunner.Wait(.5);
testRunner.ClickByName("Open Collection", searchRegion: libraryRowItemRegion);
testRunner.Wait(.5);
//testRunner.Wait(.5);
}
public static async Task RunTest(