Test: Editing printer name changes droplist and persists

MatterHackers/MCCentral#381
This commit is contained in:
Greg 2016-09-13 12:02:54 -07:00
parent 2ceda33d62
commit 2efe180ae7
2 changed files with 66 additions and 0 deletions

View file

@ -66,6 +66,7 @@
<Compile Include="LocalLibraryTests.cs" />
<Compile Include="OptionsTabTests.cs" />
<Compile Include="PartPreviewTests.cs" />
<Compile Include="PrinterDropDownTests.cs" />
<Compile Include="PrintQueueTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SliceSetingsTests.cs" />

View file

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MatterHackers.Agg.UI;
using NUnit.Framework;
using MatterHackers.GuiAutomation;
using System.Text;
using System.Threading.Tasks;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.Tests.Automation
{
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class PrinterNameChangePersists
{
[Test, RequiresSTA, RunInApplicationDomain]
public void PrinterNameStaysChanged()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
testRunner.Wait(2);
testRunner.ClickByName("SettingsAndControls");
testRunner.ClickByName("Settings Tab");
resultsHarness.AddTestResult(testRunner.ClickByName("User Level Dropdown", 1));
resultsHarness.AddTestResult(testRunner.ClickByName("Advanced Menu Item", 1));
testRunner.Wait(.5);
resultsHarness.AddTestResult(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.Wait(5);
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests
}
}
}