mattercontrol/Tests/MatterControl.AutomationTests/SqLiteLibraryProvider.cs
John Lewin 879a2856d3 Extract automation tests to a separate assembly to ensure isolation/clean startup
- Fall back to English if translation data is missing, rather than crashing
 - Dump test name to console when running test harness to troubleshoot hangs
2015-12-13 17:29:01 -08:00

55 lines
No EOL
2.1 KiB
C#

using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.GuiAutomation;
using NUnit.Framework;
using System;
using System.IO;
namespace MatterHackers.MatterControl.UI
{
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class SqLiteLibraryProviderTests
{
[Test, RequiresSTA, RunInApplicationDomain]
public void LibraryQueueViewRefreshesOnAddItem()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
testRunner.ClickByName("Library Tab", 5);
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Edit", 3));
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
// wait for the copy to finish
testRunner.Wait(.1);
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Delete", 3), "Click Delete");
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");
testRunner.Wait(1);
testRunner.Type("Test Part");
resultsHarness.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));
// ensure that it is now in the library folder (that the folder updated)
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item " + "Test Part", 5), "The part we added sholud be in the library");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_One_Queue_No_Library");
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 8); // make sure we ran all our tests
}
}
}