Made the new tests run more generically

Made sure we close our windows in the best way to close the app
Made the paths point to files that should be present.
This commit is contained in:
larsbrubaker 2015-08-29 12:10:50 -07:00
parent 03c5f39776
commit 19e30a3619
4 changed files with 43 additions and 15 deletions

View file

@ -192,7 +192,6 @@ namespace MatterHackers.MatterControl.UI
DataFolderState state = new DataFolderState();
state.userDataPath = MatterHackers.MatterControl.DataStorage.ApplicationDataStorage.ApplicationUserDataPath;
state.renamedUserDataPath = Path.Combine(Path.GetDirectoryName(state.userDataPath), "-MatterControl");
string fullPathToDataContents = Path.Combine("..", "..", "..", "TestData", "TestDatabaseStates", testDBFolderName);
int testCount = 0;
while (Directory.Exists(state.renamedUserDataPath + testCount.ToString()))
@ -209,8 +208,9 @@ namespace MatterHackers.MatterControl.UI
state.undoDataRename = true;
}
if(testDBFolderName != null)
if (testDBFolderName != null)
{
string fullPathToDataContents = Path.Combine("..", "..", "..", "TestData", "TestDatabaseStates", testDBFolderName);
CopyTestDataDBFolderToTemporaryMCAppDataDirectory(fullPathToDataContents);
state.undoDataRename = true;
return state;

View file

@ -33,8 +33,14 @@ namespace MatterHackers.MatterControl.UI
resultsHarness.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");
testRunner.ClickByName("Show Terminal Button", 6);
bool terminalWindowExists2 = testRunner.WaitForName("Gcode Terminal", 3);
resultsHarness.AddTestResult(terminalWindowExists2 == true, "Terminal Window exists after Show Terminal button is clicked");
SystemWindow containingWindow;
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, secondsToWait: 3);
resultsHarness.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUITests.CloseMatterControl(testRunner);
}
};
@ -76,6 +82,8 @@ namespace MatterHackers.MatterControl.UI
testRunner.ClickByName("Configure Notification Settings Button", 6);
bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
resultsHarness.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
MatterControlUITests.CloseMatterControl(testRunner);
}
};

View file

@ -63,6 +63,7 @@ namespace MatterHackers.MatterControl.UI
bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10);
resultsHarness.AddTestResult(imageExists2 == true, "Web page is open");
MatterControlUITests.CloseMatterControl(testRunner);
}
};
@ -97,10 +98,15 @@ namespace MatterHackers.MatterControl.UI
resultsHarness.AddTestResult(pluginWindowExists1 == false, "Plugin window does not exist");
testRunner.ClickByName("Design Tool Button", 5);
//Test that the plugin window does exist after the create button is clicked
bool pluginWindowExists = testRunner.WaitForName("Plugin Chooser Window", 10);
resultsHarness.AddTestResult(pluginWindowExists == true, "Plugin window does exist");
//Test that the plugin window does exist after the create button is clicked
SystemWindow containingWindow;
GuiWidget pluginWindowExists = testRunner.GetWidgetByName("Plugin Chooser Window", out containingWindow, secondsToWait: 3);
resultsHarness.AddTestResult(pluginWindowExists != null, "Plugin Chooser Window");
pluginWindowExists.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUITests.CloseMatterControl(testRunner);
}
};
@ -137,9 +143,13 @@ namespace MatterHackers.MatterControl.UI
resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");
testRunner.ClickByName("Export Queue Button", 5);
bool exportWindowExists2 = testRunner.WaitForName( "Export Window Queue", 10);
resultsHarness.AddTestResult(exportWindowExists2 == true, "Export window does exist");
SystemWindow containingWindow;
GuiWidget exportWindow = testRunner.GetWidgetByName("Export Window Queue", out containingWindow, secondsToWait: 5);
resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
exportWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUITests.CloseMatterControl(testRunner);
}
};
@ -148,8 +158,11 @@ namespace MatterHackers.MatterControl.UI
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
bool showWindow;
string testDBFolder = "MC_Three_Queue_Items";
MatterControlUITests.DataFolderState staticDataState = MatterControlUITests.MakeNewStaticDataForTesting(testDBFolder);
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
MatterControlUITests.RestoreStaticDataAfterTesting(staticDataState, true);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
@ -172,6 +185,8 @@ namespace MatterHackers.MatterControl.UI
bool exportButtonExists = testRunner.WaitForName("Export Queue Button", 10);
testRunner.Wait(5);
resultsHarness.AddTestResult(exportButtonExists == false, "Export button is disabled");
MatterControlUITests.CloseMatterControl(testRunner);
}
};
@ -205,9 +220,14 @@ namespace MatterHackers.MatterControl.UI
resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");
testRunner.ClickByName("Queue Item Thumbnail");
bool partPreviewWindowExists2 = testRunner.WaitForName("Part Preview Window Thumbnail", 5);
resultsHarness.AddTestResult(partPreviewWindowExists2 == true, "Part Preview Window Exists");
SystemWindow containingWindow;
GuiWidget partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window Thumbnail", out containingWindow, secondsToWait: 3);
resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
partPreviewWindowExists.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUITests.CloseMatterControl(testRunner);
}
};

View file

@ -2,7 +2,7 @@
"ProjectFiles": [
{
"DateAdded": "2015-08-28T13:46:47.5050053-07:00",
"FileLocation": "C:\\Users\\Greg\\Desktop\\MatterSliceTestItems\\chichen-itza_pyramid.stl",
"FileLocation": "C:\\Development\\MatterControl\\Tests\\TestData\\TestDatabaseStates\\MC_Three_Queue_Items\\Library\\msdtarqp.amf",
"Name": "chichen-itza_pyramid",
"PrintCount": 0,
"PrintItemCollectionID": 0,
@ -12,7 +12,7 @@
},
{
"DateAdded": "2015-08-28T13:46:47.5200062-07:00",
"FileLocation": "C:\\Users\\Greg\\Desktop\\MatterSliceTestItems\\Chinese Dragon.stl",
"FileLocation": "C:\\Development\\MatterControl\\Tests\\TestData\\TestDatabaseStates\\MC_Three_Queue_Items\\Library\\msdtarqp.amf",
"Name": "Chinese Dragon",
"PrintCount": 0,
"PrintItemCollectionID": 0,
@ -22,7 +22,7 @@
},
{
"DateAdded": "2015-08-28T13:46:52.1092687-07:00",
"FileLocation": "C:\\Users\\Greg\\Desktop\\MatterSliceTestItems\\Fennec_Fox.stl",
"FileLocation": "C:\\Development\\MatterControl\\Tests\\TestData\\TestDatabaseStates\\MC_Three_Queue_Items\\Library\\msdtarqp.amf",
"Name": "Fennec_Fox",
"PrintCount": 0,
"PrintItemCollectionID": 0,