public UITestControl getControl(string tabName, string buttonText) { UITestControl returnControl = new UITestControl(); WpfTabList uIRibbonTabList = this.UIBusinessDesignStudioWindow.UIRibbonTabList; //int tabCount = uIRibbonTabList.Tabs.Count; foreach (WpfTabPage buttonList in uIRibbonTabList.Tabs) { if (buttonList.FriendlyName == tabName) { UITestControlCollection buttonListChildren = buttonList.GetChildren(); foreach (UITestControl buttonGroup in buttonListChildren) { foreach (var potentialButton in buttonGroup.GetChildren()) { if (potentialButton.GetChildren().Count > 0) { UITestControlCollection buttonProperties = potentialButton.GetChildren(); string friendlyName = buttonProperties[0].FriendlyName; if (friendlyName == buttonText) { return((UITestControl)buttonProperties[0]); } } } } } } return(null); }
/// <summary> /// CreateTestCatalog - Use 'CreateTestCatalogParams' to pass parameters into this method. /// </summary> public void CreateTestCatalog() { #region Variable Declarations WpfTabList uIMainRegionTabList1 = this.UIWpfWindow.UIMainRegionTabList1; WpfEdit uIItemEdit = this.UIWpfWindow.UIVirtoCommerceManagemPane.UICatalogidText.UIItemEdit; WpfEdit uIItemEdit1 = this.UIWpfWindow.UIVirtoCommerceManagemPane.UICatalognameText.UIItemEdit; WpfComboBox uIItemComboBox = this.UIWpfWindow.UIVirtoCommerceManagemPane.UIDefaultlanguageText.UIItemComboBox; WpfButton uIFinishButton = this.UIWpfWindow.UIFinishButton; #endregion // Click 'MainRegion' tab list Mouse.Click(uIMainRegionTabList1, new Point(1768, 152)); // Type 'TestCatalog' in first text box next to '* Catalog id:' label uIItemEdit.Text = this.CreateTestCatalogParams.UIItemEditText; // Type 'Test catalog' in first text box next to '* Catalog name:' label uIItemEdit1.Text = this.CreateTestCatalogParams.UIItemEditText1; // Last action on list item was not recorded because the control does not have any good identification property. // Last action on list item was not recorded because the control does not have any good identification property. // Click first combo box next to '* Default language:' label Mouse.Click(uIItemComboBox, new Point(384, 14)); // Last action on list item was not recorded because the control does not have any good identification property. // Click 'Finish' button Mouse.Click(uIFinishButton, new Point(50, 15)); }
public static WpfTabList GetMainTabControlTabList() { if (_mainTabControlTabList == null) { _mainTabControlTabList = new WpfTabList(DesktopAppControls.GetShareConnectWindow()); _mainTabControlTabList.SearchProperties[WpfTabList.PropertyNames.AutomationId] = "MainTabControl"; } return(_mainTabControlTabList); }
private UITestControlCollection getRibbonItemListFromMenuName(string menuName) { UITestControlCollection theCollection = new UITestControlCollection(); WpfTabList uIRibbonTabList = this.UIBusinessDesignStudioWindow.UIRibbonTabList; for (int j = 0; j < uIRibbonTabList.Tabs.Count; j++) { if (uIRibbonTabList.Tabs[j].FriendlyName == menuName) { theCollection = uIRibbonTabList.Tabs[j].GetChildren(); break; } } return(theCollection); }
public void ClickRibbonMenu(string menuAutomationId) { // This needs some explaining :) // Due to the way the WpfRibbon works, unless it has been used, the default tab will not be properly initialised. // This will cause problems if you need to use it (Automation wise) // To combat this, we check if the tab we have got is actually a valid tab (Check its bounding) // If it's not a valid tab, we click an alternate tab - This validates our original tab. // We then recusrsively call the method again with the now validated tab, and it works as itended. // Note: This recursive call will only happen the first time the ribbon is used, as it will subsequently be initialised correctly. if (uIRibbonTabList == null) { uIRibbonTabList = UIBusinessDesignStudioWindow.UIRibbonTabList; } UITestControlCollection tabList = uIRibbonTabList.Tabs; UITestControl theControl; foreach (WpfTabPage tabPage in tabList) { if (tabPage.Name == menuAutomationId) { theControl = tabPage; Point p; p = new Point(theControl.GetChildren()[0].BoundingRectangle.X + 20, theControl.GetChildren()[0].BoundingRectangle.Y + 10); Mouse.Click(p); return; } else { theControl = tabPage; Point p = new Point(theControl.BoundingRectangle.X + 5, theControl.BoundingRectangle.Y + 5); if (p.X > 5) { Mouse.Click(p); break; } } } // Somethign has gone wrong - Retry! loopCount++; // This was added due to the infinite loop happening if the ribbon was totally unclickable due to a crash if (loopCount < 10) { ClickRibbonMenu(menuAutomationId); } }
public void ClickRibbonMenu(string menuAutomationId) { // This needs some explaining :) // Due to the way the WpfRibbon works, unless it has been used, the default tab will not be properly initialised. // This will cause problems if you need to use it (Automation wise) // To combat this, we check if the tab we have got is actually a valid tab (Check its bounding) // If it's not a valid tab, we click an alternate tab - This validates our original tab. // We then recusrsively call the method again with the now validated tab, and it works as itended. // Note: This recursive call will only happen the first time the ribbon is used, as it will subsequently be initialised correctly. if(uIRibbonTabList == null) { uIRibbonTabList = UIBusinessDesignStudioWindow.UIRibbonTabList; } UITestControlCollection tabList = uIRibbonTabList.Tabs; UITestControl theControl; foreach(WpfTabPage tabPage in tabList) { if(tabPage.Name == menuAutomationId) { theControl = tabPage; Point p; p = new Point(theControl.GetChildren()[0].BoundingRectangle.X + 20, theControl.GetChildren()[0].BoundingRectangle.Y + 10); Mouse.Click(p); return; } else { theControl = tabPage; Point p = new Point(theControl.BoundingRectangle.X + 5, theControl.BoundingRectangle.Y + 5); if(p.X > 5) { Mouse.Click(p); break; } } } // Somethign has gone wrong - Retry! loopCount++; // This was added due to the infinite loop happening if the ribbon was totally unclickable due to a crash if(loopCount < 10) { ClickRibbonMenu(menuAutomationId); } }
public UITestControl GetTab(string childAutomationID) { WpfTabList theList = (WpfTabList)this; UITestControlCollection tabList = theList.Tabs; // This lags for some reason foreach (WpfTabPage currentTapPage in tabList) { UITestControlCollection tabChildren = currentTapPage.GetChildren(); foreach (var tabChild in tabChildren) { if (tabChild.FriendlyName.Contains(childAutomationID)) { return(currentTapPage); } } } return(null); }
/// <summary> /// OpenAdmin - Use 'OpenAdminParams' to pass parameters into this method. /// </summary> public void OpenAdmin() { #region Variable Declarations WpfTabList uIMainRegionTabList = this.UIWpfWindow.UIMainRegionTabList; WpfEdit uIItemEdit = this.UIWpfWindow.UIMainRegionTabList.UIVirtoCommerceManagemTabPage.UIAdminText.UIItemEdit; #endregion // Launch 'C:\Virto\VCF\src\CommerceFoundation.Presentation\Admin\Presentation.Application\bin\Debug\VirtoCommerce.exe' ApplicationUnderTest uIWpfWindow = ApplicationUnderTest.Launch(this.OpenAdminParams.UIWpfWindowExePath, this.OpenAdminParams.UIWpfWindowAlternateExePath); // Click 'MainRegion' tab list Mouse.Click(uIMainRegionTabList, new Point(121, 338)); // Type 'http://localhost/store' in text box numbered 3 next to 'admin' label uIItemEdit.Text = this.OpenAdminParams.UIItemEditText; // Click 'MainRegion' tab list Mouse.Click(uIMainRegionTabList, new Point(631, 394)); }
public WpfTabListControlPageModelWrapper(WpfTabList control, TNextModel nextModel) : base(control, nextModel, StandardFunctionProvider.StringReturnSelf, StandardFunctionProvider.StringReturnSelf) { }