mattercontrol/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs

62 lines
1.8 KiB
C#
Raw Normal View History

2017-10-30 23:05:38 -07:00
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
namespace MatterHackers.MatterControl.Tests.Automation
{
[TestFixture, Category("Agg.UI.Automation"), Apartment(ApartmentState.STA), RunInApplicationDomain]
public class ExportGcodeFromExportWindow
{
[Test]
public async Task ExportAsGcode()
{
2017-10-30 23:05:38 -07:00
await MatterControlUtilities.RunTest(testRunner =>
{
testRunner.WaitForFirstDraw();
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
2016-10-19 11:10:30 -07:00
//Navigate to Downloads Library Provider
2017-08-30 13:41:49 -07:00
testRunner.NavigateToFolder("Print Queue Row Item Collection");
testRunner.InvokeLibraryAddDialog();
2016-10-19 11:10:30 -07:00
//Get parts to add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
//Add STL part items to Downloads and then type paths into file dialog
2017-02-01 10:12:31 -08:00
testRunner.Delay(1);
2016-10-19 11:10:30 -07:00
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
2017-02-01 10:12:31 -08:00
testRunner.Delay(1);
2016-10-19 11:10:30 -07:00
testRunner.Type("{Enter}");
2016-10-19 11:10:30 -07:00
//Get test results
2017-08-30 13:41:49 -07:00
testRunner.ClickByName("Row Item Batman.stl");
2017-08-30 13:41:49 -07:00
testRunner.ClickByName("Print Library Overflow Menu");
testRunner.ClickByName("Export Menu Item");
2017-02-01 10:12:31 -08:00
testRunner.Delay(2);
testRunner.WaitForName("Export Item Window");
2017-08-30 13:41:49 -07:00
testRunner.ClickByName("Machine File (G-Code) Button");
testRunner.ClickByName("Export Button");
2017-02-01 10:12:31 -08:00
testRunner.Delay(2);
string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
Directory.CreateDirectory(gcodeOutputPath);
string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");
testRunner.Type(fullPathToGcodeFile);
2016-10-19 11:10:30 -07:00
testRunner.Type("{Enter}");
testRunner.WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);
2017-06-27 14:45:15 -07:00
return Task.FromResult(0);
2017-10-30 23:05:38 -07:00
});
}
}
}