Made AllParentsVisibleAndEnabled check the bounds are actually visible
Improving Automation Runner to user regions. Made and automation tester harness to make better testes easier Made the tests use the new harness.
This commit is contained in:
parent
5cc8a37269
commit
9f5885ab35
5 changed files with 76 additions and 80 deletions
|
|
@ -31,8 +31,10 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -65,65 +67,41 @@ namespace MatterHackers.MatterControl.UI
|
|||
public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
MatterControlApplication.AfterFirstDraw = () =>
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
{
|
||||
Task.Run(() =>
|
||||
AutomationRunner testRunner = new AutomationRunner();
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner();
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Test Text");
|
||||
testRunner.Wait(.5);
|
||||
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Test Text");
|
||||
testRunner.Wait(.5);
|
||||
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
|
||||
MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
|
||||
Assert.IsTrue(textWidgetMH != null);
|
||||
Assert.IsTrue(textWidgetMH.Text == "Test Text");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
CloseMatterControl(testRunner);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
SystemWindow mcWindow = MatterControlApplication.Instance;
|
||||
}
|
||||
|
||||
[Test, RequiresSTA, RunInApplicationDomain]
|
||||
public void ClearQueueTests()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
MatterControlApplication.AfterFirstDraw = () =>
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner();
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
RemoveAllFromQueue(testRunner);
|
||||
}
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
|
||||
MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
|
||||
resultsHarness.AddTestResult(textWidgetMH != null, "Found Text Widget");
|
||||
resultsHarness.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
CloseMatterControl(testRunner);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||
#endif
|
||||
SystemWindow mcWindow = MatterControlApplication.Instance;
|
||||
bool showWindow;
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 10);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue