Wrote a test to ensure settings view can change when floating without relead
This commit is contained in:
parent
7956891817
commit
cbd0b9969b
2 changed files with 52 additions and 16 deletions
|
|
@ -154,7 +154,28 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
}
|
||||
}, maxTimeToRun: 120);
|
||||
}
|
||||
|
||||
|
||||
[Test, Category("Emulator")]
|
||||
public async Task SettingsStayOpenOnRebuildSettings()
|
||||
{
|
||||
await MatterControlUtilities.RunTest(async (testRunner) =>
|
||||
{
|
||||
using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator(pinSettingsOpen: false))
|
||||
{
|
||||
var printer = testRunner.FirstPrinter();
|
||||
|
||||
testRunner.OpenSettingsSidebar(false);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
testRunner.ClickByName("Slice Settings Overflow Menu");
|
||||
testRunner.ClickByName("Advanced Menu Item");
|
||||
testRunner.ClickByName("Slice Settings Overflow Menu");
|
||||
testRunner.ClickByName("Simple Menu Item");
|
||||
}
|
||||
}
|
||||
}, maxTimeToRun: 120);
|
||||
}
|
||||
|
||||
[Test, Category("Emulator")]
|
||||
public async Task CancelWorksAsExpected()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -273,7 +273,11 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
}
|
||||
}
|
||||
|
||||
public static Emulator LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD", bool runSlow = false)
|
||||
public static Emulator LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner,
|
||||
string make = "Airwolf 3D",
|
||||
string model = "HD",
|
||||
bool runSlow = false,
|
||||
bool pinSettingsOpen = true)
|
||||
{
|
||||
var hardwareTab = testRunner.GetWidgetByName("Hardware Tab", out SystemWindow systemWindow, 10);
|
||||
|
||||
|
|
@ -291,7 +295,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
// Create the printer
|
||||
testRunner.AddAndSelectPrinter(make, model)
|
||||
.SwitchToPrinterSettings();
|
||||
.SwitchToPrinterSettings(pinSettingsOpen);
|
||||
|
||||
var serialPortDropDown = testRunner.GetWidgetByName("com_port Field", out _, 1);
|
||||
|
||||
|
|
@ -1094,7 +1098,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
/// <param name="testRunner">The AutomationRunner in use</param>
|
||||
public static void SwitchToSliceSettings(this AutomationRunner testRunner)
|
||||
{
|
||||
EnsurePrinterSidebarOpen(testRunner);
|
||||
OpenSettingsSidebar(testRunner);
|
||||
|
||||
testRunner.WaitForWidgetEnabled("Slice Settings Tab");
|
||||
|
||||
|
|
@ -1152,17 +1156,30 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
/// Switch to printer settings
|
||||
/// </summary>
|
||||
/// <param name="testRunner">The AutomationRunner in use</param>
|
||||
public static AutomationRunner SwitchToPrinterSettings(this AutomationRunner testRunner)
|
||||
public static AutomationRunner SwitchToPrinterSettings(this AutomationRunner testRunner, bool pinSettingsOpen = true)
|
||||
{
|
||||
EnsurePrinterSidebarOpen(testRunner);
|
||||
testRunner.OpenSettingsSidebar(pinSettingsOpen);
|
||||
|
||||
if (!testRunner.NameExists("Printer Tab", 0.1))
|
||||
{
|
||||
testRunner.ClickByName("Printer Overflow Menu")
|
||||
.ClickByName("Show Printer Menu Item");
|
||||
|
||||
if (!pinSettingsOpen)
|
||||
{
|
||||
// close the menu
|
||||
testRunner.ClickByName("Printer Overflow Menu");
|
||||
}
|
||||
}
|
||||
|
||||
return testRunner.ClickByName("Printer Tab");
|
||||
if (pinSettingsOpen)
|
||||
{
|
||||
return testRunner.ClickByName("Printer Tab");
|
||||
}
|
||||
else
|
||||
{
|
||||
return testRunner.ClickByName("Printer Sidebar");
|
||||
}
|
||||
}
|
||||
|
||||
public static void InlineTitleEdit(this AutomationRunner testRunner, string controlName, string replaceString)
|
||||
|
|
@ -1243,7 +1260,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
public static void SwitchToControlsTab(this AutomationRunner testRunner)
|
||||
{
|
||||
// Change to Printer Controls
|
||||
EnsurePrinterSidebarOpen(testRunner);
|
||||
OpenSettingsSidebar(testRunner);
|
||||
|
||||
if (!testRunner.NameExists("Controls Tab", 0.2))
|
||||
{
|
||||
|
|
@ -1261,7 +1278,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
public static void SwitchToTerminalTab(this AutomationRunner testRunner)
|
||||
{
|
||||
// Change to Printer Controls
|
||||
EnsurePrinterSidebarOpen(testRunner);
|
||||
OpenSettingsSidebar(testRunner);
|
||||
|
||||
if (!testRunner.NameExists("Terminal Tab", 0.2))
|
||||
{
|
||||
|
|
@ -1286,16 +1303,14 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
// TODO: Remove workaround needed to force GCode options to appear }}
|
||||
}
|
||||
|
||||
private static void EnsurePrinterSidebarOpen(AutomationRunner testRunner)
|
||||
public static void OpenSettingsSidebar(this AutomationRunner testRunner, bool pinOpen = true)
|
||||
{
|
||||
// If the sidebar exists, we need to expand and pin it
|
||||
if (testRunner.WaitForName("Slice Settings Sidebar", 0.2))
|
||||
testRunner.ClickByName("Slice Settings Sidebar");
|
||||
if (pinOpen
|
||||
&& UserSettings.Instance.get(UserSettingsKey.SliceSettingsTabPinned) != "true")
|
||||
{
|
||||
testRunner.ClickByName("Slice Settings Sidebar");
|
||||
if (UserSettings.Instance.get(UserSettingsKey.SliceSettingsTabPinned) != "true")
|
||||
{
|
||||
testRunner.ClickByName("Pin Settings Button");
|
||||
}
|
||||
testRunner.ClickByName("Pin Settings Button");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue