mattercontrol/Tests/MatterControl.AutomationTests/SqLiteLibraryProvider.cs

64 lines
2 KiB
C#
Raw Normal View History

using System;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.UI.Tests;
2015-09-01 16:03:29 -07:00
using MatterHackers.GuiAutomation;
using MatterHackers.MatterControl.PartPreviewWindow;
2015-09-01 16:03:29 -07:00
using NUnit.Framework;
namespace MatterHackers.MatterControl.Tests.Automation
2015-09-01 16:03:29 -07:00
{
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
2015-09-01 16:03:29 -07:00
public class SqLiteLibraryProviderTests
{
[Test, Apartment(ApartmentState.STA)]
public async Task LibraryQueueViewRefreshesOnAddItem()
2015-09-01 16:03:29 -07:00
{
AutomationTest testToRun = (testRunner) =>
2015-09-01 16:03:29 -07:00
{
testRunner.CloseSignInAndPrinterSelect();
2016-10-19 11:10:30 -07:00
testRunner.ClickByName("Library Tab", 5);
2015-09-01 16:03:29 -07:00
testRunner.NavigateToFolder("Local Library Row Item Collection");
2016-10-19 11:10:30 -07:00
testRunner.Wait(1);
testRunner.ClickByName("Row Item Calibration - Box");
testRunner.ClickByName("Row Item Calibration - Box View Button");
testRunner.Wait(1);
2016-10-19 11:10:30 -07:00
SystemWindow systemWindow;
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
View3DWidget view3D = partPreview as View3DWidget;
2015-09-01 16:03:29 -07:00
testRunner.ClickByName("3D View Edit", 3);
2015-09-01 16:03:29 -07:00
testRunner.ClickByName("3D View Copy", 3);
2016-10-19 11:10:30 -07:00
// wait for the copy to finish
testRunner.Wait(.1);
testRunner.ClickByName("3D View Remove", 3);
testRunner.ClickByName("Save As Menu", 3);
testRunner.ClickByName("Save As Menu Item", 3);
2015-09-01 16:03:29 -07:00
2016-10-19 11:10:30 -07:00
testRunner.Wait(1);
2016-10-19 11:10:30 -07:00
testRunner.Type("0Test Part");
testRunner.NavigateToFolder("Local Library Row Item Collection");
2015-09-01 16:03:29 -07:00
testRunner.ClickByName("Save As Save Button", 1);
2016-10-19 11:10:30 -07:00
view3D.CloseOnIdle();
testRunner.Wait(.5);
2016-10-19 11:10:30 -07:00
// ensure that it is now in the library folder (that the folder updated)
2016-11-03 08:46:08 -07:00
Assert.IsTrue(testRunner.WaitForName("Row Item 0Test Part", 5), "The part we added should be in the library");
2016-10-19 11:10:30 -07:00
testRunner.Wait(.5);
return Task.FromResult(0);
2015-09-01 16:03:29 -07:00
};
await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
2015-09-01 16:03:29 -07:00
}
}
}