Add reusable CreateChildFolder method

This commit is contained in:
John Lewin 2018-10-05 14:21:55 -07:00
parent 1f110272dc
commit c3f55a40fd
3 changed files with 18 additions and 22 deletions

View file

@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
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
// Add AMF part items to Downloads and then type paths into file dialog
testRunner.InvokeLibraryAddDialog();
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Rook.amf"), 4);
@ -137,14 +137,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
string newFolderName = "New Folder";
testRunner.InvokeLibraryCreateFolderDialog();
testRunner.WaitForName("InputBoxPage Action Button");
testRunner.Type(newFolderName);
testRunner.ClickByName("InputBoxPage Action Button");
Assert.IsTrue(testRunner.WaitForName(newFolderName + " Row Item Collection"), $"{newFolderName} exists");
testRunner.CreateChildFolder("New Folder");
return Task.CompletedTask;
});

View file

@ -70,7 +70,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.DoubleClickByName("Batman Row Item Collection");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Batman part should exist after adding");
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2.stl"), "Mouthpiece part should exist after adding");
@ -118,19 +117,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Local Library Row Item Collection");
// Create New Folder
testRunner.InvokeLibraryCreateFolderDialog();
testRunner.Delay(.5);
string folderID = testRunner.CreateChildFolder("New Folder");
testRunner.Type("New Folder");
testRunner.Delay(.5);
testRunner.ClickByName("InputBoxPage Action Button");
testRunner.Delay(.2);
// Confirm newly created folder exists
Assert.IsTrue(testRunner.WaitForName("New Folder Row Item Collection"), "New folder should appear as GuiWidget");
testRunner.ClickByName("New Folder Row Item Collection");
testRunner.ClickByName(folderID);
testRunner.Delay(.2);
testRunner.LibraryRenameSelectedItem();

View file

@ -516,6 +516,20 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.ClickByName("Create Folder Menu Item");
}
public static string CreateChildFolder(this AutomationRunner testRunner, string folderName)
{
testRunner.InvokeLibraryCreateFolderDialog();
testRunner.WaitForName("InputBoxPage Action Button");
testRunner.Type(folderName);
testRunner.ClickByName("InputBoxPage Action Button");
string folderID = $"{folderName} Row Item Collection";
Assert.IsTrue(testRunner.WaitForName(folderID), $"{folderName} exists");
return folderID;
}
/// <summary>
/// Types the specified text into the dialog and sends {Enter} to complete the interaction
/// </summary>