public void CodedUITestMethod1() { // Arrange var path = @"C:\Kurse\Testing\2017_08_22_SoftwareTests_Burghausen\HalloWPF\bin\Debug\HalloWPF.exe"; var app = ApplicationUnderTest.Launch(path); var mainWindow = new WpfWindow(app); mainWindow.SearchProperties.Add(WpfWindow.PropertyNames.Name, "halloWPFWindow"); var inputTextBox = new WpfEdit(mainWindow); inputTextBox.SearchProperties.Add(WpfEdit.PropertyNames.AutomationId, "inputTextBox"); var outputTextBlock = new WpfText(mainWindow); outputTextBlock.SearchProperties.Add(WpfText.PropertyNames.AutomationId, "outputTextBlock"); var inputButton = new WpfButton(mainWindow); inputButton.SearchProperties.Add(WpfButton.PropertyNames.AutomationId, "inputButton"); var outputCheckBox = new WpfCheckBox(mainWindow); outputCheckBox.SearchProperties.Add(WpfCheckBox.PropertyNames.AutomationId, "outputCheckBox"); // Act Keyboard.SendKeysDelay = 500; Keyboard.SendKeys(inputTextBox, "Hallo WPF from coded UI Test."); Mouse.Click(inputButton); // Assert Assert.AreEqual("Hallo WPF from coded UI Test.", outputTextBlock.DisplayText); Assert.IsTrue(outputCheckBox.Checked); }
public void LoginServer() { WpfWindow mainWindow = new WpfWindow(); mainWindow.SearchProperties[WpfWindow.PropertyNames.Name] = "Service Manager20.1 20.1.86.107687 (20.1)"; mainWindow.WindowTitles.Add("Service Manager20.1 20.1.86.107687 (20.1)"); UITestControl parent = new UITestControl(mainWindow); parent.WindowTitles.Add("Service Manager20.1 20.1.86.107687 (20.1)"); parent.TechnologyName = "MSAA"; parent.SearchProperties.Add("ControlType", "MenuBar"); parent.SearchProperties[WpfButton.PropertyNames.Name] = "Tools"; WpfButton Actions = new WpfButton(parent); Actions.WindowTitles.Add("Service Manager20.1 20.1.86.107687 (20.1)"); Actions.TechnologyName = "MSAA"; Actions.SearchProperties.Add("ControlType", "MenuItem"); Actions.SearchProperties[WpfButton.PropertyNames.Name] = "Actions"; Mouse.Click(Actions); WpfButton Login = new WpfButton(Actions); Actions.WindowTitles.Add("Service Manager20.1 20.1.86.107687 (20.1)"); Actions.TechnologyName = "MSAA"; Actions.SearchProperties.Add("ControlType", "MenuItem"); Actions.SearchProperties[WpfButton.PropertyNames.Name] = "Login"; Mouse.Click(Login); Playback.Wait(10000); }
public void SelectAuthenticationType(string p0) { WpfWindow theWindow = GetNewServerWindow(); if (theWindow != null) { SendKeys.SendWait("{TAB}"); Playback.Wait(1000); switch (p0) { case "Windows": { Keyboard.SendKeys("{LEFT}{ENTER}"); break; } case "User": { Keyboard.SendKeys("{RIGHT}{ENTER}"); break; } case "Public": { Keyboard.SendKeys("{RIGHT}{RIGHT}{ENTER}"); break; } } Playback.Wait(1000); } }
public int CountRows() { WpfWindow debugWindow = GetDebugWindow(); UITestControlCollection rowList = debugWindow.GetChildren()[1].GetChildren()[0].GetChildren()[1].GetChildren(); return(rowList.Count); }
/// <summary> /// AssertMethod1 /// </summary> public WpfWindow GetNewServerWindow() { WpfWindow uINewServerWindow = this.UINewServerWindow; //uINewServerWindow.Find(); return(uINewServerWindow); }
public void SaveWindow_ClickCancel() { WpfWindow theWindow = GetNewServerWindow(); Point p = new Point(theWindow.BoundingRectangle.Left + 700, theWindow.BoundingRectangle.Top + 525); Mouse.Click(p); }
public bool DoesFeedbackWindowExist() { WpfWindow theWindow = GetFeedbackWindow(); Point p; return(theWindow.TryGetClickablePoint(out p)); }
public WpfWindow Get_Window() { var window = new WpfWindow(); window.SearchProperties[WpfWindow.PropertyNames.Name] = "C1DataGrid Test Automation"; return(window); }
/// <summary> /// RecordedMethod2 - Use 'RecordedMethod2Params' to pass parameters into this method. /// </summary> public void RecordedMethod2() { #region Variable Declarations WpfWindow uIWpfWindow = this.UIWpfWindow; WpfEdit uITextBoxEdit = this.UIMainWindowWindow.UITextBoxEdit; #endregion // Click 'Wpf' window Mouse.Click(uIWpfWindow, new Point(488, 91)); // Type 'Hallo Welt' in 'textBox' text box uITextBoxEdit.Text = this.RecordedMethod2Params.UITextBoxEditText; // Click 'Wpf' window Mouse.Click(uIWpfWindow, new Point(118, 111)); // Click 'Wpf' window Mouse.Click(uIWpfWindow, new Point(520, 94)); // Type '{Enter}' in 'textBox' text box Keyboard.SendKeys(uITextBoxEdit, this.RecordedMethod2Params.UITextBoxEditSendKeys, ModifierKeys.None); // Click 'Wpf' window Mouse.Click(uIWpfWindow, new Point(145, 111)); // Type 'asdfsdf' in 'textBox' text box uITextBoxEdit.Text = this.RecordedMethod2Params.UITextBoxEditText1; // Click 'Wpf' window Mouse.Click(uIWpfWindow, new Point(136, 92)); }
public void AddRemoveRow() { var window = new WpfWindow(); window.SearchProperties[WpfWindow.PropertyNames.Name] = "C1FlexGrid Automation Test"; var btn_AddRow = new WpfButton(window); btn_AddRow.SearchProperties[WpfButton.PropertyNames.AutomationId] = "btn_AddRow"; var btn_RemoveRow = new WpfButton(window); btn_RemoveRow.SearchProperties[WpfButton.PropertyNames.AutomationId] = "btn_RemoveRow"; var flexgrid = new WpfTable(window); flexgrid.SearchProperties[WpfTable.PropertyNames.AutomationId] = "flexgrid"; var msg = "Default:" + flexgrid.RowCount; Mouse.Click(btn_AddRow); Mouse.Click(btn_AddRow); msg += ".AfterAddingTwoRows:" + flexgrid.RowCount; Mouse.Click(btn_RemoveRow); Mouse.Click(btn_RemoveRow); msg += ".AfterRemovingTwoRows:" + flexgrid.RowCount; Assert.AreEqual("Default:10.AfterAddingTwoRows:12.AfterRemovingTwoRows:10", msg); }
public void ClickSaveConnection() { WpfWindow theWindow = GetNewServerWindow(); Point p = new Point(theWindow.BoundingRectangle.Left + 300, theWindow.BoundingRectangle.Top + 275); Mouse.Move(p); Mouse.Click(); }
public void ClickXMLTab() { WpfWindow uIDebugWindow = UIDebugWindow; WpfTabPage XMLTabPage = (WpfTabPage)uIDebugWindow.GetChildren()[1].GetChildren()[1]; Mouse.Click(XMLTabPage, new Point(5, 5)); Playback.Wait(200); }
/// <summary> /// IsWebpageServiceDetailsWizardOpen /// </summary> public WpfWindow GetWindow() { #region Variable Declarations WpfWindow uIWebpageServiceDetailWindow = this.UIWebpageServiceDetailWindow; #endregion return(uIWebpageServiceDetailWindow); }
public bool ServiceDetailsWindowExists() { WpfWindow theWindow = ServiceDetailsWindow(); Point p = new Point(); bool doesExist = theWindow.TryGetClickablePoint(out p); return(doesExist); }
/// <summary> /// PluginServiceDetailsWizardIsOpen /// </summary> private WpfWindow GetWindow() { #region Variable Declarations WpfWindow uIPluginServiceDetailsWindow = this.UIPluginServiceDetailsWindow; #endregion return(uIPluginServiceDetailsWindow); }
public WpfWindow GetWindow() { #region Variable Declarations WpfWindow theWindow = StudioWindow.GetChildren()[0] as WpfWindow; #endregion return(theWindow); }
public static WpfWindow AccessKeyPress(this WpfWindow currentScreen, string accessKey) { Keyboard.PressModifierKeys(ModifierKeys.Alt); Keyboard.SendKeys(accessKey); Keyboard.ReleaseModifierKeys(ModifierKeys.Alt); return(currentScreen); }
protected WpfStaticChildPageModelBase(WpfWindow bw, TParent parentModel) : base(bw) { if (null == parentModel) { throw new ArgumentNullException(nameof(parentModel)); } this.parentModel = parentModel; }
protected override void BeginProcessing() { var window = WpfWindow.OpenWindow(XamlString, Content, Options); if (PassThru) { WriteObject(window); } }
protected WpfChildPageModelBase(WpfWindow bw, T me) : base(bw) { if (null == me) { throw new ArgumentNullException(nameof(me)); } this.Me = me; }
protected WpfPageModelBase(WpfWindow bw) { if (null == bw) { throw new ArgumentNullException(nameof(bw)); } this.parent = bw; }
public void CloseDebugWindow_ByCancel() { WpfWindow debugWindow = GetDebugWindow(); UITestControl theControl = new UITestControl(debugWindow); theControl.SearchProperties.Add("AutomationId", "UI_Cancelbtn_AutoID"); theControl.Find(); Mouse.Click(theControl, new Point(5, 5)); }
public static WpfWindow GetWpfWindow() { if (_wpfWindow == null) { _wpfWindow = new WpfWindow(GetItemClient()); _wpfWindow.SearchProperties[WpfWindow.PropertyNames.Name] = "Login to your server"; } return(_wpfWindow); }
public void MyTestInitialize() { App = ApplicationUnderTest.Launch(@"D:\Projects\Sample\Project_Telerik\Project_Telerik\bin\Debug\Project_Telerik.exe"); var window = new WpfWindow(); window.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.Name, "Telerik UI for WPF Trial")); window.Find(); window.SetFocus(); Keyboard.SendKeys(window, "{F4}", ModifierKeys.Alt); }
public void EnterServerAddress(string address) { WpfWindow theWindow = GetNewServerWindow(); if (theWindow != null) { SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(500); SendKeys.SendWait(address); } }
public bool DebugWindowExists() { WpfWindow uIDebugWindow = UIDebugWindow; Point p; if (uIDebugWindow.TryGetClickablePoint(out p)) { return(true); } return(false); }
public string GetWorkflowWizardName() { #region Variable Declarations WpfWindow uIPluginServiceDetailsWindow = GetWindow(); #endregion if (uIPluginServiceDetailsWindow.WindowTitles.Count > 1) { throw new Exception("More than 1 wizard window opened"); } return(uIPluginServiceDetailsWindow.WindowTitles[0]); }
public void EnterPassword(string password) { WpfWindow theWindow = GetNewServerWindow(); if (theWindow != null) { SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(500); SendKeys.SendWait("{ENTER}"); SendKeys.SendWait(password); } }
private Point StartRecordingButtonPoint() { // Get the Studio WpfWindow theStudio = new WpfWindow(); theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.Name, "Warewolf", PropertyExpressionOperator.Contains)); theStudio.Find(); return(new Point(theStudio.BoundingRectangle.Right - 50, theStudio.Top + 35)); }
public void EnterUserName(string userName) { WpfWindow theWindow = GetNewServerWindow(); if (theWindow != null) { SendKeys.SendWait("{TAB}"); System.Threading.Thread.Sleep(500); SendKeys.SendWait("{ENTER}"); SendKeys.SendWait(userName); } }
private Point StartRecordingButtonPoint() { // Get the Studio WpfWindow theStudio = new WpfWindow(); theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.Name, "Warewolf", PropertyExpressionOperator.Contains)); theStudio.Find(); return new Point(theStudio.BoundingRectangle.Right - 50, theStudio.Top + 35); }
public static WpfWindow GetWindow(this WpfWindow parent, string windowTitle, bool exactMatch = false) { PropertyExpressionOperator expressionOperator = exactMatch ? PropertyExpressionOperator.EqualTo : PropertyExpressionOperator.Contains; var modalWindow = new WpfWindow { SearchProperties = { {UITestControl.PropertyNames.Name, windowTitle, expressionOperator} } }; modalWindow.Find(); return modalWindow; }
public void AddData(string filename, string testcase) { DataTable dt1 = hlp.dtFromExcelFile(filename, "Template"); DataTable dt2 = hlp.dtFromExcelFile(filename, "ExpectedData", "TestCase", testcase); UITestControl UIcurrentparent = null; for (int i = 0; i < dt1.Rows.Count; i++) { string controlValue = ""; string parentType = dt1.Rows[i]["ParentType"].ToString(); string parentSearchBy = dt1.Rows[i]["parentSearchBy"].ToString(); string parentSearchValue = dt1.Rows[i]["parentSearchValue"].ToString(); string pTechnology = dt1.Rows[i]["Technology"].ToString(); string controlType = dt1.Rows[i]["ControlType"].ToString(); string technologyControl = dt1.Rows[i]["TechnologyControl"].ToString(); string field = dt1.Rows[i]["Field"].ToString(); string index = dt1.Rows[i]["Index"].ToString(); string searchBy = dt1.Rows[i]["SearchBy"].ToString(); string searchValue = dt1.Rows[i]["SearchValue"].ToString(); string pOperator = dt1.Rows[i]["pOperator"].ToString(); string cOperator = dt1.Rows[i]["cOperator"].ToString(); if (field.Length > 0) { controlValue = dt2.Rows[0][field].ToString(); } if (parentType.Length > 0) { switch (parentType.ToLower()) { #region Window case "window": { if (pTechnology.ToLower() == "msaa") { WinWindow uiwindow = new WinWindow(); if (pOperator == "=") { uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue); } else if (pOperator == "~") { uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains); } UIcurrentparent = uiwindow; } else if (pTechnology == "uia") { WpfWindow uiwindow = new WpfWindow(); if (pOperator == "=") { uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue); } else if (pOperator == "~") { uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains); } UIcurrentparent = uiwindow; } break; } #endregion #region client case "client": { if (pTechnology.ToLower() == "msaa") { WinClient uicleint = new WinClient(UIcurrentparent); if (pOperator == "=") { uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue); } else if (pOperator == "~") { uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains); } UIcurrentparent = uicleint; } else if (pTechnology.ToLower() == "uia") { // to do } break; } #endregion #region docuemnt case "document": { if (pTechnology.ToLower() == "web") { HtmlDocument uidoc = new HtmlDocument(UIcurrentparent); if (pOperator == "=") { uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue); } else if (pOperator == "~") { uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains); } UIcurrentparent = uidoc; } else if (pTechnology.ToLower() == "uia") { // to do } break; } #endregion } } if (controlType.Length > 0) { switch (controlType.ToLower()) { #region edit case "edit": { if (technologyControl == "MSAA") { // to do } else if (technologyControl == "UIA") { // to do } else if (technologyControl == "Web") { HtmlEdit uiedit = new HtmlEdit(UIcurrentparent); if (cOperator == "=") { uiedit.SearchProperties.Add(searchBy, searchValue); } else if (cOperator == "~") { uiedit.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains); } if (controlValue.Length > 0) { uiedit.Text = controlValue; } } break; } #endregion #region button case "button": { if (technologyControl == "MSAA") { // to do } else if (technologyControl == "UIA") { // to do } else if (technologyControl == "Web") { HtmlButton ucntl= new HtmlButton(UIcurrentparent); if (cOperator == "=") { ucntl.SearchProperties.Add(searchBy, searchValue); if (index.Length > 0) { ucntl.SearchProperties.Add("TagInstance", index); } } else if (cOperator == "~") { ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains); } if (controlValue.Length > 0) { Mouse.Click(ucntl); } } break; } #endregion #region image case "image": { if (technologyControl == "MSAA") { // to do } else if (technologyControl == "UIA") { // to do } else if (technologyControl == "Web") { HtmlImage ucntl = new HtmlImage(UIcurrentparent); if (cOperator == "=") { ucntl.SearchProperties.Add(searchBy, searchValue); if (index.Length > 0) { ucntl.SearchProperties.Add("TagInstance", index); } } else if (cOperator == "~") { ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains); } if (controlValue.Length > 0) { Mouse.Click(ucntl); } } break; } #endregion #region Dropdown case "dropdown" : { if (technologyControl == "MSAA") { // to do } else if (technologyControl == "UIA") { // to do } else if (technologyControl == "Web") { HtmlComboBox ucntl = new HtmlComboBox(UIcurrentparent); if (cOperator == "=" ) { if (searchValue.Length > 0) { ucntl.SearchProperties.Add(searchBy, searchValue); } if (index.Length > 0) { ucntl.SearchProperties.Add("TagInstance", index); } } else if (cOperator == "~") { ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains); } if (controlValue.Length > 0) { ucntl.SelectedItem = controlValue; hlp.LogtoTextFile("Entered Value in ComboBox"); } } break; } #endregion } } } }
public void SelectedIndex_Copy() { var window = new WpfWindow(); window.SearchProperties[WpfWindow.PropertyNames.Name] = "C1FlexGrid Automation Test"; var btn_SelectedIndex = new WpfButton(window); btn_SelectedIndex.SearchProperties[WpfButton.PropertyNames.AutomationId] = "btn_SelectedIndex"; var btn_Copy = new WpfButton(window); btn_Copy.SearchProperties[WpfButton.PropertyNames.AutomationId] = "btn_Copy"; var flexgrid = new WpfTable(window); flexgrid.SearchProperties[WpfTable.PropertyNames.AutomationId] = "flexgrid"; Mouse.Click(btn_SelectedIndex); Mouse.Click(btn_Copy); Assert.AreEqual("10", btn_Copy.DisplayText.Replace(Environment.NewLine,string.Empty)); }
public WpfWindow Get_Window() { var window = new WpfWindow(); window.SearchProperties[WpfWindow.PropertyNames.Name] = "C1DataGrid Test Automation"; return window; }
// Intellisense Box public UITestControl GetIntellisenseItem(int id) { // Get the Studio WpfWindow theStudio = new WpfWindow(); theStudio.SearchProperties[UITestControl.PropertyNames.Name] = TestBase.GetStudioWindowName(); theStudio.SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); theStudio.WindowTitles.Add(TestBase.GetStudioWindowName()); theStudio.Find(); UITestControl itelliList = new UITestControl(theStudio); itelliList.SearchProperties[WpfControl.PropertyNames.AutomationId] = "PART_ItemList"; itelliList.Find(); var itelliListItem = itelliList.GetChildren()[id]; return itelliListItem; //PART_ItemList }
public WpfScreen(ApplicationBase<WpfWindow> application, WpfWindow window) { Application = application; Window = window; }
public void AutoGenerateColumns() { var window = new WpfWindow(); window.SearchProperties[WpfWindow.PropertyNames.Name] = "C1FlexGrid Automation Test"; var chk_AutoGenerateColumns=new WpfCheckBox(window); chk_AutoGenerateColumns.SearchProperties[WpfCheckBox.PropertyNames.AutomationId] = "chk_AutoGenerateColumns"; var flexgrid = new WpfTable(window); flexgrid.SearchProperties[WpfTable.PropertyNames.AutomationId] = "flexgrid"; var msg = "Default:" + flexgrid.ColumnCount; chk_AutoGenerateColumns.Checked = false; msg += ".False:" + flexgrid.ColumnCount; chk_AutoGenerateColumns.Checked = true; Assert.AreEqual("Default:7.False:3", msg); }
public void ConnectToLowis(bool CreateNewStore) { WpfWindow LOWISConnect = new WpfWindow(); LOWISConnect.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); LOWISConnect.SearchProperties.Add(WpfWindow.PropertyNames.Name, "LOWIS: Connect"); LOWISConnect.WindowTitles.Add("LOWIS: Connect"); WpfComboBox HostCB = new WpfComboBox(LOWISConnect); HostCB.WindowTitles.Add("LOWIS: Connect"); WpfEdit HostTB = new WpfEdit(HostCB); HostTB.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); HostTB.SearchProperties.Add(WpfEdit.PropertyNames.AutomationId, "PART_EditableTextBox"); HostTB.Text = ConnectClientTo; Trace.WriteLine("Set ServerName to " + ConnectClientTo); WpfRadioButton Credentials = new WpfRadioButton(LOWISConnect); Credentials.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Credentials.SearchProperties.Add(WpfRadioButton.PropertyNames.Name, "Use my windows credentials."); Credentials.WindowTitles.Add("LOWIS: Connect"); Credentials.Selected = true; Trace.WriteLine("Use Windows Credentials checkbox is set to true"); WpfButton ConnectButton = new WpfButton(LOWISConnect); ConnectButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ConnectButton.SearchProperties[WpfButton.PropertyNames.AccessKey] = "\r"; ConnectButton.WindowTitles.Add("LOWIS: Connect"); WpfButton SettingsButton = new WpfButton(LOWISConnect); SettingsButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SettingsButton.WindowTitles.Add("LOWIS: Connect"); WpfWindow SettingsWin = new WpfWindow(); SettingsWin.SearchProperties[WpfWindow.PropertyNames.Name] = "LOWIS: Settings"; SettingsWin.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); SettingsWin.WindowTitles.Add("LOWIS: Settings"); WpfEdit CsStore = new WpfEdit(SettingsWin); CsStore.WindowTitles.Add("LOWIS: Settings"); WpfButton SaveButton = new WpfButton(SettingsWin); SaveButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SaveButton.SearchProperties[WpfButton.PropertyNames.AccessKey] = "\r"; SaveButton.WindowTitles.Add("LOWIS: Settings"); if (CreateNewStore == true) { Mouse.Click(SettingsButton); Trace.WriteLine("Clicked Settings button on client Logon"); CsStore.Text = "C:\\csstore18"; Trace.WriteLine("Set CsStore path"); Mouse.Click(SaveButton); Trace.WriteLine("Clicked Save Button on settings window"); } Mouse.Click(ConnectButton); Trace.WriteLine("Clicked LOWIS connect button"); }