Merge pull request #3068 from jlewin/design_tools

Fix tests
This commit is contained in:
johnlewin 2018-03-13 09:03:15 -07:00 committed by GitHub
commit 463d4fd3d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 19 deletions

View file

@ -13,6 +13,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
public class ToggleSwitchConfig
{
public bool Checked { get; set; }
public string Name { get; set; }
public Action<bool> ToggleAction { get; set; }
}
@ -90,6 +91,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, textColor);
toggleSwitch.VAnchor = VAnchor.Center;
toggleSwitch.Name = toggleSwitchConfig.Name;
toggleSwitch.Margin = new BorderDouble(left: 16);
toggleSwitch.CheckedStateChanged += (sender, e) =>
{

View file

@ -251,6 +251,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
theme.Colors.PrimaryTextColor,
new SettingsItem.ToggleSwitchConfig()
{
Name = option.Title + " Toggle",
Checked = option.IsChecked(),
ToggleAction = option.SetValue
},

View file

@ -66,15 +66,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Model View Button");
testRunner.ClickByName("View3D Overflow Menu");
Assert.IsTrue(testRunner.WaitForName("Overhang Menu Item"), "Model overflow menu should have Overhang item");
testRunner.ClickByName("Layers3D Button");
testRunner.ClickByName("View3D Overflow Menu");
Assert.IsTrue(testRunner.WaitForName("Sync To Print Menu Item"), "GCode3D overflow menu should have sync-to-print item");
testRunner.ClickByName("Layers2D Button");
testRunner.ClickByName("View3D Overflow Menu");
Assert.IsTrue(testRunner.WaitForName("Sync To Print Menu Item"), "GCode2D overflow menu should have sync-to-print item");
return Task.CompletedTask;
});

View file

@ -58,8 +58,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.AddItemToBedplate();
testRunner.OpenGCode3DOverflowMenu();
testRunner.ClickByName("Sync To Print Menu Item");
// Toggle Sync-to-print
testRunner.SwitchToGCodeTab();
testRunner.ClickByName("Sync To Print Toggle");
testRunner.StartPrint();
@ -94,9 +95,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.AddItemToBedplate();
// Turn on Sync-to-print
testRunner.OpenGCode3DOverflowMenu();
testRunner.ClickByName("Sync To Print Menu Item");
// Toggle Sync-to-print
testRunner.SwitchToGCodeTab();
testRunner.ClickByName("Sync To Print Toggle");
testRunner.StartPrint();
@ -123,7 +124,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
private static void WaitForLayerAndResume(AutomationRunner testRunner, int indexToWaitFor)
{
testRunner.WaitForName("No Button", 30);
var printer = ApplicationController.Instance.ActivePrinter;
// Wait for layer

View file

@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitforDraw(systemWindow);
}
public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseSignInAndPrinterSelect)
public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, bool closeInitialPlusTab = true)
{
testRunner.WaitForFirstDraw();
@ -194,10 +194,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Cancel Wizard Button");
}
var plusTabRegion = testRunner.GetRegionByName("Initial Plus Tab");
testRunner.ClickByName("Close Tab Button", plusTabRegion);
if (closeInitialPlusTab)
{
var plusTabRegion = testRunner.GetRegionByName("Initial Plus Tab");
testRunner.ClickByName("Close Tab Button", plusTabRegion);
testRunner.WaitForWidgetDisappear("Initial Plus Tab", 2);
testRunner.WaitForWidgetDisappear("Initial Plus Tab", 2);
}
}
public static void ChangeToQueueContainer(this AutomationRunner testRunner)
@ -823,6 +826,20 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Controls Tab");
}
/// <summary>
/// Switch to Printer -> GCode Tab - NOTE: as a short term hack this helper as adds content to the bed and slices to ensure GCode view options appear as expected
/// </summary>
/// <param name="testRunner"></param>
public static void SwitchToGCodeTab(this AutomationRunner testRunner)
{
testRunner.ClickByName("Layers3D Button");
// TODO: Remove workaround needed to force GCode options to appear {{
testRunner.AddItemToBedplate();
testRunner.ClickByName("Generate Gcode Button");
// TODO: Remove workaround needed to force GCode options to appear }}
}
private static void EnsurePrinterSidebarOpen(AutomationRunner testRunner)
{
// If the sidebar exists, we need to expand and pin it