Added more FileSystemProvider tests and refactored old code so that it is more readable

This commit is contained in:
Gregory Diaz 2016-01-13 17:02:41 -08:00
parent 2b5f3db10d
commit ebd10c395f
6 changed files with 270 additions and 149 deletions

View file

@ -0,0 +1,96 @@
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using NUnit.Framework;
using System;
using System.Linq;
using System.Threading.Tasks;
using MatterHackers.GuiAutomation;
using MatterHackers.Agg.PlatformAbstract;
using System.IO;
using MatterHackers.MatterControl.CreatorPlugins;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.DataStorage;
using System.Diagnostics;
using System.Collections.Generic;
using MatterHackers.MatterControl.UI;
namespace MatterControl.AutomationTests
{
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain, Ignore("Not Finished")]
public class ExportItemsFromDownloads
{
[Test, RequiresSTA, RunInApplicationDomain]
public void DownloadsExportButtonExportsGcode()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD");
string firstItemName = "Row Item " + "Batman";
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(2);
//Get parts to add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
//Get files to delete from Downloads once each test has completed and then add them to List
string firstFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsSubFolder, "Batman.stl");
//Add STL part items to Downloads and then type paths into file dialogue
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get test results
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
resultsHarness.AddTestResult(firstRowItemWasAdded == true);
testRunner.ClickByName("Library Edit Button");
testRunner.ClickByName(firstItemName);
testRunner.ClickByName("Library Export Button");
testRunner.Wait(2);
//testRunner.WaitForName("Export Item Window", 2);
testRunner.ClickByName("Export as GCode Button");
testRunner.Wait(2);
string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
testRunner.Type(gcodeExportPath);
testRunner.Type("{Enter}");
testRunner.Wait(2);
bool gcodeExported = false;
if (File.Exists(gcodeExportPath))
{
gcodeExported = true;
}
resultsHarness.AddTestResult(gcodeExported == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
//MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
}
}

View file

@ -15,13 +15,13 @@ using MatterHackers.MatterControl.DataStorage;
using System.Diagnostics;
using System.Collections.Generic;
using MatterHackers.MatterControl.UI;
using MatterHackers.MatterControl.PrintLibrary.Provider;
namespace MatterControl.MatterControl.UI
{
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class AddMultipleFilesToDownloads
{
List<string> addedFiles = new List<string>();
[Test, RequiresSTA, RunInApplicationDomain]
public void DownloadsAddButtonAddsMultipleFiles()
@ -29,58 +29,55 @@ namespace MatterControl.MatterControl.UI
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
string itemName = "Row Item " + "Fennec Fox";
string itemNameTwo = "Row Item " + "Batman";
MatterControlUtilities.CreateDownloadsSubFolder();
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(3);
//Get parts to add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string secondRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");
//Get files to delete from Downloads once each test has completed and then add them to List
string firstFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Fennec_Fox.stl");
string secondFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Batman.stl");
addedFiles.Add(firstFileToDelete);
addedFiles.Add(secondFileToDelete);
//Format text to add both items to Downloads and then type paths into file dialogues
string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", rowItemPath, secondRowItemPath);
string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
testRunner.Wait(2);
testRunner.Type(textForBothRowItems);
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get test results
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
resultsHarness.AddTestResult(rowItemWasAdded == true);
bool secondRowItemWasAdded = testRunner.WaitForName(itemNameTwo, 2);
resultsHarness.AddTestResult(secondRowItemWasAdded == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2) == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);
AutomationTesterHarness testHarness = null;
try
{
testHarness = MatterControlUtilities.RunTest(testToRun);
}
catch { }
finally
{
MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
}
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
}
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class AddAMFToDownloads
{
List<string> addedFiles = new List<string>();
[Test, RequiresSTA, RunInApplicationDomain]
public void DownloadsAddButtonAddsAMFFiles()
@ -91,39 +88,42 @@ namespace MatterControl.MatterControl.UI
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
string itemName = "Row Item " + "Rook";
MatterControlUtilities.CreateDownloadsSubFolder();
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(3);
//Get parts to add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Rook.amf");
//Get files to delete from Downloads once each test has completed and then add them to List
string firstFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Rook.amf");
addedFiles.Add(firstFileToDelete);
testRunner.Wait(2);
//Add AMF part items to Downloads and then type paths into file dialogues
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get test results
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
resultsHarness.AddTestResult(rowItemWasAdded == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Rook", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);
AutomationTesterHarness testHarness = null;
try
{
testHarness = MatterControlUtilities.RunTest(testToRun);
}
catch { }
finally
{
MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
}
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
Assert.IsTrue(testHarness.TestCount == 1);
}
}
@ -131,7 +131,6 @@ namespace MatterControl.MatterControl.UI
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class AddZipFileToDownloads
{
List<string> addedFiles = new List<string>();
[Test, RequiresSTA, RunInApplicationDomain]
public void DownloadsAddButtonAddsZipFiles()
@ -141,132 +140,155 @@ namespace MatterControl.MatterControl.UI
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.CreateDownloadsSubFolder();
string firstItemName = "Row Item " + "Chinese Dragon";
string secondItemName = "Row Item " + "chichen-itza pyramid";
string thirdItemName = "Row Item " + "Circle Calibration";
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(3);
//Get parts to add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Test.zip");
//Get files to delete from Downloads once each test has completed and then add them to List
string firstFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Circle Calibration.stl");
string secondFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Chinese Dragon.stl");
string thirdFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "chichen-itza_pyramid.stl");
addedFiles.Add(firstFileToDelete);
addedFiles.Add(secondFileToDelete);
addedFiles.Add(thirdFileToDelete);
testRunner.Wait(2);
//Add AMF part items to Downloads and then type paths into file dialogues
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip"));
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get test results
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
resultsHarness.AddTestResult(firstRowItemWasAdded == true);
bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
resultsHarness.AddTestResult(secondRowItemWasAdded == true);
bool thirdRowItemWasAdded = testRunner.WaitForName(thirdItemName, 2);
resultsHarness.AddTestResult(thirdRowItemWasAdded == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2) == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2) == true);
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);
AutomationTesterHarness testHarness = null;
try
{
testHarness = MatterControlUtilities.RunTest(testToRun);
}
catch { }
finally
{
MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
}
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests
Assert.IsTrue(testHarness.TestCount == 3);
}
}
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain, Ignore("Not Finished")]
public class ExportItemsFromDownloads
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class RenameDownloadsItem
{
List<string> addedFiles = new List<string>();
[Test, RequiresSTA, RunInApplicationDomain]
public void DownloadsExportButtonExportsGcode()
public void RenameDownloadsPrintItem()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.CreateDownloadsSubFolder();
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD");
string firstItemName = "Row Item " + "Batman";
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(2);
//Get parts to add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");
//Get files to delete from Downloads once each test has completed and then add them to List
string firstFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Batman.stl");
addedFiles.Add(firstFileToDelete);
//Add STL part items to Downloads and then type paths into file dialogue
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
testRunner.Wait(1);
testRunner.Type("{Enter}");
//Get test results
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
resultsHarness.AddTestResult(firstRowItemWasAdded == true);
testRunner.ClickByName("Library Edit Button");
testRunner.ClickByName(firstItemName);
testRunner.ClickByName("Library Export Button");
//Rename added item
testRunner.ClickByName("Library Edit Button", 2);
testRunner.ClickByName("Row Item Batman");
testRunner.ClickByName("Rename From Library Button", 2);
testRunner.Wait(2);
//testRunner.WaitForName("Export Item Window", 2);
testRunner.ClickByName("Export as GCode Button");
testRunner.Wait(2);
string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
testRunner.Type(gcodeExportPath);
testRunner.Type("{Enter}");
testRunner.Wait(2);
bool gcodeExported = false;
if (File.Exists(gcodeExportPath))
{
gcodeExported = true;
}
resultsHarness.AddTestResult(gcodeExported == true);
testRunner.Type("Batman Renamed");
testRunner.ClickByName("Rename Button");
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = null;
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);
try
{
testHarness = MatterControlUtilities.RunTest(testToRun);
}
catch { }
finally
{
MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
}
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
Assert.IsTrue(testHarness.TestCount == 1);
}
}
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
public class CreateSubFolderLibraryDownloads
{
[Test, RequiresSTA, RunInApplicationDomain]
public void CreateFolder()
{
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.CreateDownloadsSubFolder();
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
testRunner.ClickByName("Create Folder From Library Button");
testRunner.Wait(2);
testRunner.Type("New Folder");
testRunner.ClickByName("Create Folder Button");
testRunner.Wait(2);
resultsHarness.AddTestResult(testRunner.WaitForName("New Folder Row Item Collection", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = null;
try
{
testHarness = MatterControlUtilities.RunTest(testToRun);
}
catch { }
finally
{
MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
}
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1);
}
}
}

View file

@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Library Add Button");
//Get Library Item to Add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
@ -95,8 +95,8 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Library Add Button");
//Get Library Item to Add
string firstRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string secondRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");
string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
testRunner.Wait(2);
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Library Add Button");
//Get Library Item to Add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Rook.amf");
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
@ -199,7 +199,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Library Add Button");
//Get Library Item to Add
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Batman.zip");
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip");
testRunner.Wait(2);
testRunner.Type(rowItemPath);
testRunner.Wait(1);
@ -421,7 +421,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Library Edit Button");
testRunner.Wait(1);
string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(2);
@ -543,7 +543,7 @@ namespace MatterHackers.MatterControl.UI
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
//Add an item to the library
string libraryItemToAdd = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.ClickByName("Library Add Button");
testRunner.Wait(2);

View file

@ -62,6 +62,7 @@
</Compile>
<Compile Include="CheckBoxInLibraryIsClickable.cs" />
<Compile Include="CreateLibraryFolder.cs" />
<Compile Include="ExportItemWindowTests.cs" />
<Compile Include="LibraryDownloadsTest.cs" />
<Compile Include="LocalLibraryTests.cs" />
<Compile Include="OptionsTabTests.cs" />

View file

@ -309,7 +309,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Queue Add Button", 2);
testRunner.Wait(2);
string queueItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.Type(queueItemPath);
testRunner.Wait(1);
@ -371,9 +371,9 @@ namespace MatterHackers.MatterControl.UI
//Click Add Button and Add Part To Queue
testRunner.ClickByName("Queue Add Button", 2);
string pathToFirstQueueItem = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
string pathToFirstQueueItem = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.Wait(1);
string pathToSecondQueueItem = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");
string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
string textForBothQueueItems = String.Format("\"{0}\" \"{1}\"", pathToFirstQueueItem, pathToSecondQueueItem);
testRunner.Type(textForBothQueueItems);
@ -696,7 +696,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.Wait(2);
//Type in Absolute Path to Save
string exportZipPath = MatterControlUtilities.PathToQueueItemsFolder("TestExportZip");
string exportZipPath = MatterControlUtilities.GetTestItemPath("TestExportZip");
// Ensure file does not exist before save
if(File.Exists(exportZipPath))
@ -909,7 +909,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName(" Create Part Sheet Menu Item", 2);
testRunner.Wait(2);
string pathToSavePartSheet = MatterControlUtilities.PathToQueueItemsFolder("CreatePartSheet");
string pathToSavePartSheet = MatterControlUtilities.GetTestItemPath("CreatePartSheet");
string validatePartSheetPath = Path.Combine("..", "..", "..", "TestData", "QueueItems", "CreatePartSheet.pdf");
testRunner.Type(pathToSavePartSheet);
@ -1051,7 +1051,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.Wait(1);
string pathToType = MatterControlUtilities.PathToQueueItemsFolder("Batman.zip");
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
testRunner.Type(pathToType);
testRunner.Wait(1);
testRunner.Type("{Enter}");
@ -1120,7 +1120,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Queue Add Button", 2);
testRunner.Wait(1);
string pathToType = MatterControlUtilities.PathToQueueItemsFolder("Rook.amf");
string pathToType = MatterControlUtilities.GetTestItemPath("Rook.amf");
testRunner.Type(pathToType);
testRunner.Wait(1);
@ -1186,7 +1186,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Queue Add Button", 2);
testRunner.Wait(1);
string pathToType = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.stl");
testRunner.Type(pathToType);
testRunner.Wait(1);
@ -1250,7 +1250,7 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Queue Add Button", 2);
testRunner.Wait(1);
string pathToType = MatterControlUtilities.PathToQueueItemsFolder("chichen-itza_pyramid.gcode");
string pathToType = MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode");
testRunner.Type(pathToType);
testRunner.Wait(1);

View file

@ -70,20 +70,33 @@ namespace MatterHackers.MatterControl.UI
}
}
public static string PathToDownloadsFolder
public static void CreateDownloadsSubFolder()
{
Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "Temporary"));
}
public static string PathToDownloadsSubFolder
{
get
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "Temporary");
}
}
public static void CleanupDownloadsDirectory(string path)
{
Directory.Delete(path, true);
}
public static string PathToExportGcodeFolder
{
get { return Path.GetFullPath(Path.Combine("..", "..", "..", "..", "Tests", "TestData", "ExportedGcode", runName)); }
}
public static string PathToQueueItemsFolder(string queueItemToLoad)
public static string GetTestItemPath(string queueItemToLoad)
{
string pathToQueueItemFolder = Path.Combine("..", "..", "..", "..", "Tests", "TestData", "QueueItems");
return Path.GetFullPath(Path.Combine(pathToQueueItemFolder, queueItemToLoad));
@ -150,17 +163,6 @@ namespace MatterHackers.MatterControl.UI
}
}
public static void CleanUpDownloadsDirectoryAfterTest(List<string> filesToDelete)
{
foreach(var filePath in filesToDelete)
{
if(File.Exists(filePath))
{
File.Delete(filePath);
}
}
}
private static void OutputImages(GuiWidget control, GuiWidget test)
{
OutputImage(control, "image-control.tga");