Print Queue tests
This commit is contained in:
commit
28d76d981e
19 changed files with 239 additions and 259 deletions
|
|
@ -83,13 +83,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 1000);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
// NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable.
|
||||
// If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
|
||||
|
|
|
|||
|
|
@ -72,13 +72,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 10);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
|
|
|
|||
|
|
@ -44,16 +44,8 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Three_Queue_Items";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 45);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
|
|
@ -86,16 +78,8 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Three_Queue_Items";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 45);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,16 +70,10 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,13 +107,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
|
|
@ -156,16 +144,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Three_Queue_Items";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
|
||||
|
|
@ -193,16 +172,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Fresh_Installation";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 300);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Fresh_Installation");
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
|
||||
}
|
||||
|
|
@ -234,16 +204,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Three_Queue_Items";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 300);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
|
|
@ -289,16 +250,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Three_Queue_Items";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 300);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
|
|
@ -380,16 +332,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_Fresh_Installation";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 300);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Fresh_Installation");
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 6); // make sure we ran all our tests
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,16 +44,8 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
bool showWindow;
|
||||
string testDBFolder = "MC_One_Queue_No_Library";
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 45);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_One_Queue_No_Library");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 8); // make sure we ran all our tests
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace MatterControl.Tests
|
|||
[Test, RunInApplicationDomain]
|
||||
public void LibraryProviderSqlite_NavigationWorking()
|
||||
{
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting();
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting2();
|
||||
|
||||
LibraryProviderSQLite testProvider = new LibraryProviderSQLite(null, null, null, "Local Library");
|
||||
testProvider.DataReloaded += (sender, e) => { dataReloaded = true; };
|
||||
|
|
|
|||
|
|
@ -28,11 +28,14 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintLibrary.Provider;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
|
@ -99,7 +102,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
internal string renamedUserDataPath;
|
||||
}
|
||||
|
||||
public static DataFolderState MakeNewStaticDataForTesting(string testDBFolderName = null)
|
||||
public static DataFolderState MakeNewStaticDataForTesting2(string testDBFolderName = null)
|
||||
{
|
||||
DataFolderState state = new DataFolderState();
|
||||
state.userDataPath = MatterHackers.MatterControl.DataStorage.ApplicationDataStorage.ApplicationUserDataPath;
|
||||
|
|
@ -120,6 +123,14 @@ namespace MatterHackers.MatterControl.UI
|
|||
state.undoDataRename = true;
|
||||
}
|
||||
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
// Wait for up to some amount of time for the directory to be moved.
|
||||
while (!Directory.Exists(state.renamedUserDataPath)
|
||||
&& time.ElapsedMilliseconds < 1000)
|
||||
{
|
||||
Thread.Sleep(1); // make sure we are not eating all the cpu time.
|
||||
}
|
||||
|
||||
if (testDBFolderName != null)
|
||||
{
|
||||
string fullPathToDataContents = Path.Combine("..", "..", "..", "TestData", "TestDatabaseStates", testDBFolderName);
|
||||
|
|
@ -164,7 +175,18 @@ namespace MatterHackers.MatterControl.UI
|
|||
{
|
||||
Datastore.Instance.Exit();
|
||||
}
|
||||
Directory.Delete(state.userDataPath, true);
|
||||
Stopwatch timeTryingToDelete = Stopwatch.StartNew();
|
||||
while (Directory.Exists(state.userDataPath)
|
||||
&& timeTryingToDelete.Elapsed.TotalSeconds < 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(state.userDataPath, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
// Wait for up to some amount of time for the directory to be gone.
|
||||
while (Directory.Exists(state.userDataPath)
|
||||
|
|
@ -172,7 +194,10 @@ namespace MatterHackers.MatterControl.UI
|
|||
{
|
||||
Thread.Sleep(1); // make sure we are not eating all the cpu time.
|
||||
}
|
||||
Directory.Move(state.renamedUserDataPath, state.userDataPath);
|
||||
if (!Directory.Exists(state.userDataPath))
|
||||
{
|
||||
Directory.Move(state.renamedUserDataPath, state.userDataPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -192,5 +217,24 @@ namespace MatterHackers.MatterControl.UI
|
|||
File.Copy(fileName, newFileFullName, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static AutomationTesterHarness RunTest(Action<AutomationTesterHarness> testToRun, string testDbFolder = null, string staticDataPathOverride = null)
|
||||
{
|
||||
if (staticDataPathOverride == null)
|
||||
{
|
||||
staticDataPathOverride = Path.Combine("..", "..", "..", "..", "StaticData");
|
||||
}
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(staticDataPathOverride);
|
||||
#endif
|
||||
bool showWindow;
|
||||
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting2(testDbFolder);
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
|
||||
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||
|
||||
return testHarness;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue