2017-10-30 23:05:38 -07:00
|
|
|
|
using System.IO;
|
2016-09-21 15:34:53 -07:00
|
|
|
|
using System.Threading;
|
2016-10-25 06:17:37 -07:00
|
|
|
|
using System.Threading.Tasks;
|
2016-09-21 15:34:53 -07:00
|
|
|
|
using NUnit.Framework;
|
2016-05-11 09:13:56 -07:00
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl.Tests.Automation
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2018-04-30 15:40:47 -07:00
|
|
|
|
[TestFixture, Category("Agg.UI.Automation"), Apartment(ApartmentState.STA), RunInApplicationDomain]
|
2016-12-02 11:36:23 -08:00
|
|
|
|
public class ExportGcodeFromExportWindow
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2018-04-30 15:40:47 -07:00
|
|
|
|
[Test]
|
2016-10-25 06:17:37 -07:00
|
|
|
|
public async Task ExportAsGcode()
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2017-10-30 23:05:38 -07:00
|
|
|
|
await MatterControlUtilities.RunTest(testRunner =>
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2018-02-08 15:42:07 -08:00
|
|
|
|
testRunner.WaitForFirstDraw();
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-06-04 09:01:56 -07:00
|
|
|
|
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
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");
|
2018-04-07 11:21:02 -07:00
|
|
|
|
testRunner.InvokeLibraryAddDialog();
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Get parts to add
|
|
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-25 06:17:37 -07:00
|
|
|
|
//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-01-13 17:02:41 -08:00
|
|
|
|
|
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");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
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);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-06-14 10:05:39 -07:00
|
|
|
|
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);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
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}");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-12-15 19:28:25 -08:00
|
|
|
|
testRunner.WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);
|
2016-10-25 06:17:37 -07:00
|
|
|
|
|
2017-06-27 14:45:15 -07:00
|
|
|
|
return Task.FromResult(0);
|
2017-10-30 23:05:38 -07:00
|
|
|
|
});
|
2016-01-13 17:02:41 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|