public void ClickOnLibraryCheckBoxes() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages); // Now do the actions specific to this test. (replace this for new tests) { testRunner.ClickByName("Library Tab"); testRunner.Wait(1); SystemWindow systemWindow; GuiWidget rowItem = testRunner.GetWidgetByName("Local Library Row Item Collection", out systemWindow); testRunner.Wait(1); SearchRegion rowItemRegion = testRunner.GetRegionByName("Local Library Row Item Collection"); testRunner.ClickByName("Library Edit Button"); testRunner.Wait(1); SystemWindow containingWindow; GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out containingWindow, searchRegion: rowItemRegion); CheckBox checkBoxWidget = foundWidget as CheckBox; resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox"); resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked"); testRunner.ClickByName("Row Item Select Checkbox", searchRegion: rowItemRegion); testRunner.Wait(.5); resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked"); testRunner.ClickByName("Local Library Row Item Collection"); testRunner.Wait(.5); resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked"); 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, 1000); // 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. Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests }
public void ClickOnLibraryCheckBoxes() { // 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) { testRunner.ClickByName("Library Tab", 3); MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"); SystemWindow systemWindow; string itemName = "Row Item " + "Calibration - Box"; GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3); SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3); testRunner.ClickByName("Library Edit Button", 3); testRunner.Wait(.5); SystemWindow containingWindow; GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out containingWindow, 3, searchRegion: rowItemRegion); CheckBox checkBoxWidget = foundWidget as CheckBox; resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox"); resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked"); testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion); testRunner.ClickByName("Library Tab"); resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked"); testRunner.ClickByName(itemName, 3); testRunner.ClickByName("Library Tab"); resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked"); MatterControlUtilities.CloseMatterControl(testRunner); } }; 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. Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests }
//This is Temporary and will probably be moved once we get a functional test harness!!! public static bool NavigateToFolder(AutomationRunner testRunner, string libraryRowItemName) { bool goodNavigate = true; SearchRegion libraryRowItemRegion = testRunner.GetRegionByName(libraryRowItemName, 3); goodNavigate &= testRunner.ClickByName(libraryRowItemName); goodNavigate &= testRunner.MoveToByName(libraryRowItemName); testRunner.Wait(.5); goodNavigate &= testRunner.ClickByName("Open Collection", searchRegion: libraryRowItemRegion); testRunner.Wait(.5); return goodNavigate; }
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 }
public void DoneButtonTurnsOffEditMode() { //Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* *Tests that when one item is selected *1. Queue Item count equals three before the test starts *2. Selecting multiple queue itema and then clicking the Remove button removes the item *3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one */ int queueItemCount = QueueData.Instance.Count; bool queueItemCountEqualThree = false; if (queueItemCount == 3) { queueItemCountEqualThree = true; } resultsHarness.AddTestResult(queueItemCountEqualThree == true); testRunner.Wait(2); string itemName = "Queue Item " + "2013-01-25_Mouthpiece_v2"; SystemWindow systemWindow; GuiWidget queueItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3); SearchRegion queueItemRegion = testRunner.GetRegionByName(itemName, 3); testRunner.ClickByName("Queue Edit Button", 2); testRunner.Wait(5); GuiWidget foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out systemWindow, 3, searchRegion: queueItemRegion); foundWidget.DebugShowBounds = true; CheckBox checkBoxWidget = foundWidget as CheckBox; resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox"); testRunner.Wait(2); testRunner.ClickByName("Queue Done Button"); testRunner.Wait(3); foundWidget.DebugShowBounds = true; resultsHarness.AddTestResult(foundWidget == null, "We should not have an actual checkbox"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests }
//This is Temporary and will probably be moved once we get a functional test harness!!! public static void NavigateToFolder(AutomationRunner testRunner, string libraryRowItemName) { SearchRegion libraryRowItemRegion = testRunner.GetRegionByName(libraryRowItemName, 3); testRunner.ClickByName(libraryRowItemName); testRunner.MoveToByName(libraryRowItemName); testRunner.Wait(.5); testRunner.ClickByName("Open Collection", searchRegion: libraryRowItemRegion); testRunner.Wait(.5); }
public void EditButtonTurnsOnEditMode() { //Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { /* *Tests that when the edit button is clicked we go into editmode (print queue items have checkboxes on them) *1. After Edit button is clicked print queue items have check boxes *2. Selecting multiple queue itema and then clicking the Remove button removes the item *3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one */ bool checkboxExists = testRunner.WaitForName("Queue Item Checkbox", 2); resultsHarness.AddTestResult(checkboxExists == false); int queueItemCount = QueueData.Instance.Count; bool queueItemCountEqualThree = false; if (queueItemCount == 3) { queueItemCountEqualThree = true; } resultsHarness.AddTestResult(queueItemCountEqualThree == true); testRunner.Wait(2); SystemWindow systemWindow; string itemName = "Queue Item " + "2013-01-25_Mouthpiece_v2"; GuiWidget queueItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3); SearchRegion queueItemRegion = testRunner.GetRegionByName(itemName, 3); testRunner.ClickByName("Queue Edit Button", 2); testRunner.Wait(5); SystemWindow containingWindow; GuiWidget foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out containingWindow, 3, searchRegion: queueItemRegion); CheckBox checkBoxWidget = foundWidget as CheckBox; resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, null, null, "Three_Queue_Items"); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests }
public void EditButtonTurnsOnOffEditMode() { //Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { MatterControlUtilities.PrepForTestRun(testRunner); /* *Tests that when the edit button is clicked we go into editmode (print queue items have checkboxes on them) *1. After Edit button is clicked print queue items have check boxes *2. Selecting multiple queue itema and then clicking the Remove button removes the item *3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one */ bool checkboxExists = testRunner.WaitForName("Queue Item Checkbox", 2); resultsHarness.AddTestResult(checkboxExists == false); resultsHarness.AddTestResult(QueueData.Instance.Count == 4); SystemWindow systemWindow; string itemName = "Queue Item " + "2013-01-25_Mouthpiece_v2"; GuiWidget queueItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3); SearchRegion queueItemRegion = testRunner.GetRegionByName(itemName, 3); { testRunner.ClickByName("Queue Edit Button", 2); SystemWindow containingWindow; GuiWidget foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out containingWindow, 3, searchRegion: queueItemRegion); resultsHarness.AddTestResult(foundWidget != null, "We should have an actual checkbox"); } { testRunner.ClickByName("Queue Done Button", 2); testRunner.Wait(.5); SystemWindow containingWindow; GuiWidget foundWidget = testRunner.GetWidgetByName("Queue Item Checkbox", out containingWindow, 1, searchRegion: queueItemRegion); resultsHarness.AddTestResult(foundWidget == null, "We should not have an actual checkbox"); } MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items, overrideWidth: 600); Assert.IsTrue(testHarness.AllTestsPassed(4)); }