Fixing test for new UI

This commit is contained in:
Lars Brubaker 2018-12-06 11:59:37 -08:00
parent 5227b54b77
commit 22de333b5b
4 changed files with 27 additions and 21 deletions

View file

@ -45,8 +45,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator("JumpStart", "V1", runSlow: false))
{
// make sure it is showing the correct button
Assert.IsFalse(testRunner.WaitForName("PrintPopupMenu", .5), "Start Print should not be visible if PrintLeveling is required");
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible if PrintLeveling is required");
testRunner.OpenPrintPopupMenu(false, false);
// HACK: automatically resuming setup wizard. Long term we want a better plan
testRunner.ClickByName("Finish Setup Button");
@ -64,9 +63,10 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Reset to Defaults Menu Item");
testRunner.ClickByName("Yes Button");
testRunner.OpenPrintPopupMenu(false, false);
// make sure it is showing the correct button
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible after reset to Defaults");
Assert.IsTrue(!testRunner.WaitForName("PrintPopupMenu"), "Start Print should not be visible after reset to Defaults");
}
return Task.CompletedTask;

View file

@ -92,6 +92,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should be defined after add");
testRunner.OpenPrintPopupMenu(false, false);
testRunner.ClickByName("Finish Setup Button");
testRunner.Complete9StepLeveling();

View file

@ -96,7 +96,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Layer(s) To Pause Field");
testRunner.Type("2");
testRunner.ClickByName("Start Print Button");
testRunner.StartPrint();
// Wait for the Ok button
testRunner.WaitForName("Yes Button", 30);

View file

@ -320,7 +320,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitforDraw(systemWindow);
// close the welcome message
if (testRunner.NameExists("Cancel Wizard Button", 1))
{
testRunner.ClickByName("Cancel Wizard Button");
@ -797,7 +796,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
/// Switch to the primary SliceSettings tab
/// </summary>
/// <param name="testRunner"></param>
public static void OpenPrintPopupMenu(this AutomationRunner testRunner)
public static void OpenPrintPopupMenu(this AutomationRunner testRunner, bool openAdvanced = true, bool doFinishSetup = true)
{
var printerConnection = ApplicationController.Instance.DragDropData.View3DWidget.Printer.Connection;
@ -808,26 +807,31 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitFor(() => printerConnection.CommunicationState == CommunicationStates.Connected);
}
if (testRunner.NamedWidgetExists("Finish Setup Button"))
{
testRunner.ClickByName("Finish Setup Button");
testRunner.ClickByName("Already Loaded Button");
}
// Wait for button to become enabled
var printerPopup = testRunner.GetWidgetByName("PrintPopupMenu", out _);
testRunner.WaitFor(() => printerPopup.Enabled);
// check if the print menu is already open
// if the menu is not already open
if (!testRunner.NameExists("Advanced Section", .2))
{
// open it
testRunner.ClickByName("PrintPopupMenu");
}
if (!testRunner.NameExists("Layer(s) To Pause Field", .2))
{
testRunner.ClickByName("Advanced Section");
}
// wait for it to be all the way open
testRunner.WaitForName("Advanced Section");
// make sure we are in a state that can print
if (doFinishSetup
&& testRunner.NameExists("Finish Setup Button"))
{
testRunner.ClickByName("Finish Setup Button");
testRunner.ClickByName("Already Loaded Button");
// open it again
testRunner.ClickByName("PrintPopupMenu");
testRunner.WaitForName("Advanced Section");
}
if (openAdvanced
&& !testRunner.NameExists("Layer(s) To Pause Field", .2))
{
testRunner.ClickByName("Advanced Section");
}
}