/// <summary> /// 尋找DataGridView 裡的NumericUpDown Cell控制項 /// </summary> /// <param name="dataGridViewName">DatGridView的AccessibleName</param> /// <param name="rowIndex">Row的Index,從0開始</param> /// <param name="columnIndex">Column的Index,從0開始</param> /// <param name="direct">欲按的NumericUpDown的增加或減少鍵(增加=NumericDirect.UP,減少=NumericDirect.DOWN)(</param> public static void ClickNumericUpDownButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex, NumericDirect direct, int times) { const int HALF_BUTTON_WIDTH = 8; const int SPINBUTTON_HEIGHT_FINE_TUNE = 3; WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable; WinRow row = table.Rows[rowIndex] as WinRow; WinCell cell = row.Cells[columnIndex] as WinCell; Rectangle boundingRectangle = cell.BoundingRectangle; int halfHeightOfCell = cell.BoundingRectangle.Height / 2; int upperPartYOffset = halfHeightOfCell - SPINBUTTON_HEIGHT_FINE_TUNE; int lowerPartYOffset = halfHeightOfCell + SPINBUTTON_HEIGHT_FINE_TUNE; switch (direct) { case NumericDirect.UP: Mouse.Click(new Point(boundingRectangle.X + boundingRectangle.Width - HALF_BUTTON_WIDTH, boundingRectangle.Y + upperPartYOffset)); break; case NumericDirect.DOWN: Mouse.Click(new Point(boundingRectangle.X + boundingRectangle.Width - HALF_BUTTON_WIDTH, boundingRectangle.Y + lowerPartYOffset)); break; } for (int i = 0; i < times + 1; i++) { Mouse.Click(); } Keyboard.SendKeys("{Enter}"); }
private WinCell FindCellByColumnName(string columnName, WinRow row) { _cell = new WinCell(row); _cell.SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, columnName, PropertyExpressionOperator.Contains)); return(_cell); }
public static Campaign Parse(WinRow oneRowInCampaign) { string runStatusInCell; if (oneRowInCampaign.Cells.Count != 21) { throw new Exception("The count of cell in campaign grid should be equal to 21!"); } if (GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[3]).Contains("Active")) { runStatusInCell = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[3]).Substring(0, 6); } else { runStatusInCell = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[3]); } Campaign campaign = new Campaign { Name = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[2]), RunStatus = runStatusInCell, Budget = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[4]), BudgetType = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[5]), StartTime = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[6]), StopTime = GridViewUtilities.GetValueProperty(oneRowInCampaign.Cells[7]), }; return campaign; }
/// <summary> /// Deletes the index of the data grid view by. /// </summary> /// <param name="data">The data.</param> public static void DeleteDataGridViewByIndex(string[] data) { WinTable table = ( WinTable )Robot.FindWinControl(typeof(WinTable), data[0], _root); WinRow row = new WinRow(table); if (data[3] == string.Empty) { Mouse.Click(table, System.Windows.Forms.MouseButtons.Right); } else { row.SearchProperties.Add(WinRow.PropertyNames.RowIndex, data[3]); row.Find(); UITestControlCollection collection = row.GetChildren(); Mouse.Click(collection[0]); Mouse.Click(collection[0], System.Windows.Forms.MouseButtons.Right); } WinWindow window = new WinWindow(); WinMenu menu = new WinMenu(window); menu.SearchProperties[WinMenu.PropertyNames.Name] = data[1]; WinMenuItem item = new WinMenuItem(menu); item.SearchProperties[WinMenuItem.PropertyNames.Name] = data[2]; Mouse.Click(item); }
/// <summary> /// Always filter by first column first, it will refresh grid /// </summary> public static void FilterGrid(int columnNumber, string filterValue) { var searchRow = new WinRow(WindowCabinet()); searchRow.SearchProperties[UITestControl.PropertyNames.Instance] = "1"; columnNumber = columnNumber - 1; if (columnNumber == 0) { columnNumber = 1; var filterCell = new WinCell(searchRow); filterCell.SearchProperties[UITestControl.PropertyNames.Instance] = columnNumber.ToString(); //Filter row control not supported correctly by Coded UI 2012, that why I'm doing this Keyboard.SendKeys(WindowCabinet(), "{F5}"); Keyboard.SendKeys(filterCell, "{Up}"); Keyboard.SendKeys("{Tab}"); Keyboard.SendKeys("{Tab}", (ModifierKeys.Shift)); Keyboard.SendKeys(filterValue); } else { var filterCell = new WinCell(searchRow); filterCell.SearchProperties[UITestControl.PropertyNames.Instance] = columnNumber.ToString(); //Filter row control not supported correctly by Coded UI 2012, that why I'm doing this Keyboard.SendKeys(filterCell, "{Up}"); Keyboard.SendKeys("{Tab}"); Keyboard.SendKeys(filterValue); } }
private static WinRow GetWinRow(string uiTitle, string uiType) { var htmlcontrolWin = new WinRow(Window.Locate(uiTitle, uiType)); var htmlControlWin = htmlcontrolWin; htmlControlWin.TechnologyName = TechnologyNameWin; return(htmlControlWin); }
public static void ClickButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex) { WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable; WinRow row = table.Rows[rowIndex] as WinRow; WinCell cell = row.Cells[columnIndex] as WinCell; Mouse.Click(cell); }
/// <summary> /// 測試一DataGridView裡的NumericUpDown Cell的值 /// </summary> /// <param name="dataGridViewName">DataGridView 的 AccesibleName</param> /// <param name="rowIndex">NumericUpDown cell所在的row index </param> /// <param name="columnIndex">NumericUpDown cell 所在的 column index</param> /// <param name="value">欲測值</param> public static void AssertDataGridViewNumericUpDownCellValue(string dataGridViewName, int rowIndex, int columnIndex, int value) { WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable; WinRow row = table.Rows[rowIndex] as WinRow; WinCell cell = row.Cells[columnIndex] as WinCell; Assert.AreEqual(cell.Value, value.ToString()); }
/// <summary> /// Assert the specific data grid view's cell /// </summary> /// <param name="name">The data grid view's name</param> /// <param name="rowIndex">row index</param> /// <param name="columnIndex">column index</param> /// <param name="expectedValue">expected value you want to assert</param> /// <exception cref="Exception">If the control is not found</exception> public static void AssertGridViewCell(string name, int rowIndex, int columnIndex, string expectedValue) { WinTable gridView = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow row = (WinRow)gridView.Rows[rowIndex]; WinCell cell = (WinCell)row.Cells[columnIndex]; Assert.AreEqual(expectedValue, cell.GetProperty("Value").ToString()); }
public static void ComaprePayRate(WinRow row, string dispatchDate, string payRate) { var cellVal = Factory.GetCellValueFromRow(row, dispatchDate); Console.WriteLine("Expected Pay Rate on " + dispatchDate + " : " + payRate); Console.WriteLine("Actual Pay Rate on " + dispatchDate + " : " + cellVal); Factory.AssertIsTrue(cellVal.Equals(payRate), "Pay Rate not matched with expected data"); }
public static void ComapreBillRate(WinRow row, string dispatchDate, string billRate) { var cellVal = Factory.GetCellValueFromRow(row, dispatchDate); Console.WriteLine("Expected Bill Rate on " + dispatchDate + " : " + billRate); Console.WriteLine("Actual Bill Rate on " + dispatchDate + " : " + cellVal); //if (!string.IsNullOrEmpty(billRate))// && cellVal != null) Factory.AssertIsTrue(cellVal.Equals(billRate), "Bill Rate not matched with expected data"); }
public static void ClickDeleteButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex) { WinWindow sec = Robot.FindWinControl(typeof(WinWindow), "CustomerSideForm", null) as WinWindow; // WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, sec) as WinTable; WinRow row = table.Rows[rowIndex] as WinRow; WinCell cell = row.Cells[columnIndex] as WinCell; Mouse.Click(cell); }
/// <summary> /// Clicks the data grid view cell. /// </summary> /// <param name="name">The name.</param> /// <param name="rowIndex">Index of the row.</param> /// <param name="cellIndex">Index of the cell.</param> public static void ClickDataGridViewCell(string name, string rowIndex, string cellIndex) { WinTable table = ( WinTable )Robot.FindWinControl(typeof(WinTable), name, _root); WinRow row = new WinRow(table); row.SearchProperties.Add(WinRow.PropertyNames.RowIndex, rowIndex); UITestControlCollection collection = row.GetChildren(); Mouse.Click(collection[int.Parse(cellIndex)]); }
public static void DeleteDataGridViewRowByIndex(string name, string index) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow row = new WinRow(table); row.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index); UITestControlCollection collection = row.GetChildren(); Mouse.Click(collection[0]); }
/// <summary> /// chosePacient /// </summary> public void chosePacient() { #region Variable Declarations WinRow uIBindingList1строка1Row = this.UIКвазарWindow.UIРеестрпациентовWindow.UIBindingList1строка1Row.UIBindingList1Table.UIBindingList1строка1Row; #endregion // Щелкните "BindingList`1 строка 1" строка System.Threading.Thread.Sleep(1500); Mouse.Click(new Point(360, 900)); Mouse.Click(new Point(360, 900)); }
public static void SetDataGridViewValue(string name, string row, string col, string text) { WinTable dataGridView = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow dataGridRow = new WinRow(dataGridView); dataGridRow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, row); UITestControlCollection collection = dataGridRow.GetChildren(); Mouse.Click(collection[int.Parse(col)]); Keyboard.SendKeys(collection[int.Parse(col)], text + "\r\n"); }
/// <summary> /// Assert DataGridView所選Cell顯示的顏色(請勿讓Cell反白,否則可能會錯誤) /// </summary> /// <param name="dataGridViewName">DataGridView的AccessibleName</param> /// <param name="rowIndex">Row的Index,以0開始</param> /// <param name="columnIndex">Column的Index,以0開始</param> /// <param name="color">待測顏色</param> public static void AssertCellColor(string dataGridViewName, int rowIndex, int columnIndex, Color color) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root); WinRow row = (WinRow)table.Rows[rowIndex]; WinCell cell = (WinCell)row.Cells[columnIndex]; Image image = cell.CaptureImage(); Bitmap bitmap = new Bitmap(image); Color pixelColor = bitmap.GetPixel(image.Width / 2, image.Height / 2); Assert.AreEqual(pixelColor.ToArgb(), color.ToArgb()); }
public static void SetDataGridViewQuantity(string name, string index, string qty) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow _Winrow = new WinRow(table); _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index); _Winrow.Find(); UITestControlCollection collection = _Winrow.GetChildren(); WinCell cell = collection[4] as WinCell; cell.Value = qty; }
public static void AssertDataGridViewValue(string name, string row, string col, string key) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow _Winrow = new WinRow(table); _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, row); _Winrow.Find(); UITestControlCollection collection = _Winrow.GetChildren(); WinCell cell = collection[int.Parse(col)] as WinCell; Assert.AreEqual(key, cell.Value); }
public static void AssertDataGridViewByIndex(string name, string index, string[] data) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root); WinRow _Winrow = new WinRow(table); _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index); _Winrow.Find(); UITestControlCollection collection = _Winrow.GetChildren(); for (int i = 0; i < collection.Count; i++) { WinCell cell = collection[i] as WinCell; Assert.AreEqual(data[i], cell.Value); } }
/// <summary> /// AssertMethod1 - Используйте "AssertMethod1ExpectedValues" для передачи параметров в этот метод. /// </summary> public void AssertMethod1() { #region Variable Declarations WinCell uIМоревРусланЕвгеньевиCell = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_registryGridClient.UIResultTableTable.UIResultTableстрока7Row.UIМоревРусланЕвгеньевиCell; WinRow uIResultTableстрока7Row = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_registryGridClient.UIResultTableTable.UIResultTableстрока7Row; #endregion // Убедитесь, что свойство Value "Морев Руслан Евгеньевич" ячейка равняется "Морев Руслан Евгеньевич" Assert.AreEqual(this.AssertMethod1ExpectedValues.UIМоревРусланЕвгеньевиCellValue, uIМоревРусланЕвгеньевиCell.Value, "нет морячка"); // Убедитесь, что свойство Name "ResultTable строка 7" строка равняется "ResultTable строка 7" Assert.AreEqual(this.AssertMethod1ExpectedValues.UIResultTableстрока7RowName, uIResultTableстрока7Row.Name, "не все строки"); }
/// <summary> /// Sets the data grid view cell. /// </summary> /// <param name="name">The name.</param> /// <param name="rowIndex">Index of the row.</param> /// <param name="cellIndex">Index of the cell.</param> /// <param name="value">The value.</param> public static void SetDataGridViewCell(string name, string rowIndex, int cellIndex, string value) { WinTable table = ( WinTable )Robot.FindWinControl(typeof(WinTable), name, _root); WinRow _Winrow = new WinRow(table); _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, rowIndex); _Winrow.Find(); UITestControlCollection collection = _Winrow.GetChildren(); WinCell cell = collection[cellIndex] as WinCell; cell.Value = value; Keyboard.SendKeys("{Enter}"); }
/// <summary> /// Asserts the index of the data grid view by. /// </summary> /// <param name="name">The name.</param> /// <param name="index">The index.</param> /// <param name="data">The data.</param> public static void AssertDataGridViewByIndex(string name, string index, string[] data) { WinTable table = ( WinTable )Robot.FindWinControl(typeof(WinTable), name, _root); WinRow _Winrow = new WinRow(table); _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index); _Winrow.Find(); UITestControlCollection collection = _Winrow.GetChildren(); for (int i = 0; i < collection.Count; i++) { WinCell cell = collection[i] as WinCell; Assert.AreEqual(data[i], cell.Value); } }
public static AccountSummary Parse(WinRow row) { if (row.Cells.Count != 4) { throw new Exception("The count of cell in keyword grid should be equal to 4!"); } int startIndex = 0; AccountSummary accountSummary = new AccountSummary(); accountSummary.PerformanceName = GridViewUtilities.GetValueProperty(row.Cells[startIndex]); accountSummary.Total = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountSummary.Average = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountSummary.DateTime = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); return accountSummary; }
public static Performance Parse(WinRow row, int startIndex) { Performance perf = new Performance { Clicks = GridViewUtilities.GetValueProperty(row.Cells[startIndex]), Impressions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), CTR = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), AvgCPC = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), TotalCost = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), AvgPos = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), ConvRate = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), CPA = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), Convertions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]), }; return perf; }
public void FilterCellValue(string lookupColumn) { int lookupColumnIndex = this.GetColumnIndex(lookupColumn); UITestControlCollection rows = this.element.Rows; int rowCount = rows.Count; if (rowCount > 0) { WinRow row = new WinRow(rows.First()); UITestControlCollection cells = row.Cells; Mouse.Click(cells.ElementAt(lookupColumnIndex), MouseButtons.Left); Mouse.DoubleClick(cells.ElementAt(lookupColumnIndex), MouseButtons.Right); } else { throw new Exception(String.Format("Table is empty")); } }
public static Campaign Parse(WinRow row) { if (row.Cells.Count != 16) { throw new Exception("The count of cell in campaign grid should be equal to 16!"); } Campaign campaign = new Campaign { Name = GridViewUtilities.GetValueProperty(row.Cells[2]), Status = GridViewUtilities.GetValueProperty(row.Cells[3]), BudgetType = GridViewUtilities.GetValueProperty(row.Cells[4]), DailyBudget = GridViewUtilities.GetValueProperty(row.Cells[5]), MonthlyBudget = GridViewUtilities.GetValueProperty(row.Cells[6]), Performance = Performance.Parse(row, 7), }; return campaign; }
private static void EnterHoursInJobOrderSchedule(DataRow data, WinRow row, int daysAfterSaturday) { var now = DateTime.Now; var daysToAdd = 0; var cellName = String.Empty; var startColumn = 63; do { cellName = now.AddDays(daysToAdd).ToString("ddd") + DateTime.Now.AddDays(daysToAdd++).ToString("dMMM"); var dayCell = row.Container.SearchFor <WinCell>(new { Name = cellName }); dayCell.WaitForControlReady(6000); Mouse.Click(dayCell); //The data is in column 63 for Saturday, 65 Sunday, 67 Monday, so the pattern is start at 63, then add 2 * (days after Saturday) to get the current column SendKeys.SendWait(data.ItemArray[startColumn + (2 * daysAfterSaturday)].ToString()); daysAfterSaturday++; SendKeys.SendWait("{TAB}"); } while (!cellName.StartsWith("Fri")); }
public static AdGroup Parse(WinRow row) { if (row.Cells.Count != 19) { throw new Exception("The count of cell in ad group grid should be equal to 19!"); } AdGroup ad = new AdGroup { CampaignName = GridViewUtilities.GetValueProperty(row.Cells[2]), Name = GridViewUtilities.GetValueProperty(row.Cells[3]), Status = GridViewUtilities.GetValueProperty(row.Cells[4]), DefaultMaxCPCBid = GridViewUtilities.GetValueProperty(row.Cells[5]), DisplaytNetworkMaxCPCBid = GridViewUtilities.GetValueProperty(row.Cells[6]), MaxCPMBid = GridViewUtilities.GetValueProperty(row.Cells[7]), CPABid = GridViewUtilities.GetValueProperty(row.Cells[8]), Performance = Performance.Parse(row, 9, true), }; return ad; }
public static AdGroup Parse(WinRow row) { if (row.Cells.Count != 18) { throw new Exception("The count of cell in ad group grid should be equal to 18!"); } AdGroup ad = new AdGroup { CampaignName = GridViewUtilities.GetValueProperty(row.Cells[2]), Name = GridViewUtilities.GetValueProperty(row.Cells[3]), Status = GridViewUtilities.GetValueProperty(row.Cells[4]), StartDate = GridViewUtilities.GetValueProperty(row.Cells[5]), EndDate = GridViewUtilities.GetValueProperty(row.Cells[6]), SearchBid = GridViewUtilities.GetValueProperty(row.Cells[7]), ContentBid = GridViewUtilities.GetValueProperty(row.Cells[8]), Performance = Performance.Parse(row, 9), }; return ad; }
public static string GetCellValueFromRow(WinRow rowC1, string cellHeader) { string cellValue = null; //var select = rowC1.Container.SearchFor<WinCell>(new { Name = cellHeader }); // select.SetFocus(); //cellValue = select.GetProperty("Value").ToString(); var cells = rowC1.Cells; foreach (var cell in cells) { if (cell.Name.Equals(cellHeader)) { cellValue = cell.GetProperty("Value").ToString(); return(cellValue); } } return(""); }
public static TextAdvertisement Parse(WinRow row) { if (row.Cells.Count != 18) { throw new Exception("The count of cell in text ad grid should be equal to 18!"); } TextAdvertisement textAd = new TextAdvertisement { CampaignName = GridViewUtilities.GetValueProperty(row.Cells[2]), AdGroupName = GridViewUtilities.GetValueProperty(row.Cells[3]), Title = GridViewUtilities.GetValueProperty(row.Cells[4]), Text = GridViewUtilities.GetValueProperty(row.Cells[5]), DisplayUrl = GridViewUtilities.GetValueProperty(row.Cells[6]), DestinationUrl = GridViewUtilities.GetValueProperty(row.Cells[7]), AdGroupStatus = GridViewUtilities.GetValueProperty(row.Cells[8]), Performance = Performance.Parse(row, 9), }; return textAd; }
public static void OpenMenuInFilmHireGrid(string cellValue, string rowNumber = "Row 1") { var rowWithCell = new WinRow(WindowFilmHire()); rowWithCell.SearchProperties[UITestControl.PropertyNames.Name] = rowNumber; var cellToInteract = new WinCell(rowWithCell); cellToInteract.SearchProperties[WinCell.PropertyNames.Value] = cellValue; var menuWindow = new WinWindow(); menuWindow.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "DropDown"; var menu = new WinMenu(menuWindow); menu.SearchProperties[UITestControl.PropertyNames.Name] = "DropDown"; var menuItem = new WinMenuItem(menu); menuItem.SearchProperties[UITestControl.PropertyNames.Name] = "Contract Details..."; Mouse.Click(cellToInteract, MouseButtons.Right); Mouse.Click(menuItem); }
public static Campaign Parse(WinRow row) { if (row.Cells.Count != 21) { throw new Exception("The count of cell in campaign grid should be equal to 21!"); } Campaign campaign = new Campaign { Name = GridViewUtilities.GetValueProperty(row.Cells[2]), ServingStatus = GridViewUtilities.GetValueProperty(row.Cells[3]), Status = GridViewUtilities.GetValueProperty(row.Cells[4]), DailyBudget = GridViewUtilities.GetValueProperty(row.Cells[5]), StartDate = GridViewUtilities.GetValueProperty(row.Cells[6]), EndDate = GridViewUtilities.GetValueProperty(row.Cells[7]), SearchNetwork = GridViewUtilities.GetValueProperty(row.Cells[8]), DisplayNetwork = GridViewUtilities.GetValueProperty(row.Cells[9]), BudgetOptimizer = GridViewUtilities.GetValueProperty(row.Cells[10]), Performance = Performance.Parse(row, 11, true), }; return campaign; }
public static TextAdvertisement Parse(WinRow row) { if (row.Cells.Count != 21) { throw new Exception("The count of cell in text ad grid should be equal to 20!"); } TextAdvertisement textAd = new TextAdvertisement { CampaignName = GridViewUtilities.GetValueProperty(row.Cells[2]), AdGroupName = GridViewUtilities.GetValueProperty(row.Cells[3]), AdGroupStatus = GridViewUtilities.GetValueProperty(row.Cells[4]), Headline = GridViewUtilities.GetValueProperty(row.Cells[5]), DisplayUrl = GridViewUtilities.GetValueProperty(row.Cells[6]), DestinationUrl = GridViewUtilities.GetValueProperty(row.Cells[7]), Status = GridViewUtilities.GetValueProperty(row.Cells[8]), ApprovalStatus=GridViewUtilities.GetValueProperty(row.Cells[9]), DescriptionLine1 = GridViewUtilities.GetValueProperty(row.Cells[10]), DescriptionLine2 = GridViewUtilities.GetValueProperty(row.Cells[11]), Performance = Performance.Parse(row, 12, false), }; return textAd; }
public static void VerifyCellExistsInFilmHireGrid(bool shouldExist, List<string> cellValues, string rowNumber = "Row 1", string instanse = "1") { foreach (var cellValue in cellValues) { var rowWithCell = new WinRow(WindowFilmHire()); rowWithCell.SearchProperties[UITestControl.PropertyNames.Name] = rowNumber; var cellToVerify = new WinCell(rowWithCell); cellToVerify.SearchProperties[WinCell.PropertyNames.Value] = cellValue; cellToVerify.SearchProperties[WinCell.PropertyNames.Instance] = instanse; if (shouldExist == true) { Assert.AreEqual(cellValue, cellToVerify.Value); } else { // Use only once in each test , because it is very slow Assert.IsTrue(cellToVerify.WaitForControlNotExist(Playback.PlaybackSettings.SearchTimeout), cellValue + "Exists"); } } }
/// <summary> /// mRemoteNGTest - Use 'mRemoteNGTestParams' to pass parameters into this method. /// </summary> public void mRemoteNGTest() { #region Variable Declarations WinTitleBar uIMRemoteNGconfConsxmlTitleBar = this.UIMRemoteNGconfConsxmlWindow.UIMRemoteNGconfConsxmlTitleBar; WinListItem uIAMZListItem = this.UIMRemoteNGconfConsxmlWindow.UIOlvConnectionsWindow.UIAMZListItem; WinRow uINameRow = this.UIMRemoteNGconfConsxmlWindow.UIPropertyGridViewWindow.UIPropertyGridViewTable.UINameRow; WinRow uIDescriptionRow = this.UIMRemoteNGconfConsxmlWindow.UIPropertyGridViewWindow.UIPropertyGridViewTable.UIDescriptionRow; #endregion // Click 'mRemoteNG - confCons.xml' title bar Mouse.Click(uIMRemoteNGconfConsxmlTitleBar, new Point(95, 19)); // Double-Click 'AMZ' list item Mouse.DoubleClick(uIAMZListItem, new Point(65, 11)); // Click 'Name' row Mouse.Click(uINameRow, new Point(156, 3)); // Type 'Shift + {Left}' in 'Name' row Keyboard.SendKeys(uINameRow, this.mRemoteNGTestParams.UINameRowSendKeys, ModifierKeys.Shift); // Type 'Shift + {Left}' in 'Name' row Keyboard.SendKeys(uINameRow, this.mRemoteNGTestParams.UINameRowSendKeys1, ModifierKeys.Shift); // Type 'Shift + {Left}' in 'Name' row Keyboard.SendKeys(uINameRow, this.mRemoteNGTestParams.UINameRowSendKeys2, ModifierKeys.Shift); // Type 'Shift + {Left}' in 'Name' row Keyboard.SendKeys(uINameRow, this.mRemoteNGTestParams.UINameRowSendKeys3, ModifierKeys.Shift); // Type '{Back}{RShiftKey}AMZ{RShiftKey}Test' in 'Name' row Keyboard.SendKeys(uINameRow, this.mRemoteNGTestParams.UINameRowSendKeys4, ModifierKeys.None); // Click 'Description' row Mouse.Click(uIDescriptionRow, new Point(172, 3)); }
public static Performance Parse(WinRow row) { if (row.Cells.Count != 21) { throw new Exception("The count of cell in keyword grid should be equal to 21!"); } int startIndex = 8; Performance performance = new Performance(); performance.CampaignName = GridViewUtilities.GetValueProperty(row.Cells[2]); performance.Impressions = GridViewUtilities.GetValueProperty(row.Cells[startIndex]); performance.Reach = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.Freq = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.SocialReach = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.Connections = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.Clicks = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.CTR = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.CPC = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.CPM = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.Spent = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.Conversions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.CPA = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); performance.ConversionRate = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); return performance; }
private static void EnterHoursInJobOrderSchedule(DataRow data, WinRow row, int daysAfterSaturday) { var now = DateTime.Now; var daysToAdd = 0; var cellName = String.Empty; var startColumn = 63; do { cellName = now.AddDays(daysToAdd).ToString("ddd") + DateTime.Now.AddDays(daysToAdd++).ToString("dMMM"); var dayCell = row.Container.SearchFor<WinCell>(new { Name = cellName }); dayCell.WaitForControlReady(6000); Mouse.Click(dayCell); //The data is in column 63 for Saturday, 65 Sunday, 67 Monday, so the pattern is start at 63, then add 2 * (days after Saturday) to get the current column SendKeys.SendWait(data.ItemArray[startColumn + (2 * daysAfterSaturday)].ToString()); daysAfterSaturday++; SendKeys.SendWait("{TAB}"); } while (!cellName.StartsWith("Fri")); }
public static void ComapreBillRate(WinRow row, string dispatchDate, string billRate) { var cellVal = Factory.GetCellValueFromRow(row, dispatchDate); Console.WriteLine("Expected Bill Rate on " + dispatchDate + " : " + billRate); Console.WriteLine("Actual Bill Rate on " + dispatchDate + " : " + cellVal); //if (!string.IsNullOrEmpty(billRate))// && cellVal != null) Factory.AssertIsTrue(cellVal.Equals(billRate), "Bill Rate not matched with expected data"); }
public static AccountDetails Parse(WinRow row) { if (row.Cells.Count != 15) { throw new Exception("The count of cell in keyword grid should be equal to 15!"); } int startIndex = 0; AccountDetails accountDetails = new AccountDetails(); accountDetails.Name = GridViewUtilities.GetValueProperty(row.Cells[startIndex]); accountDetails.Impressions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.SocialImpressions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Clicks = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.SocialClicks = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.UniqueClicks = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Connections = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Reach = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Freq = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Spent = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.CTR = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.UniqueCTR = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.Conversions = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.CPA = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); accountDetails.ConversionRate = GridViewUtilities.GetValueProperty(row.Cells[++startIndex]); return accountDetails; }
public static string GetCellValueFromRow(WinRow rowC1, string cellHeader) { string cellValue = null; //var select = rowC1.Container.SearchFor<WinCell>(new { Name = cellHeader }); // select.SetFocus(); //cellValue = select.GetProperty("Value").ToString(); var cells = rowC1.Cells; foreach (var cell in cells) { if (cell.Name.Equals(cellHeader)) { cellValue = cell.GetProperty("Value").ToString(); return cellValue; } } return ""; }
public static void ComaprePayRate(WinRow row, string dispatchDate, string payRate) { var cellVal = Factory.GetCellValueFromRow(row, dispatchDate); Console.WriteLine("Expected Pay Rate on " + dispatchDate + " : " + payRate); Console.WriteLine("Actual Pay Rate on " + dispatchDate + " : " + cellVal); Factory.AssertIsTrue(cellVal.Equals(payRate), "Pay Rate not matched with expected data"); }
public static void DeleteDataGridViewByIndex(string[] data) { WinTable table = (WinTable)Robot.FindWinControl(typeof(WinTable), data[0], _root); WinRow row = new WinRow(table); if (data[3] == string.Empty) { Mouse.Click(table, System.Windows.Forms.MouseButtons.Right); } else { row.SearchProperties.Add(WinRow.PropertyNames.RowIndex, data[3]); row.Find(); UITestControlCollection collection = row.GetChildren(); Mouse.Click(collection[0]); Mouse.Click(collection[0], System.Windows.Forms.MouseButtons.Right); } WinWindow window = new WinWindow(); WinMenu menu = new WinMenu(window); menu.SearchProperties[WinMenu.PropertyNames.Name] = data[1]; WinMenuItem item = new WinMenuItem(menu); item.SearchProperties[WinMenuItem.PropertyNames.Name] = data[2]; Mouse.Click(item); }
public static Keyword Parse(WinRow row) { if (row.Cells.Count != 22) { throw new Exception("The count of cell in keyword grid should be equal to 22!"); } int index = 2; Keyword keyword = new Keyword(); keyword.CampaignName = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.AdGroupName = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Keywords = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.BroadMatchBid = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.ExactMatchBid = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.PhraseMatchBid = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.ContentBid = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.KeywordStatus = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.DesURL = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Placeholder2 = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Placeholder3 = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Performance = Performance.Parse(row, index); return keyword; }
private void FindFirstRow() { _activeRow = new WinRow(_mainGrid); _activeRow.SearchProperties.Add(UITestControl.PropertyNames.Name, "Строка 1"); }
public static Keyword Parse(WinRow row) { if (row.Cells.Count != 22) { throw new Exception("The count of cell in keyword grid should be equal to 22!"); } int index = 2; Keyword keyword = new Keyword(); keyword.CampaignName = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.AdGroupName = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.AdGroupStatus = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Keywords = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.MatchType = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Status = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.ApprovalStatus = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.MaxCPC = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.FirstPageBidEst = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.QualityScore = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.DestinationUrl = GridViewUtilities.GetValueProperty(row.Cells[index++]); keyword.Performance = Performance.Parse(row, index, false); return keyword; }
public static bool TryGetSomeRowsByName(this UITestControl containerControl, WinRow headerRow, string name, List<WinRow> rows) { WinRow row = null; foreach (UITestControl oneRow in containerControl.GetChildren()) { if (oneRow.Equals(headerRow)) { continue; } foreach (UITestControl oneCell in oneRow.GetChildren()) { string actualName = oneCell.GetProperty(WinCell.PropertyNames.Value) as string; if (string.Equals(actualName, name, StringComparison.OrdinalIgnoreCase)) { row = oneRow as WinRow; rows.Add(row); continue; } } } if (rows.Count != 0) { return true; } else { return false; } }
public static bool TryGetOneRowByName(this UITestControl containerControl, WinRow headerRow, string name, out WinRow row) { foreach (UITestControl oneRow in containerControl.GetChildren()) { if (oneRow.Equals(headerRow)) { continue; } foreach (UITestControl oneCell in oneRow.GetChildren()) { string actualName = oneCell.GetProperty(WinCell.PropertyNames.Value) as string; if (string.Equals(actualName, name, StringComparison.OrdinalIgnoreCase)) { row = oneRow as WinRow; return true; } } } row = null; return false; }
public static int GetRowCount(this UITestControl containerControl, WinRow headerRow) { int rowCount = 0; foreach (UITestControl oneRow in containerControl.GetChildren()) { if (oneRow.Equals(headerRow)) { continue; } rowCount++; } return rowCount; }
public static Advertisement Parse(WinRow oneRowInAdGrid) { if (oneRowInAdGrid.Cells.Count != 27) { throw new Exception("The count of cell in ad grid should be equal to 27!"); } Advertisement ad = new Advertisement(); int index = 2; ad.CampaignName = GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]); ad.AdName = GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]); ad.AdStatus = (AdStatus)Enum.Parse(typeof(AdStatus), transferAdStatus(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]))); ad.AdType = (AdType)Enum.Parse(typeof(AdType), transferAdType(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]))); index++; ad.BidType = (BidType)Enum.Parse(typeof(BidType), GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++])); ad.MaxBid = double.Parse(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++])); ad.SuggestedBid = SuggestedBid.Parse(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++])); ad.TargetingEstimation = parseTargetingEstimation(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]).Replace(",", string.Empty)); ad.DestinationUrl = string.IsNullOrEmpty(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index])) ? null : new Uri(GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index])); index++; ad.Title = GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]); ad.Body = GridViewUtilities.GetValueProperty(oneRowInAdGrid.Cells[index++]); return ad; }
public WinRow GetCUITDataRow(WinWindow w, string searchBy, string searchValue, int index) { Console.WriteLine("Inside function GetCUITDataRow"); WinRow GetCUITDataRow = new WinRow(w); Playback.Initialize(); try { switch (searchBy.Trim().ToLower()) { case "text": { if (index == -1) { GetCUITDataRow.SearchProperties[WinRow.PropertyNames.Name] = searchValue; } else { GetCUITDataRow.SearchProperties.Add(WinRow.PropertyNames.Name, searchValue); UITestControlCollection editCollection = GetCUITDataRow.FindMatchingControls(); GetCUITDataRow = (WinRow)editCollection[index]; } break; } case "automationid": { if (index == -1) { GetCUITDataRow.SearchProperties.Add(WinRow.PropertyNames.ControlName, searchValue); UITestControlCollection editCollection = GetCUITDataRow.FindMatchingControls(); GetCUITDataRow = (WinRow)editCollection[0]; } else { GetCUITDataRow.SearchProperties.Add(WinRow.PropertyNames.ControlName, searchValue); UITestControlCollection editCollection = GetCUITDataRow.FindMatchingControls(); GetCUITDataRow = (WinRow)editCollection[index]; } break; } default: throw new Exception(_error); } Playback.Cleanup(); Console.WriteLine("Found Data Row and exiting function GetCUITDataRow"); return GetCUITDataRow; } catch (Exception e) { var st = new StackTrace(e, true); var testFrame = st.GetFrame(0); for (int i = 0; i < st.FrameCount; i++) { testFrame = st.GetFrame(i); if (testFrame.GetFileName() != null) { if (testFrame.GetFileName().ToString().Contains("CUITFramework.cs") == true) { break; } } } // Get the top stack frame var frame = testFrame; // Get the line number from the stack frame var line = frame.GetFileLineNumber(); logTofile(_eLogPtah, "Error in GetCUITEdit and in line: " + line); throw new Exception(_error + "CUITRButton:" + System.Environment.NewLine + e.Message); } }