/// <summary> /// LettersInput - Используйте "LettersInputParams" для передачи параметров в этот метод. /// </summary> public void LettersInput() { #region Variable Declarations WinClient uIForm1Client = this.UIForm1Window.UIForm1Client; WinEdit uITextBoxOp1Edit = this.UIForm1Window.UITextBoxOp1Window.UITextBoxOp1Edit; WinEdit uITextBoxOp2Edit = this.UIForm1Window.UITextBoxOp2Window.UITextBoxOp2Edit; WinButton uIItemButton = this.UIForm1Window.UIItemWindow1.UIItemButton; #endregion // Щелкните "Form1" клиент Mouse.Click(uIForm1Client, new Point(147, 55)); // Тип "a" в "textBoxOp1" надпись uITextBoxOp1Edit.Text = this.LettersInputParams.UITextBoxOp1EditText; // Щелкните "Form1" клиент Mouse.Click(uIForm1Client, new Point(141, 78)); // Тип "b" в "textBoxOp2" надпись uITextBoxOp2Edit.Text = this.LettersInputParams.UITextBoxOp2EditText; // Тип "{Tab}" в "textBoxOp2" надпись Keyboard.SendKeys(uITextBoxOp2Edit, this.LettersInputParams.UITextBoxOp2EditSendKeys, ModifierKeys.None); // Тип "{Enter}" в "/" кнопка Keyboard.SendKeys(uIItemButton, this.LettersInputParams.UIItemButtonSendKeys, ModifierKeys.None); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinEdit uIBillTextBoxEdit = this.UIForm1Window.UIBillTextBoxWindow.UIBillTextBoxEdit; WpfControl uIEnterTotalBillEdit = this.UIForm1Window.UIEnterTotalBillEdit; WinWindow uITipBoxWindow = this.UIForm1Window.UIForm1Client.UITipBoxWindow; WinEdit uITipBoxEdit = this.UIForm1Window.UITipBoxWindow.UITipBoxEdit; WinClient uIForm1Client = this.UIForm1Window.UIForm1Client; WinButton uIComputeTipButton = this.UIForm1Window.UIComputeTipWindow.UIComputeTipButton; #endregion // Launch '%USERPROFILE%\source\repos\u1190338\Labs\Lab6\Lab6\bin\Debug\Lab6.exe' ApplicationUnderTest uIForm1Window = ApplicationUnderTest.Launch(this.RecordedMethod1Params.UIForm1WindowExePath, this.RecordedMethod1Params.UIForm1WindowAlternateExePath); // Click 'BillTextBox' text box Mouse.Click(uIBillTextBoxEdit, new Point(61, 4)); // Double-Click 'BillTextBox' text box Mouse.DoubleClick(uIBillTextBoxEdit, new Point(61, 4)); // Type '100' in 'Enter Total Bill' text box Keyboard.SendKeys(uIEnterTotalBillEdit, this.RecordedMethod1Params.UIEnterTotalBillEditSendKeys, ModifierKeys.None); // Click 'TipBox' window Mouse.Click(uITipBoxWindow, new Point(32, 1)); // Type '20' in 'TipBox' text box uITipBoxEdit.Text = this.RecordedMethod1Params.UITipBoxEditText; // Click 'Form1' client Mouse.Click(uIForm1Client, new Point(301, 303)); // Click 'Compute Tip' button Mouse.Click(uIComputeTipButton, new Point(132, 22)); }
/// <summary> /// Success scenario /// </summary> public void adminLogin() { #region Variable Declarations WinClient uIChromeLegacyWindowClient = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowClient; WinControl uIGradePerformanceAnalDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIGradePerformanceAnalDocument; WinControl uIChromeLegacyWindowDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowDocument; WinButton uIItemButton = this.UIItemWindow.UIItemComboBox.UIItemButton; #endregion // Click 'Chrome Legacy Window' client Mouse.Click(uIChromeLegacyWindowClient, new Point(682, 250)); // Type 'a' in 'Grade Performance Analyzer - Google Chrome' document Keyboard.SendKeys(uIGradePerformanceAnalDocument, this.adminLoginParams.UIGradePerformanceAnalDocumentSendKeys, ModifierKeys.None); // Type 'dmin' in 'Chrome Legacy Window' document Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLoginParams.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(646, 353)); // Type 'admin' in 'Chrome Legacy Window' document Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLoginParams.UIChromeLegacyWindowDocumentSendKeys1, ModifierKeys.None); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(774, 431)); // Click button Mouse.Click(uIItemButton, new Point(26, 17)); }
/// <summary> /// unsuccessful scenario /// </summary> public void adminLogin2() { #region Variable Declarations WinClient uIChromeLegacyWindowClient = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowClient; WinClient uIChromeLegacyWindowClient1 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow2.UIChromeLegacyWindowClient; WinControl uIGradePerformanceAnalDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow3.UIGradePerformanceAnalDocument; WinControl uIChromeLegacyWindowDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow4.UIChromeLegacyWindowDocument; WinControl uIChromeLegacyWindowDocument1 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow5.UIChromeLegacyWindowDocument; WinControl uIChromeLegacyWindowDocument2 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow6.UIChromeLegacyWindowDocument; WinControl uIChromeLegacyWindowDocument3 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow7.UIChromeLegacyWindowDocument; #endregion // Click 'Chrome Legacy Window' client Mouse.Click(uIChromeLegacyWindowClient, new Point(499, 234)); // Move 'Chrome Legacy Window' client Mouse.StartDragging(uIChromeLegacyWindowClient1, new Point(504, 242)); Mouse.StopDragging(uIChromeLegacyWindowClient1, -5, 0); // Type 'a' in 'Grade Performance Analyzer - Google Chrome' document Keyboard.SendKeys(uIGradePerformanceAnalDocument, this.adminLogin2Params.UIGradePerformanceAnalDocumentSendKeys, ModifierKeys.None); // Type 'dmin' in 'Chrome Legacy Window' document Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLogin2Params.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument1, new Point(497, 345)); // Type 'ad' in 'Chrome Legacy Window' document Keyboard.SendKeys(uIChromeLegacyWindowDocument2, this.adminLogin2Params.UIChromeLegacyWindowDocumentSendKeys1, ModifierKeys.None); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument3, new Point(790, 432)); }
/// <summary> /// AssignClassifierToRecipe - Use 'AssignClassifierToRecipeParams' to pass parameters into this method. /// </summary> public void AssignClassifierToRecipe(String name) { #region Variable Declarations WinClient uIWorkspaceClient = this.UISmartViewRecipeManagWindow1.UIItemWindow.UIWorkspaceClient; WinTreeItem uIBasicTreeItem = this.UISmartViewRecipeManagWindow1.UIItemWindow1.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UIBasicTreeItem; WinMenuItem uISelectClassifierMenuItem = this.UIItemWindow.UIContextMenu.UISelectClassifierMenuItem; WinList uIItemList = this.UISelectClassifierWindow.UIItemWindow.UIItemList; WinButton uIOKButton = this.UISelectClassifierWindow.UIOKWindow.UIOKButton; #endregion uIBasicTreeItem.WindowTitles.Add("SmartView Recipe Manager - " + name); // Click 'Workspace' client //Mouse.Click(uIWorkspaceClient, new Point(501, 481)); // Click 'Line' -> 'Station' -> 'View 1' -> 'Basic' tree item Mouse.Click(uIBasicTreeItem, new Point(12, 8)); // Right-Click 'Line' -> 'Station' -> 'View 1' -> 'Basic' tree item Mouse.Click(uIBasicTreeItem, MouseButtons.Right, ModifierKeys.None, new Point(12, 8)); // Click 'Select Classifier...' menu item Mouse.Click(uISelectClassifierMenuItem, new Point(36, 13)); // Select 'Basic-Test' in 'Unknown Name' list box uIItemList.SelectedItemsAsString = name; // Click 'OK' button Mouse.Click(uIOKButton, new Point(52, 17)); }
/// <summary> /// AddDefectRatePlot - Use 'AddDefectRatePlotParams' to pass parameters into this method. /// </summary> public void AddDefectRatePlot() { #region Variable Declarations WinWindow uIViewportWindow = this.UISmartViewProductionQWindow.UISv60_15_51Window.UISv60_15_51Client.UIViewportWindow; WinClient uIDesktopClient = this.UIItemWindow.UIItemWindow1.UIDesktopClient; WinCheckBox uIShowplotCheckBox = this.UIDefectRateOptionsWindow.UIShowplotWindow.UIShowplotCheckBox; WinButton uIApplyButton = this.UIDefectRateOptionsWindow.UIApplyWindow.UIApplyButton; WinButton uIOKButton = this.UIDefectRateOptionsWindow.UIOKWindow.UIOKButton; #endregion // Click 'viewport' window Mouse.Click(uIViewportWindow, new Point(66, 11)); // Click 'Desktop' client Mouse.Click(uIDesktopClient, new Point(38, 97)); // Select 'Show plot' check box uIShowplotCheckBox.Checked = this.AddDefectRatePlotParams.UIShowplotCheckBoxChecked; // Click 'Apply' button Mouse.Click(uIApplyButton, new Point(34, 10)); // Click 'OK' button Mouse.Click(uIOKButton, new Point(53, 10)); }
/// <summary> /// SetCamera /// </summary> public void SetCamera(String cameras) { #region Variable Declarations WinClient uIImageparametersClient = this.UISmartViewRecipeManagWindow.UISheetQualityAnalysisWindow.UIItemWindow.UIImageparametersClient; #endregion if (cameras.Equals("cam1")) { // Click 'Image parameters' client Mouse.Click(uIImageparametersClient, new Point(10, 31)); } if (cameras.Equals("cam2")) { // Click 'Image parameters' client Mouse.Click(uIImageparametersClient, new Point(10, 40)); } if (cameras.Equals("cam3")) { // Click 'Image parameters' client Mouse.Click(uIImageparametersClient, new Point(10, 56)); } if (cameras.Equals("cam4")) { // Click 'Image parameters' client Mouse.Click(uIImageparametersClient, new Point(10, 83)); } }
/// <summary> /// camass /// </summary> /// <summary> /// AssignCameraToSingleView /// </summary> public void AssignCameraToSingleView() { #region Variable Declarations WinClient uICameraStatusandAssigClient = this.UISmartViewConfiguratiWindow.UICameraStatusandAssigWindow.UIItemWindow.UICameraStatusandAssigClient; WinTreeItem uICamera1cam1TreeItem = this.UISmartViewConfiguratiWindow.UIItemWindow.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UICamera1cam1TreeItem; WinTreeItem uICamera2cam2TreeItem = this.UISmartViewConfiguratiWindow.UIItemWindow.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UICamera2cam2TreeItem; WinTreeItem uICamera3cam3TreeItem = this.UISmartViewConfiguratiWindow.UIItemWindow.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UICamera3cam3TreeItem; WinTreeItem uICamera4cam4TreeItem = this.UISmartViewConfiguratiWindow.UIItemWindow.UIItemTree.UILineTreeItem.UIStationTreeItem.UIView1TreeItem.UICamera4cam4TreeItem; #endregion // Move 'Camera Status and Assignment' client from (151, 26) to 'Line' -> 'Station' -> 'View 1' -> 'Camera 1 (cam1)' tree item (78, 12) uICamera1cam1TreeItem.EnsureClickable(new Point(78, 12)); Mouse.StartDragging(uICameraStatusandAssigClient, new Point(151, 26)); Mouse.StopDragging(uICamera1cam1TreeItem, new Point(78, 12)); /* // Move 'Camera Status and Assignment' client from (110, 42) to 'Line' -> 'Station' -> 'View 1' -> 'Camera 2 (cam2)' tree item (74, 8) * uICamera2cam2TreeItem.EnsureClickable(new Point(74, 8)); * Mouse.StartDragging(uICameraStatusandAssigClient, new Point(110, 42)); * Mouse.StopDragging(uICamera2cam2TreeItem, new Point(74, 8)); * * // Move 'Camera Status and Assignment' client from (47, 54) to 'Line' -> 'Station' -> 'View 1' -> 'Camera 3 (cam3)' tree item (61, 6) * uICamera3cam3TreeItem.EnsureClickable(new Point(61, 6)); * Mouse.StartDragging(uICameraStatusandAssigClient, new Point(47, 54)); * Mouse.StopDragging(uICamera3cam3TreeItem, new Point(61, 6)); * * // Click 'Camera Status and Assignment' client * Mouse.Click(uICameraStatusandAssigClient, new Point(15, 69)); * * // Move 'Camera Status and Assignment' client from (34, 69) to 'Line' -> 'Station' -> 'View 1' -> 'Camera 4 (cam4)' tree item (52, 6) * uICamera4cam4TreeItem.EnsureClickable(new Point(52, 6)); * Mouse.StartDragging(uICameraStatusandAssigClient, new Point(34, 69)); * Mouse.StopDragging(uICamera4cam4TreeItem, new Point(52, 6));*/ }
/// <summary> /// DeleteSelectedLanes /// </summary> public void DeleteSelectedLanes(String noOfLane) { #region Variable Declarations WinClient uITileMapDefinitionStaClient = this.UISmartViewRecipeManagWindow.UITileMapDefinitionStaWindow.UIItemWindow1.UITileMapDefinitionStaClient; WinMenuItem uIDeleteSelectedLanesMenuItem = this.UIItemWindow.UIContextMenu.UIDeleteSelectedLanesMenuItem; #endregion if (noOfLane.Equals("Multiple")) { // Click 'Tile Map Definition: Station, View 1' client while pressing Shift Mouse.Click(uITileMapDefinitionStaClient, MouseButtons.Left, ModifierKeys.Shift, new Point(57, 38)); // Right-Click 'Tile Map Definition: Station, View 1' client Mouse.Click(uITileMapDefinitionStaClient, MouseButtons.Right, ModifierKeys.None, new Point(57, 39)); // Click 'Delete Selected Lanes' menu item Mouse.Click(uIDeleteSelectedLanesMenuItem, new Point(50, 10)); } if (noOfLane.Equals("Single")) { // Right-Click 'Tile Map Definition: Station, View 1' client Mouse.Click(uITileMapDefinitionStaClient, MouseButtons.Right, ModifierKeys.None, new Point(45, 24)); // Click 'Delete Selected Lanes' menu item Mouse.Click(uIDeleteSelectedLanesMenuItem, new Point(47, 11)); } }
/// <summary> /// test that the Arrow keys are not cuasing any problems ///in literal corner cases /// </summary> public void CornersTest() { #region Variable Declarations WinEdit uITextBox_contentEdit = this.UIYexcelWindow.UITextBox_contentWindow.UITextBox_contentEdit; WinClient uISpreadsheetPanel1Client = this.UIYexcelWindow.UIItemWindow.UISpreadsheetPanel1Client; #endregion // Type '' in 'textBox_content' text box uITextBox_contentEdit.Text = this.CornersTestParams.UITextBox_contentEditText; // Type '{Up}' in 'textBox_content' text box Keyboard.SendKeys(uITextBox_contentEdit, this.CornersTestParams.UITextBox_contentEditSendKeys, ModifierKeys.None); // Click 'spreadsheetPanel1' client Mouse.Click(uISpreadsheetPanel1Client, new Point(1023, 42)); // Type '{Up}{Right}{Down}{Right}{Up}{Up}{Left}{Up}{Right}{Down}' in 'textBox_content' text box Keyboard.SendKeys(uITextBox_contentEdit, this.CornersTestParams.UITextBox_contentEditSendKeys1, ModifierKeys.None); // Click 'spreadsheetPanel1' client Mouse.Click(uISpreadsheetPanel1Client, new Point(1133, 660)); // Type '{Right}{Down}{Down}{Left}{Down}{Down}' in 'textBox_content' text box Keyboard.SendKeys(uITextBox_contentEdit, this.CornersTestParams.UITextBox_contentEditSendKeys2, ModifierKeys.None); // Click 'spreadsheetPanel1' client Mouse.Click(uISpreadsheetPanel1Client, new Point(160, 680)); // Type '{Down}{Left}{Down}{Up}{Left}' in 'textBox_content' text box Keyboard.SendKeys(uITextBox_contentEdit, this.CornersTestParams.UITextBox_contentEditSendKeys3, ModifierKeys.None); }
/// <summary> /// browserAction_method - Use 'browserAction_methodParams' to pass parameters into this method. /// </summary> public void browserAction_method() { #region Variable Declarations WinClient uINewtabInternetExplorClient = this.UINewtabInternetExplorWindow.UIItemWindow.UINewtabInternetExplorClient; WinMenuItem uIToolsMenuItem = this.UINewtabInternetExplorWindow.UIApplicationMenuBar.UIToolsMenuItem; WinMenuItem uIDeletebrowsinghistorMenuItem = this.UIItemWindow.UIContextMenu.UIDeletebrowsinghistorMenuItem; WinButton uIDeleteButton = this.UIDeleteBrowsingHistorWindow.UIDeleteWindow.UIDeleteButton; #endregion // Type '{F10}' in 'New tab - Internet Explorer' client Keyboard.SendKeys(uINewtabInternetExplorClient, this.browserAction_methodParams.UINewtabInternetExplorClientSendKeys, ModifierKeys.None); // Click 'Tools' menu item //Mouse.Click(uIToolsMenuItem); Mouse.Click(uIToolsMenuItem, new Point(24, 14)); // Click 'Delete browsing history... Ctrl+Shift+Del' menu item // Mouse.Click(uIDeletebrowsinghistorMenuItem); Mouse.Click(uIDeletebrowsinghistorMenuItem, new Point(23, 14)); Playback.Wait(50); try { Keyboard.SendKeys("{LEFT}"); Keyboard.SendKeys("{ENTER}"); WriteLogs("PASS : Cleared the Local Stoarge Data : VERIFICATION"); } catch (Exception ex) { WriteLogs("FAIL : Not cleared the Local Storage Data : VERIFICATION"); WriteLogs("---------" + ex.Message.ToString()); } }
/// <summary> /// RecordedMethod2 - Verwenden Sie "RecordedMethod2Params", um Parameter an diese Methode zu übergeben. /// </summary> public void RecordedMethod2() { #region Variable Declarations WinClient uITransportAppClient = this.UITransportAppWindow.UITransportAppClient; WinComboBox uICb_startComboBox = this.UITransportAppWindow.UICb_startWindow.UICb_startComboBox; WinButton uIStationsuchenButton = this.UITransportAppWindow.UIStationsuchenWindow.UIStationsuchenButton; WinComboBox uIBittegebenSieIhreStaComboBox = this.UITransportAppWindow.UICb_endWindow.UIBittegebenSieIhreStaComboBox; WinButton uIStationsuchenButton1 = this.UITransportAppWindow.UIStationsuchenWindow1.UIStationsuchenButton; WinButton uIVerbindungsuchenButton = this.UITransportAppWindow.UIVerbindungsuchenWindow.UIVerbindungsuchenButton; #endregion // Klicken "Transport App" Client Mouse.Click(uITransportAppClient, new Point(148, 33)); // "huob" in "cb_start" Kombinationsfeld auswählen uICb_startComboBox.EditableItem = this.RecordedMethod2Params.UICb_startComboBoxEditableItem; // Klicken "&Station suchen" Schaltfläche Mouse.Click(uIStationsuchenButton, new Point(46, 3)); // "obermattstrasse" in "Bitte geben Sie Ihre Startstation ein:" Kombinationsfeld auswählen uIBittegebenSieIhreStaComboBox.EditableItem = this.RecordedMethod2Params.UIBittegebenSieIhreStaComboBoxEditableItem; // Klicken "Station such&en" Schaltfläche Mouse.Click(uIStationsuchenButton1, new Point(80, 11)); // Klicken "Verbindung suchen" Schaltfläche Mouse.Click(uIVerbindungsuchenButton, new Point(123, 26)); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinClient grid = this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid; WinEdit txt = this.wBreakfieldtextsubstitution.wCommon_txt.txt; WinButton btn = this.wBreakfieldtextsubstitution.wOK.btn; #endregion // Double-Click 'Break field' client Mouse.DoubleClick(grid, new Point(94, 28)); // Type 'a' in text box txt.Text = this.RecordedMethod1Params.txtText; // Double-Click 'Break field' client Mouse.DoubleClick(grid, new Point(228, 31)); // Type 'b' in text box txt.Text = this.RecordedMethod1Params.txtText1; // Type '{Tab}' in text box Keyboard.SendKeys(txt, this.RecordedMethod1Params.txtSendKeys, ModifierKeys.None); // Type '{PageUp}{End}{Home}' in 'Break field' client Keyboard.SendKeys(grid, this.RecordedMethod1Params.gridSendKeys, ModifierKeys.None); // Click 'OK' button Mouse.Click(btn, new Point(17, 3)); }
public void MotoMTAConfirmPolicy(string action) { WinClient uIQuoteResultsClient = map.UIQuoteResultsWindow.UIItemWindow2.UIClient(); WinButton uIAcceptButton = map.UIQuoteResultsWindow.UIAcceptWindow.UIAcceptButton; Mouse.Click(uIQuoteResultsClient, new Point(10, 10)); Keyboard.SendKeys(uIQuoteResultsClient, CommonParams.SendHomeKeys, ModifierKeys.None); Mouse.Click(uIAcceptButton); EtamYes(); ConfirmDocuments(); this.EtamOk(true); DeferPrinting(); ImportToTam(); if (action == "cancel") { SelectTAMActivities2(); } else { SelectTamInsurersAndActivity(selectListItems1: 1, selectListItems2: 1); } }
/// <summary> /// Painting /// </summary> public void RecordedMethod2() { #region Variable Declarations WinClient uIUntitledPaintClient = this.UIUntitledPaintWindow.UIItemWindow.UIUntitledPaintClient; WinButton uIFillwithcolorButton = this.UIUntitledPaintWindow.UIItemWindow1.UIToolsToolBar.UIFillwithcolorButton; WinClient uIUntitledPaintClient1 = this.UIUntitledPaintWindow.UIItemWindow2.UIUntitledPaintClient; WinGroup uIItemGroup = this.UIUntitledPaintWindow.UIItemWindow1.UIColorsToolBar.UIItemGroup; WinListItem uIOvalListItem = this.UIUntitledPaintWindow.UIItemWindow1.UIShapesClient.UIOvalListItem; #endregion // Click 'Untitled - Paint' client Mouse.Click(uIUntitledPaintClient, new Point(405, 20)); // Click 'Fill with color' button Mouse.Click(uIFillwithcolorButton, new Point(22, 15)); // Click 'Untitled - Paint' client Mouse.Click(uIUntitledPaintClient1, new Point(289, 64)); // Click group Mouse.Click(uIItemGroup, new Point(84, 12)); // Click 'Oval' list item Mouse.Click(uIOvalListItem, new Point(13, 7)); // Move 'Untitled - Paint' client Mouse.StartDragging(uIUntitledPaintClient1, new Point(173, 98)); Mouse.StopDragging(uIUntitledPaintClient1, 323, 219); }
public static WinClient GetItemClient() { if (_itemClient == null) { _itemClient = new WinClient(GetWinformHostPane()); } return(_itemClient); }
/// <summary> /// /// </summary> /// <param name="window"></param> /// <param name="controlName"></param> /// <returns></returns> public static WinClient GetClientByControlName(this WinWindow window, string controlName) { WinClient btn = new WinClient(window); btn.TechnologyName = "MSAA"; btn.SearchProperties[WinClient.PropertyNames.ControlName] = controlName; return(btn); }
private static WinClient GetWinClient(string uiTitle, string uiType) { var htmlcontrolWin = new WinClient(Window.Locate(uiTitle, uiType)); var htmlControlWin = htmlcontrolWin; htmlControlWin.TechnologyName = TechnologyNameWin; return(htmlControlWin); }
/// <summary> /// HomePrintQuote_1 - Use 'HomePrintQuote_1Params' to pass parameters into this method. /// </summary> public void HomePrintQuote_1() { #region Variable Declarations WinButton uIOKButton = this.UICurrentOrFutureWindow.UICurrentOrFutureClient.UIOKButton; WinButton uINextButton = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow.UINextButton; WinButton uINextButton1 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow1.UINextButton; WinButton uINextButton2 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow2.UINextButton; WinButton uINextButton3 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow3.UINextButton; WinButton uINextButton4 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow4.UINextButton; WinButton uINextButton5 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow5.UINextButton; WinButton uINextButton6 = this.UIInsurEtamWindow.UIMotorQuotesWindow.UINextWindow6.UINextButton; WinButton uIQuoteButton = this.UIInsurEtamWindow.UIMotorQuotesWindow.UIQuoteWindow.UIQuoteButton; WinButton uINOButton = this.UICreditCheckWindow.UINOWindow.UINOButton; WinClient uIQuotesResultsClient = this.UIQuotesResultsWindow.UIItemWindow.UIQuotesResultsClient; WinButton uIPrintQuoteButton = this.UIQuotesResultsWindow.UIPrintQuoteWindow.UIPrintQuoteButton; #endregion // Click '&Ok' button Mouse.Click(uIOKButton, new Point(40, 5)); // Click '&Next >' button Mouse.Click(uINextButton, new Point(31, 17)); // Click '&Next >' button Mouse.Click(uINextButton1, new Point(39, 17)); // Click '&Next >' button Mouse.Click(uINextButton2, new Point(39, 17)); // Click '&Next >' button Mouse.Click(uINextButton3, new Point(39, 17)); // Click '&Next >' button Mouse.Click(uINextButton4, new Point(39, 17)); // Click '&Next >' button Mouse.Click(uINextButton5, new Point(39, 17)); // Click '&Next >' button Mouse.Click(uINextButton6, new Point(39, 17)); // Click '&Quote' button Mouse.Click(uIQuoteButton, new Point(39, 17)); // Click '&No' button Mouse.Click(uINOButton, new Point(9, 9)); this.PublicCreditCheckOk(); // Click 'Quotes Results' client Mouse.Click(uIQuotesResultsClient, new Point(526, 161)); // Type '{End}' in 'Quotes Results' client Keyboard.SendKeys(uIQuotesResultsClient, this.HomePrintQuote_1Params.UIQuotesResultsClientSendKeys, ModifierKeys.None); // Click '&Print Quote..' button Mouse.Click(uIPrintQuoteButton, new Point(65, 11)); }
/// <summary> /// VerifyWebViewerIsExist - Use 'VerifyWebViewerIsExistExpectedValues' to pass parameters into this method. /// </summary> public void VerifyWebViewerIsExist() { #region Variable Declarations WinClient uIViewportClient = this.UISmartViewProductionQWindow.UISv60_15_51Window.UIItemWindow.UIViewportClient; #endregion // Verify that 'viewport' client's property 'Exists' equals 'True' Assert.AreEqual(this.VerifyWebViewerIsExistExpectedValues.UIViewportClientExists, uIViewportClient.Exists); }
/// <summary> /// LoadClassPropertiesBySelectingDesiredClassFromList /// </summary> public void LoadClassPropertiesBySelectingDesiredClassFromList() { #region Variable Declarations WinClient uIClassesView1BasicClient = this.UISmartViewRecipeManagWindow.UIClassesView1BasicWindow.UIItemWindow.UIClassesView1BasicClient; #endregion // Double-Click 'Classes - View 1: Basic' client Mouse.DoubleClick(uIClassesView1BasicClient, new Point(63, 44)); }
/// <summary> /// btnNextRecordedMethod /// </summary> public void btnNextRecordedMethod() { #region Variable Declarations WinClient uIBtnNextClient = this.UIMyMusicPlayerWindow.UIBtnNextWindow.UIBtnNextClient; #endregion // Kliknij 'btnNext' klient Mouse.Click(uIBtnNextClient, new Point(9, 6)); }
/// <summary> /// RecordedMethod2 /// </summary> public void RecordedMethod2() { #region Variable Declarations WinClient uIFlowTreeClient = this.UIProvisionsPropertiesWindow.UIFlowTreeWindow.UIFlowTreeClient; #endregion // Click 'flowTree' client Mouse.Click(uIFlowTreeClient, new Point(110, 93)); }
/// <summary> /// ClickNameColumnHeader /// </summary> public void ClickNameColumnHeader() { #region Variable Declarations WinClient uISelectSourceFileSvsqClient = this.UISelectSourceFileSvsqWindow.UIItemWindow4.UISelectSourceFileSvsqClient; #endregion // Click 'Select Source File - Svsqa-wes7' client Mouse.Click(uISelectSourceFileSvsqClient, new Point(68, 11)); }
/// <summary> /// 2015-June-20 /// [email protected] /// /// sample: /// pTrancheDefinition._DefinitionFPGrid_RightSelect("Active", "Add new Tranche"); /// pTrancheDefinition._DefinitionFPGrid_RightSelect("Deferred", "Add new Tranche"); /// pTrancheDefinition._DefinitionFPGrid_RightSelect("Pensioner", "Add new Tranche"); /// </summary> /// <param name="sType"></param> /// <param name="sMenuItem"></param> public void _DefinitionFPGrid_RightSelect(string sType, string sMenuItem) { string sFunctionName = "_DefinitionFPGrid_RightSelect"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); WinClient grid = new WinClient(); switch (sType) { case "Active": grid = this.wRetirementStudio.wActive_Definitions_FPGrid.grid; break; case "Deferred": grid = this.wRetirementStudio.wDeferred_Definitions_FPGrid.grid; break; case "Pensioner": grid = this.wRetirementStudio.wPensioner_Definitions_FPGrid.grid; break; default: _gLib._MsgBoxYesNo("Continue Testing?", "Fail: Function <" + sFunctionName + "> failed because input Type does NOT exists."); break; } try { Mouse.Click(grid, MouseButtons.Right, ModifierKeys.None, new Point(30, 40)); } catch (Exception ex) { _gLib._Report(_PassFailStep.Fail, "\t\tFunction <" + sFunctionName + "> fail to Right click ongrid <" + sType + ">. Because of Exception thrown: " + Environment.NewLine + ex.Message); _gLib._MsgBoxYesNo("Continue Testing?", "Fail: Function <" + sFunctionName + "> fail to Right click on TreeView item <" + sType + ">. Because of Exception thrown: " + Environment.NewLine + ex.Message); } WinWindow wWin = new WinWindow(); wWin.SearchProperties.Add(WinWindow.PropertyNames.AccessibleName, "DropDown"); wWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains); wWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); wWin.SearchConfigurations.Add(SearchConfiguration.VisibleOnly); if (_gLib._Exists("DropDown Menu Parent Win", wWin, 0)) { MyDictionary dicTmp = new MyDictionary(); dicTmp.Clear(); dicTmp.Add("Level_1", sMenuItem); _gLib._MenuSelectWin(0, wWin, dicTmp); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// VerifyDefectSummaryIsLoadedSuccessfully - Use 'VerifyDefectSummaryIsLoadedSuccessfullyExpectedValues' to pass parameters into this method. /// </summary> public void VerifyDefectSummaryIsLoadedSuccessfully() { #region Variable Declarations WinClient uIClassSummaryClient = this.UISmartViewProductionQWindow.UITest11Window.UIItemWindow.UIClassSummaryClient; #endregion // Verify that 'classSummary' client's property 'Exists' equals 'True' Assert.AreEqual(this.VerifyDefectSummaryIsLoadedSuccessfullyExpectedValues.UIClassSummaryClientExists, uIClassSummaryClient.Exists); }
/// <summary> /// btnPreviousRecordedMethod /// </summary> public void btnPreviousRecordedMethod() { #region Variable Declarations WinClient uIBtnPreviousClient = this.UIMyMusicPlayerWindow.UIBtnPreviousWindow.UIBtnPreviousClient; #endregion // Kliknij 'btnPrevious' klient Mouse.Click(uIBtnPreviousClient, new Point(12, 10)); }
/// <summary> /// SelectDefectFromLaneViewer /// </summary> public void SelectDefectFromLaneViewer() { #region Variable Declarations WinClient uILaneViewerClient = this.UISmartViewConsole4CamWindow.UILaneViewerWindow.UIItemWindow1.UILaneViewerClient; #endregion // Click 'Lane Viewer' client Mouse.Click(uILaneViewerClient, new Point(238, 109)); }
/// <summary> /// VerifySideLabelsDisplayed - Use 'VerifySideLabelsDisplayedExpectedValues' to pass parameters into this method. /// </summary> public void VerifySideLabelsDisplayed() { #region Variable Declarations WinClient uILaneViewerClient = this.UISmartViewConsole4CamWindow.UILaneViewerWindow.UIItemWindow.UILaneViewerClient; #endregion // Verify that 'Lane Viewer' client's property 'Exists' equals 'True' Assert.AreEqual(this.VerifySideLabelsDisplayedExpectedValues.UILaneViewerClientExists, uILaneViewerClient.Exists); }
/// <summary> /// RecordedMethod4 - Verwenden Sie "RecordedMethod4Params", um Parameter an diese Methode zu übergeben. /// </summary> public void RecordedMethod4() { #region Variable Declarations WinClient uITransportAppClient = this.UITransportAppWindow.UITransportAppClient; WinButton uIVerbindungsuchenButton = this.UITransportAppWindow.UIVerbindungsuchenWindow.UIVerbindungsuchenButton; WinSplitButton uIÄnderungsdatumSplitButton = this.UIDebugWindow.UIItemWindow.UIKopfzeileList.UIÄnderungsdatumSplitButton; WinComboBox uICb_startComboBox = this.UITransportAppWindow.UICb_startWindow.UICb_startComboBox; WinButton uIStationsuchenButton = this.UITransportAppWindow.UIStationsuchenWindow.UIStationsuchenButton; WinComboBox uIBittegebenSieIhreStaComboBox = this.UITransportAppWindow.UICb_endWindow.UIBittegebenSieIhreStaComboBox; WinWindow uIBittegebenSieIhreStaWindow = this.UITransportAppWindow.UITransportAppClient.UIBittegebenSieIhreStaWindow; #endregion // Klicken "Transport App" Client Mouse.Click(uITransportAppClient, new Point(201, 162)); // Doppelklicken "Verbindung suchen" Schaltfläche Mouse.DoubleClick(uIVerbindungsuchenButton, new Point(102, 23)); // Doppelklicken "Verbindung suchen" Schaltfläche Mouse.DoubleClick(uIVerbindungsuchenButton, new Point(104, 25)); // Klicken "Verbindung suchen" Schaltfläche Mouse.Click(uIVerbindungsuchenButton, new Point(104, 25)); // Klicken "Verbindung suchen" Schaltfläche Mouse.Click(uIVerbindungsuchenButton, new Point(121, 22)); // Klicken "Verbindung suchen" Schaltfläche Mouse.Click(uIVerbindungsuchenButton, new Point(121, 22)); // Klicken "Transport App" Client Mouse.Click(uITransportAppClient, new Point(266, 113)); // Klicken "Transport App" Client Mouse.Click(uITransportAppClient, new Point(274, 101)); // Klicken "Transport App" Client Mouse.Click(uITransportAppClient, new Point(293, 113)); // Klicken "Änderungsdatum" Unterteilte Schaltfläche Mouse.Click(uIÄnderungsdatumSplitButton, new Point(36, 13)); // "huob" in "cb_start" Kombinationsfeld auswählen uICb_startComboBox.EditableItem = this.RecordedMethod4Params.UICb_startComboBoxEditableItem; // Klicken "&Station suchen" Schaltfläche Mouse.Click(uIStationsuchenButton, new Point(40, 15)); // "megg" in "Bitte geben Sie Ihre Startstation ein:" Kombinationsfeld auswählen uIBittegebenSieIhreStaComboBox.EditableItem = this.RecordedMethod4Params.UIBittegebenSieIhreStaComboBoxEditableItem; // Klicken "Bitte geben Sie Ihre Startstation ein:" Fenster Mouse.Click(uIBittegebenSieIhreStaWindow, new Point(222, 86)); // Klicken "Verbindung suchen" Schaltfläche Mouse.Click(uIVerbindungsuchenButton, new Point(135, 17)); }
public bool GetWindowExistStatus() { this.mUIAXCWindow = new UIAXCWindow(); WinClient uIClientName = new WinClient(mUIClientName); uIClientName.SearchProperties.Add("ControlType", "Client"); uIClientName.SearchProperties.Add("Name", "Outbound CRM integration"); mUIClientName = uIClientName; return true; }
public bool GetWindowExistStatus() { this.mUIAXCWindow = new UIAXCWindow(); WinClient uIClientName = new WinClient(mUIClientName); uIClientName.TechnologyName = "MSAA"; uIClientName.SearchProperties.Add("ControlType", "BPAY Reversal Payment file send"); uIClientName.SearchProperties.Add("Name", ""); mUIClientName = uIClientName; return true; }
public bool GetWindowExistStatus() { this.mUIAXCWindow = new UIAXCWindow(); WinClient uIClientName = new WinClient(mUIClientName); uIClientName.TechnologyName = "MSAA"; uIClientName.SearchProperties.Add("ControlType", "WinWindow"); uIClientName.SearchProperties.Add("Name", "Filter", PropertyExpressionOperator.Contains); mUIClientName = uIClientName; return true; }
public bool GetWindowExistStatus() { this.mUIAXCWindow = new UIAXCWindow(); WinClient uIClientName = new WinClient(mUIClientName); uIClientName.TechnologyName = "MSAA"; uIClientName.SearchProperties.Add("ControlType", "Client"); uIClientName.SearchProperties.Add("Name", "Import BPAY file"); mUIClientName = uIClientName; return uIClientName.WaitForControlExist(); }
public static void Login(string username, string password) { //Locate Login Form var loginForm = new WinClient(); loginForm.SearchProperties[WinControl.PropertyNames.ControlName] = "frmLogin"; //Locate Username Text Field var usernameTextField = new WinWindow(loginForm); usernameTextField.SearchProperties[WinControl.PropertyNames.ControlName] = "txtUsername"; //Locate Password Text Field var passwordTextField = new WinWindow(loginForm); passwordTextField.SearchProperties[WinControl.PropertyNames.ControlName] = "txtPassword"; //Actions Keyboard.SendKeys(usernameTextField, username); Keyboard.SendKeys(passwordTextField, password); Keyboard.SendKeys(passwordTextField, "{Enter}"); }
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 string GridExport(string GridName, string WhenExported) { string Fileoutput = String.Empty; Trace.WriteLine("Inside GridExport method , waiting"); System.Threading.Thread.Sleep(5000); WinWindow ItemWindow = new WinWindow(GetMainWindow()); ItemWindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770"; ItemWindow.SearchProperties[WinWindow.PropertyNames.Instance] = "45"; ItemWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()); WinControl ItemDialog = new WinControl(ItemWindow); ItemDialog.SearchProperties[UITestControl.PropertyNames.ControlType] = "Dialog"; ItemDialog.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()); WinClient Grid = new WinClient(ItemDialog); Grid.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Grid.SearchProperties[WinControl.PropertyNames.Name] = "Spread Control (spr32d70)"; Grid.SearchProperties[WinControl.PropertyNames.ClassName] = "fpSpread70"; Grid.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()); Grid.DrawHighlight(); var GridPostion = Grid.BoundingRectangle; Point GridClick = new Point(GridPostion.X + 75, GridPostion.Y + 75); Mouse.Move(GridClick); Trace.WriteLine("Moved mouse to gridclick position"); Mouse.Click(MouseButtons.Right); Trace.WriteLine("Right Clicked on Grid " + GridName); System.Threading.Thread.Sleep(1800); WinWindow ItemWin2 = new WinWindow(); ItemWin2.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Context"; ItemWin2.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32768"; WinMenu ContextMenu = new WinMenu(ItemWin2); ContextMenu.SearchProperties[WinMenu.PropertyNames.Name] = "Context"; WinMenuItem ExportItem = new WinMenuItem(ContextMenu); ExportItem.SearchProperties[WinMenuItem.PropertyNames.Name] = "Export..."; Mouse.Hover(ExportItem); Mouse.Click(ExportItem); Trace.WriteLine("Clicked Export Context Menu Button on grid " + GridName); switch (GridName) { case "BeamWellGroupConfig": { string BeamConfigExportLocation = ExportLocation; string BeamConfigExportFileName = ConfigurationManager.AppSettings["BeamConfigExportFileName"]; WinWindow SaveBeamWellConfig = new WinWindow(); SaveBeamWellConfig.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains)); SaveBeamWellConfig.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770"; SaveBeamWellConfig.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinWindow ItemWindowDialog = new WinWindow(SaveBeamWellConfig); ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32"; //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4"; ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinToolBar.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinToolBar LocationBar = new WinToolBar(ItemWindowDialog); LocationBar.WindowTitles.Add((new PropertyExpression(WinToolBar.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinButton PreviousLocation = new WinButton(LocationBar); PreviousLocation.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations"; PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(PreviousLocation); Trace.WriteLine("Clicked Previous Location on Save Dialog "); WinWindow ItemWin1 = new WinWindow(SaveBeamWellConfig); ItemWin1.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477"); ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinEdit AddressEdit = new WinEdit(ItemWin1); AddressEdit.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address"); AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); AddressEdit.Text = BeamConfigExportLocation; Trace.WriteLine("Set export ouput path to " + BeamConfigExportLocation); //Keyboard.SendKeys(BeamConfigExportLocation); Keyboard.SendKeys("{ENTER}"); Trace.WriteLine("Set ENTER key"); WinPane DPane = new WinPane(SaveBeamWellConfig); DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane"; DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinComboBox FileName = new WinComboBox(DPane); FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:"); FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); FileName.EditableItem = BeamConfigExportFileName + WhenExported; Trace.WriteLine("Set FileName of export file to " + BeamConfigExportFileName + WhenExported); WinButton SaveExport = new WinButton(SaveBeamWellConfig); SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save"); SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(SaveExport); Trace.WriteLine("Save Export button clicked"); Fileoutput = (BeamConfigExportLocation + BeamConfigExportFileName + WhenExported + ".txt"); CheckIfExportExists(Fileoutput); break; } case "MOP": { string MOPExportLocation = ExportLocation; string MOPExportFileName = ConfigurationManager.AppSettings["MOPExportFileName"]; WinWindow SaveMOP = new WinWindow(); SaveMOP.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains)); SaveMOP.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770"; SaveMOP.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); WinWindow ItemWindowDialog = new WinWindow(SaveMOP); ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32"; //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4"; ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); WinToolBar LocationBar = new WinToolBar(ItemWindowDialog); LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); WinButton PreviousLocation = new WinButton(LocationBar); PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations"; PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(PreviousLocation); Trace.WriteLine("Clicked Previous Location on Save Dialog "); WinWindow ItemWin1 = new WinWindow(SaveMOP); ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477"); ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); WinEdit AddressEdit = new WinEdit(ItemWin1); AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address"); AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); AddressEdit.Text = MOPExportLocation; Trace.WriteLine("Set export ouput path to " + MOPExportLocation); //Keyboard.SendKeys(BeamConfigExportLocation); Keyboard.SendKeys("{ENTER}"); Trace.WriteLine("Set ENTER key"); WinPane DPane = new WinPane(SaveMOP); DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane"; DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); WinComboBox FileName = new WinComboBox(DPane); FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:"); FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); FileName.EditableItem = MOPExportFileName + WhenExported; Trace.WriteLine("Set FileName of export file to " + MOPExportFileName + WhenExported); WinButton SaveExport = new WinButton(SaveMOP); SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save"); SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(SaveExport); Trace.WriteLine("Save Export button clicked"); Fileoutput = (MOPExportLocation + MOPExportFileName + WhenExported + ".txt"); CheckIfExportExists(Fileoutput); break; } case "ESPGroupConfigGrid": { string ESPGroupConfigGridExportLocation = ExportLocation; string ESPGroupConfigGridExportFileName = ConfigurationManager.AppSettings["ESPConfigExportFileName"]; WinWindow SaveESPGroupConfigGrid = new WinWindow(); SaveESPGroupConfigGrid.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains)); SaveESPGroupConfigGrid.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770"; SaveESPGroupConfigGrid.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinWindow ItemWindowDialog = new WinWindow(SaveESPGroupConfigGrid); ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32"; //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4"; ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinToolBar LocationBar = new WinToolBar(ItemWindowDialog); LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinButton PreviousLocation = new WinButton(LocationBar); PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations"; PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(PreviousLocation); Trace.WriteLine("Clicked Previous Location on Save Dialog "); WinWindow ItemWin1 = new WinWindow(SaveESPGroupConfigGrid); ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477"); ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinEdit AddressEdit = new WinEdit(ItemWin1); AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address"); AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); AddressEdit.Text = ESPGroupConfigGridExportLocation; Trace.WriteLine("Set export ouput path to " + ESPGroupConfigGridExportLocation); //Keyboard.SendKeys(BeamConfigExportLocation); Keyboard.SendKeys("{ENTER}"); Trace.WriteLine("Set ENTER key"); WinPane DPane = new WinPane(SaveESPGroupConfigGrid); DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane"; DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinComboBox FileName = new WinComboBox(DPane); FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:"); FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); FileName.EditableItem = ESPGroupConfigGridExportFileName + WhenExported; Trace.WriteLine("Set FileName of export file to " + ESPGroupConfigGridExportFileName + WhenExported); WinButton SaveExport = new WinButton(SaveESPGroupConfigGrid); SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save"); SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(SaveExport); Trace.WriteLine("Save Export button clicked"); Fileoutput = (ESPGroupConfigGridExportLocation + ESPGroupConfigGridExportFileName + WhenExported + ".txt"); CheckIfExportExists(Fileoutput); break; } case "PCPGroupConfigGrid": { string PCPGroupConfigGridExportLocation = ExportLocation; string PCPGroupConfigGridExportFileName = ConfigurationManager.AppSettings["PCPConfigExportFileName"]; WinWindow SavePCPGroupConfigGrid = new WinWindow(); SavePCPGroupConfigGrid.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains)); SavePCPGroupConfigGrid.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770"; SavePCPGroupConfigGrid.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinWindow ItemWindowDialog = new WinWindow(SavePCPGroupConfigGrid); ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32"; //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4"; ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinToolBar LocationBar = new WinToolBar(ItemWindowDialog); LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinButton PreviousLocation = new WinButton(LocationBar); PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations"; PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(PreviousLocation); Trace.WriteLine("Clicked Previous Location on Save Dialog "); WinWindow ItemWin1 = new WinWindow(SavePCPGroupConfigGrid); ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477"); ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinEdit AddressEdit = new WinEdit(ItemWin1); AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address"); AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); AddressEdit.Text = PCPGroupConfigGridExportLocation; Trace.WriteLine("Set export ouput path to " + PCPGroupConfigGridExportLocation); //Keyboard.SendKeys(BeamConfigExportLocation); Keyboard.SendKeys("{ENTER}"); Trace.WriteLine("Set ENTER key"); WinPane DPane = new WinPane(SavePCPGroupConfigGrid); DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane"; DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); WinComboBox FileName = new WinComboBox(DPane); FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:"); FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); FileName.EditableItem = PCPGroupConfigGridExportFileName + WhenExported; Trace.WriteLine("Set FileName of export file to " + PCPGroupConfigGridExportFileName + WhenExported); WinButton SaveExport = new WinButton(SavePCPGroupConfigGrid); SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save"); SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString())); Mouse.Click(SaveExport); Trace.WriteLine("Save Export button clicked"); Fileoutput = (PCPGroupConfigGridExportLocation + PCPGroupConfigGridExportFileName + WhenExported + ".txt"); CheckIfExportExists(Fileoutput); break; } //PCPGroupConfigGrid } return Fileoutput; }
public UITestControl SurfaceParameterControl(string SurfaceParameterControl) { WinClient Client = new WinClient(GetMainWindow()); Client.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; Client.SearchProperties[WinControl.PropertyNames.Instance] = "3"; Client.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Documento = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(Client); Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = "awb_surfaceparams.htm"; Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; Documento.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = null; Documento.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); UITestControl ReturnThis= new UITestControl(); switch (SurfaceParameterControl) { case "RecalculateCBT": { HtmlButton Button = new HtmlButton(Documento); Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnRecalcCBT"; Button.SearchProperties[HtmlButton.PropertyNames.Name] = null; Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Recalculate CBT"; Button.FilterProperties[HtmlButton.PropertyNames.Class] = null; Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn"; Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "5"; Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); HtmlImage CBTImageBut = new HtmlImage(Button); CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null; CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null; CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null; CBTImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null; CBTImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1"; CBTImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); ReturnThis = CBTImageBut; break; } case "SaveChanges": { HtmlButton Button = new HtmlButton(Documento); Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnSave"; Button.SearchProperties[HtmlButton.PropertyNames.Name] = null; Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Save changes"; Button.FilterProperties[HtmlButton.PropertyNames.Class] = null; Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn"; Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "11"; Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); HtmlImage SaveImageBut = new HtmlImage(Button); SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null; SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null; SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null; SaveImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null; SaveImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1"; SaveImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); ReturnThis = SaveImageBut; break; } case "CBTTxt": { HtmlEdit CBTBox = new HtmlEdit(Documento); CBTBox.SearchProperties[HtmlEdit.PropertyNames.Id] = "eCCBTRQ"; CBTBox.SearchProperties[HtmlEdit.PropertyNames.Name] = null; CBTBox.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null; CBTBox.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE"; CBTBox.FilterProperties[HtmlEdit.PropertyNames.Title] = null; CBTBox.FilterProperties[HtmlEdit.PropertyNames.Class] = "clsFloatEdit"; CBTBox.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=eCCBTRQ dataSrc=#eXml class=clsFloatE"; CBTBox.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "6"; CBTBox.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); ReturnThis = CBTBox; break; } } return ReturnThis; }
public void GetChartClient(string Item) { WinWindow ItemWindow = new WinWindow(GetMainWindow()); ItemWindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "OlectraChart2D"; ItemWindow.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); ; WinClient ChartClient = new WinClient(ItemWindow); ChartClient.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); ; Mouse.Click(ChartClient, MouseButtons.Right); Trace.WriteLine("Right Clicked on Chart"); WinWindow ItemWindow2 = new WinWindow(); ItemWindow2.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Context"; ItemWindow2.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32768"; WinMenu Context = new WinMenu(ItemWindow2); Context.SearchProperties[WinMenu.PropertyNames.Name] = "Context"; WinMenuItem ShowDownholeCardToGet = new WinMenuItem(Context); ShowDownholeCardToGet.SearchProperties[WinMenuItem.PropertyNames.Name] = "Show Downhole Cards"; ShowDownholeCardToGet.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching); WinMenuItem HideDownholeCardToGet = new WinMenuItem(Context); HideDownholeCardToGet.SearchProperties[WinMenuItem.PropertyNames.Name] = "Hide Downhole Cards"; HideDownholeCardToGet.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching); switch (Item) { case "ShowDownHoleCards": { if (ShowDownholeCardToGet.Exists) { Mouse.Click(ShowDownholeCardToGet); Trace.WriteLine("Clicked Show Downhole Cards from context menu"); } break; } case "HideDownHoleCards": { if (HideDownholeCardToGet.Exists) { Mouse.Click(HideDownholeCardToGet); Trace.WriteLine("Clicked Hide Downhole Cards from context menu"); } break; } } }
/// <summary> /// 測試表單左上角的顏色 /// </summary> /// <param name="name">表單的AccessibleName</param> /// <param name="color">待測試的顏色</param> public static void AssertFormBackColor(string name, Color color) { WinWindow winForm = new WinWindow(); winForm.SearchProperties[WinWindow.PropertyNames.Name] = name; WinClient winClient = new WinClient(winForm); winClient.SearchProperties[WinControl.PropertyNames.Name] = name; Image image = winClient.CaptureImage(); Bitmap bitmap = new Bitmap(image); Assert.AreEqual(color.ToArgb(), bitmap.GetPixel(0, 0).ToArgb()); }
public void MOPAddWellStatusWin(string ComboBox, string CBValue, string WellName) { WinWindow MOPAddWellStatWin = new WinWindow(); MOPAddWellStatWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770"); MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Add Well Status/MOP/Type History to Selected Well"); #region CB switch (ComboBox) { case "NewStatus": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "3"); // New Status CB NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { //Mouse.Click(NewStatusComboBox); // NewStatusComboBox.Expanded = true; //WinList List = new WinList(UIListWin); //List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); //List.WindowTitles.Add("ComboBox"); //string[] Items = List.SelectedItems; //foreach (string item in Items) //{ // if (item == CBValue) // { // WinListItem ItemToClick = new WinListItem(UIListWin); // ItemToClick.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); // ItemToClick.SearchProperties.Add(WinListItem.PropertyNames.Name, item); // Mouse.Click(ItemToClick); // } //} while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked Status Combo Box"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded Status Combo Box"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Double Click " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "MOP": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // MOP CB NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked MOP combobox"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded MOP combobox"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Double Click " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "WellType": { WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin); NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo"); //NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First(); WinWindow ComboBoxWindow = new WinWindow(); ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox"; ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); ComboBoxWindow.WindowTitles.Add("ComboBox"); WinWindow UIListWin = new WinWindow(ComboBoxWindow); UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list"; UIListWin.WindowTitles.Add("ComboBox"); if (NewStatusComboBox.SelectedItem != CBValue) { while (NewStatusComboBox.SelectedItem != CBValue) { Mouse.Click(NewStatusComboBox); Trace.WriteLine("Clicked WellType combobox"); //NewStatusComboBox.Expanded = true; //Trace.WriteLine("Expanded WellType combobox"); System.Threading.Thread.Sleep(5000); WinList List = new WinList(UIListWin); List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); List.WindowTitles.Add("ComboBox"); WinListItem Item = new WinListItem(UIListWin); Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue); if (UIListWin.Exists && Item.Exists) { // List.SelectedItemsAsString = CBValue; Mouse.Hover(Item); Trace.WriteLine("Mouse Hover on item " + Item); //System.Threading.Thread.Sleep(3000); Mouse.DoubleClick(Item); Trace.WriteLine("Mouse DoubleClick on item " + Item); } } } Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set"); break; } case "StatusComment": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlTextArea CommentTB = new HtmlTextArea(EventDocument); CommentTB.SearchProperties[HtmlEdit.PropertyNames.Id] = "5"; CommentTB.SearchProperties[HtmlEdit.PropertyNames.Name] = null; CommentTB.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null; CommentTB.FilterProperties[HtmlEdit.PropertyNames.Title] = null; CommentTB.FilterProperties[HtmlEdit.PropertyNames.Class] = "csTextArea"; CommentTB.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "tabIndex=0 id=5 title=\"\" class=csTextAre"; CommentTB.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "1"; CommentTB.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(CommentTB); Trace.WriteLine("Mouse Clicked inside comment textbox"); Keyboard.SendKeys(CommentTB, "A", ModifierKeys.Control); Trace.WriteLine("Control + A sent to textbox"); Keyboard.SendKeys(CBValue); Trace.WriteLine("Textbox comment set to " + CBValue); break; } case "OKGreenCheck": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlButton OkGreenCheck = new HtmlButton(EventDocument); OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Id] = "savebtn"; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Name] = null; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Title] = "Add Well Status Comment"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Class] = null; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=addwlstatevnt() id=savebtn title"; OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "1"; OkGreenCheck.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(OkGreenCheck); Trace.WriteLine("Clicked Green OK Check"); WinButton WarningOKButton = new WinButton(); WarningOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK"; WarningOKButton.WindowTitles.Add("VBScript: Warning"); WinButton ChangedOKButton = new WinButton(); ChangedOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK"; ChangedOKButton.WindowTitles.Add("VBScript: Message"); Rectangle WarningOKButtonRect = WarningOKButton.BoundingRectangle; int WarningOKButtonRectx = (WarningOKButtonRect.X + (WarningOKButtonRect.Width / 2)); int WarningOKButtonRecty = (WarningOKButtonRect.Y + (WarningOKButtonRect.Height / 2)); Mouse.Click(new Point(WarningOKButtonRectx, WarningOKButtonRecty)); Trace.WriteLine("Clicked OK on warning OK button"); if (WellName.Contains("GVFD")) { System.Threading.Thread.Sleep(20000); // ESP to Beam takes an extraordinary amount of time to change the MOP } Rectangle ChangedOKButtonRect = ChangedOKButton.BoundingRectangle; int ChangedOKButtonRectx = (ChangedOKButtonRect.X + (ChangedOKButtonRect.Width / 2)); int ChangedOKButtonRecty = (ChangedOKButtonRect.Y + (ChangedOKButtonRect.Height / 2)); Mouse.Click(new Point(ChangedOKButtonRectx, ChangedOKButtonRecty)); Trace.WriteLine("Clicked OK on MOPChanged OK button"); //Mouse.Click(WarningOKButton); break; } case "RedXButton": { WinClient CommentClient = new WinClient(MOPAddWellStatWin); CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient); EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well"; EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); HtmlButton RedXButton = new HtmlButton(EventDocument); RedXButton.SearchProperties[HtmlButton.PropertyNames.Id] = "first"; RedXButton.SearchProperties[HtmlButton.PropertyNames.Name] = null; RedXButton.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null; RedXButton.SearchProperties[HtmlButton.PropertyNames.Type] = "button"; RedXButton.FilterProperties[HtmlButton.PropertyNames.Title] = "Cancel Add"; RedXButton.FilterProperties[HtmlButton.PropertyNames.Class] = null; RedXButton.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=canceladd() id=first title=\"Canc"; RedXButton.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "2"; RedXButton.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well"); Mouse.Click(RedXButton); Trace.WriteLine("Clicked Red X Check button"); break; } } #endregion }