mattercontrol/Tests/MatterControl.AutomationTests/PrinterDropDownTests.cs
John Lewin 0dc0621f62 Add helper methods to open/close Printers... menu
- Click ConnectionWizard->Skip if present and adding printers
2017-06-04 16:16:07 -07:00

51 lines
1.5 KiB
C#

using System;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.GuiAutomation;
using MatterHackers.MatterControl.SlicerConfiguration;
using NUnit.Framework;
namespace MatterHackers.MatterControl.Tests.Automation
{
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class PrinterNameChangePersists
{
[Test, Apartment(ApartmentState.STA)]
public async Task PrinterNameStaysChanged()
{
AutomationTest testToRun = (testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
testRunner.SwitchToAdvancedSliceSettings();
testRunner.ClickByName("Printer Tab", 1);
string widgetName = "Printer Name Edit";
testRunner.ClickByName(widgetName);
SystemWindow window;
var textWidget = testRunner.GetWidgetByName(widgetName, out window);
string newName = "Updated name";
textWidget.Text = newName;
testRunner.ClickByName("Printer Tab", 1);
testRunner.Delay(4);
//Check to make sure the Printer dropdown gets the name change
testRunner.OpenPrintersDropdown();
Assert.IsTrue(testRunner.WaitForName(newName + " Menu Item"), "Widget with updated printer name exists");
//Make sure the Active profile name changes as well
Assert.IsTrue(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");
return Task.CompletedTask;
};
await MatterControlUtilities.RunTest(testToRun);
}
}
}