本文整理汇总了C#中MatterHackers.GuiAutomation.AutomationRunner类的典型用法代码示例。如果您正苦于以下问题:C# AutomationRunner类的具体用法?C# AutomationRunner怎么用?C# AutomationRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutomationRunner类属于MatterHackers.GuiAutomation命名空间,在下文中一共展示了AutomationRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWidgetByNameTestRegionSingleWindow
public void GetWidgetByNameTestRegionSingleWindow()
{
int leftClickCount = 0;
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner();
testRunner.ClickByName("left");
testRunner.Wait(.5);
resultsHarness.AddTestResult(leftClickCount == 1, "Got left button click");
SearchRegion rightButtonRegion = testRunner.GetRegionByName("right");
testRunner.ClickByName("left", searchRegion: rightButtonRegion);
testRunner.Wait(.5);
resultsHarness.AddTestResult(leftClickCount == 1, "Did not get left button click");
};
SystemWindow buttonContainer = new SystemWindow(300, 200);
Button leftButton = new Button("left", 10, 40);
leftButton.Name = "left";
leftButton.Click += (sender, e) => { leftClickCount++; };
buttonContainer.AddChild(leftButton);
Button rightButton = new Button("right", 110, 40);
rightButton.Name = "right";
buttonContainer.AddChild(rightButton);
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we can all our tests
}
示例2: ClickCreateButton
//Test Works
public void ClickCreateButton()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
// Tests that clicking the create button opens create tools plugin window
MatterControlUtilities.PrepForTestRun(testRunner);
//Make sure that plugin window does not exist
bool pluginWindowExists1 = testRunner.WaitForName("Plugin Chooser Window", 0);
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
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);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
示例3: UiAutomationTests
public void UiAutomationTests()
{
// Run a copy of MatterControl
bool firstDraw = true;
MatterControlApplication.AfterFirstDraw = () =>
{
if (firstDraw)
{
firstDraw = false;
Task.Run(() =>
{
AutomationRunner testRunner = new AutomationRunner("");
testRunner.Wait(2);
// Now do the actions specific to this test. (replace this for new tests)
{
RemoveAllFromQueue(testRunner);
}
MatterControlApplication.Instance.CloseOnIdle();
});
}
};
#if !__ANDROID__
// Set the static data to point to the directory of MatterControl
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", ".."));
#endif
SystemWindow mcWindow = MatterControlApplication.Instance;
}
示例4: ClickingShowTerminalButtonOpensTerminal
public void ClickingShowTerminalButtonOpensTerminal()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.Wait(2);
testRunner.ClickByName("Options Tab", 6);
bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
resultsHarness.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");
testRunner.ClickByName("Show Terminal Button", 6);
testRunner.Wait(1);
SystemWindow containingWindow;
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
resultsHarness.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
示例5: FileMenuAddPrinter
public void FileMenuAddPrinter()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add Printer Menu Item");
testRunner.Wait(1);
resultsHarness.AddTestResult(testRunner.WaitForName("Printer Connection Window", 3));
testRunner.ClickByName("Setup Connection Cancel Button");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
}
示例6: CreateFolderStarsOutWithTextFiledFocusedAndEditable
public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Create Folder From Library Button");
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;
resultsHarness.AddTestResult(textWidgetMH != null, "Found Text Widget");
resultsHarness.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
containingWindow.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed(2));
}
示例7: AddToQueueMenuItemAddsSingleFile
public void AddToQueueMenuItemAddsSingleFile()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add File To Queue Menu Item");
testRunner.Wait(2);
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
testRunner.Type(queueItemPath);
testRunner.Wait(1);
testRunner.Type("{Enter}");
testRunner.Wait(2);
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
int queueCount = QueueData.Instance.Count;
resultsHarness.AddTestResult(queueCount == 1);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
示例8: ClickOnBuyButton
public void ClickOnBuyButton()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
//Make sure image does not exist before we click the buy button
testRunner.MatchLimit = 500000;
bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png");
resultsHarness.AddTestResult(imageExists == false, "Web page is not open");
//Click Buy button and test that the MatterHackers store web page is open
testRunner.ClickByName("Buy Materials Button", 5);
bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10);
resultsHarness.AddTestResult(imageExists2 == true, "Web page is open");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
示例9: FileMenuAddPrinter
public void FileMenuAddPrinter()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
testRunner.ClickByName("Add Printer Menu Item");
testRunner.Wait(1);
resultsHarness.AddTestResult(testRunner.WaitForName("Select Make", 3));
testRunner.ClickByName("Cancel Wizard Button");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
Assert.IsTrue(testHarness.AllTestsPassed(1));
}
示例10: ClickOnBuyButton
public void ClickOnBuyButton()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
{
//Make sure image does not exist before we click the buy button
testRunner.MatchLimit = 500000;
bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png");
resultsHarness.AddTestResult(imageExists == false, "Web page is not open");
//Click Buy button and test that the MatterHackers store web page is open
testRunner.ClickByName("Buy Materials Button", secondsToWait: 5);
bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10);
resultsHarness.AddTestResult(imageExists2 == true, "Web page is open");
MatterControlUITests.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
bool showWindow;
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
}
示例11: RemoveAllFromQueue
void RemoveAllFromQueue(AutomationRunner testRunner)
{
Assert.IsTrue(testRunner.ClickByName("Queue... Menu"));
testRunner.Wait(.2);
Assert.IsTrue(testRunner.ClickByName(" Remove All Menu Item"));
testRunner.Wait(.2);
}
示例12: ClickingConfigureNotificationSettingsButtonOpensWindow
//DOES NOT WORK
public void ClickingConfigureNotificationSettingsButtonOpensWindow()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.ClickByName("Options Tab", 6);
bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
resultsHarness.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
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");
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
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
}
示例13: SoftwareLevelingRequiredCorrectWorkflow
public void SoftwareLevelingRequiredCorrectWorkflow()
{
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
// make a jump start printer
var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1");
// make sure it is showing the correct button
resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
// do print leveling
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
for (int i = 0; i < 3; i++)
{
testRunner.ClickByName("Move Z positive", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
testRunner.ClickByName("Next Button", .5);
}
resultsHarness.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button");
// make sure the button has changed to start print
resultsHarness.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing");
resultsHarness.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden");
// reset to defaults and make sure print leveling is cleared
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
resultsHarness.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options" );
resultsHarness.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
resultsHarness.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
testRunner.Wait(1);
// make sure it is showing the correct button
resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
MatterControlUtilities.CloseMatterControl(testRunner);
try
{
emualtorProccess.Kill();
}
catch { }
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed(12));
}
示例14: HighlightWidget
private static void HighlightWidget(AutomationRunner testRunner, string widgetNameToHighlight)
{
SystemWindow containingWindow;
var autoLevelRowItem = testRunner.GetWidgetByName(widgetNameToHighlight, out containingWindow, .2);
if (autoLevelRowItem != null)
{
AttentionGetter.GetAttention(autoLevelRowItem);
}
}
示例15: CopyButtonClickedMakesCopyOfPartOnBed
public void CopyButtonClickedMakesCopyOfPartOnBed()
{
// Run a copy of MatterControl
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.Wait(1);
testRunner.ClickByName("Row Item Calibration - Box");
testRunner.ClickByName("Row Item Calibration - Box View Button");
testRunner.Wait(1);
//Get View3DWidget and count MeshGroups before Copy button is clicked
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
View3DWidget view3D = partPreview as View3DWidget;
string copyButtonName = "3D View Copy";
//Click Edit button to make edit controls visible
testRunner.ClickByName("3D View Edit");
testRunner.Wait(1);
int partCountBeforeCopy = view3D.MeshGroups.Count();
resultsHarness.AddTestResult(partCountBeforeCopy == 1);
//Click Copy button and count MeshGroups
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterCopy = view3D.MeshGroups.Count();
resultsHarness.AddTestResult(partCountAfterCopy == 2);
testRunner.Wait(1);
//Click Copy button a second time and count MeshGroups again
testRunner.ClickByName(copyButtonName);
System.Threading.Thread.Sleep(500);
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
resultsHarness.AddTestResult(partCountAfterSecondCopy == 3);
view3D.CloseOnIdle();
testRunner.Wait(.5);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
Assert.IsTrue(testHarness.AllTestsPassed(3));
}