commit
bc9f526c39
3 changed files with 60 additions and 130 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 883160d3d769e23ba0f99466526adc2a0342eeb0
|
||||
Subproject commit be5a14436e63982ec3eaee7d0fee215fbf0e1747
|
||||
|
|
@ -10,186 +10,124 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class LibraryDownloadsTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsMultipleFiles()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest(testRunner =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(3);
|
||||
|
||||
testRunner.Delay(2);
|
||||
|
||||
// Add both files to the FileOpen dialog
|
||||
testRunner.Type(
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.CompleteDialog(
|
||||
string.Format(
|
||||
"\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")),
|
||||
5);
|
||||
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
|
||||
testRunner.Delay(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Fennec Fox item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Batman item exists");
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
// TODO: The standard assignment without a try/catch should be used and DeleteDownloadsSubFolder should be called from a TearDown method
|
||||
try
|
||||
{
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsAMFFiles()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest(testRunner =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
|
||||
// Add AMF part items to Downloads and then type paths into file dialog
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(2);
|
||||
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Rook.amf"), 4);
|
||||
|
||||
//Add AMF part items to Downloads and then type paths into file dialog
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
|
||||
testRunner.Delay(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf"), "Rook item exists");
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsZipFiles()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest(testRunner =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(2);
|
||||
|
||||
// Add AMF part items to Downloads and then type paths into file dialogs
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Test.zip"), 4);
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");
|
||||
|
||||
testRunner.Delay(1);
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Give MatterControl a moment to shutdown
|
||||
Thread.Sleep(2000);
|
||||
try
|
||||
{
|
||||
// Then attempt to clean up
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RenameDownloadsPrintItem()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest(testRunner =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(2);
|
||||
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Batman.stl"), 2);
|
||||
|
||||
//Rename added item
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.ClickByName("Row Item Batman");
|
||||
// Rename added item
|
||||
testRunner.ClickByName("Row Item Batman.stl");
|
||||
|
||||
testRunner.LibraryRenameSelectedItem();
|
||||
|
||||
testRunner.Delay(.5);
|
||||
testRunner.WaitForName("InputBoxPage Action Button");
|
||||
testRunner.Type("Batman Renamed");
|
||||
|
||||
testRunner.ClickByName("InputBoxPage Action Button");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed", 2));
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed.stl", 2));
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task CreateFolder()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest(testRunner =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
|
|
@ -198,26 +136,14 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
string newFolderName = "New Folder";
|
||||
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Delay(2);
|
||||
testRunner.WaitForName("InputBoxPage Action Button");
|
||||
testRunner.Type(newFolderName);
|
||||
testRunner.ClickByName("InputBoxPage Action Button");
|
||||
|
||||
testRunner.Delay(2);
|
||||
Assert.IsTrue(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists");
|
||||
Assert.IsTrue(testRunner.WaitForName(newFolderName + " Row Item Collection"), $"{newFolderName} exists");
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,6 +66,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
private static string runName = DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss");
|
||||
|
||||
public static string PathToDownloadsSubFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "-Temporary");
|
||||
|
||||
public static void RemoveAllFromQueue(this AutomationRunner testRunner)
|
||||
{
|
||||
testRunner.ClickByName("Queue... Menu");
|
||||
|
|
@ -75,17 +77,19 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
public static void CreateDownloadsSubFolder()
|
||||
{
|
||||
Directory.CreateDirectory(PathToDownloadsSubFolder);
|
||||
}
|
||||
|
||||
public static string PathToDownloadsSubFolder
|
||||
{
|
||||
get
|
||||
if (Directory.Exists(PathToDownloadsSubFolder))
|
||||
{
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "-Temporary");
|
||||
foreach (string filePath in Directory.GetFiles(PathToDownloadsSubFolder))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(PathToDownloadsSubFolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void DeleteDownloadsSubFolder()
|
||||
{
|
||||
Directory.Delete(PathToDownloadsSubFolder, true);
|
||||
|
|
@ -432,7 +436,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
/// </summary>
|
||||
/// <param name="testRunner">The TestRunner to interact with</param>
|
||||
/// <param name="textValue">The text to type</param>
|
||||
public static void CompleteDialog(this AutomationRunner testRunner, string textValue, int secondsToWait = 1)
|
||||
public static void CompleteDialog(this AutomationRunner testRunner, string textValue, double secondsToWait = 1)
|
||||
{
|
||||
// AutomationDialog requires no delay
|
||||
if (AggContext.FileDialogs is AutomationDialogProvider)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue