Beispiel #1
0
        /// <summary>
        ///     Selects all rows
        ///     <param name="dataGrid">UI data grid</param>
        ///     <returns>true if row selection sucessfull</returns>
        /// </summary>
        public bool SelectDataGridAllRows(bool selectAll)
        {
            var parent    = QAUIItem.GetParent(UIItem, "parent");
            var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");

            var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow",
                                               container.UIItem);

            if (gotoRowTextBox != null && gotoRowTextBox.Exists)
            {
                gotoRowTextBox.UIItem.SetValue(string.Empty);
                Thread.Sleep(1000);
                if (selectAll)
                {
                    gotoRowTextBox.UIItem.SetValue("all");
                }
                else
                {
                    gotoRowTextBox.UIItem.SetValue("none");
                }
                return(true);
            }
            if (selectAll)
            {
                Report.Output("FAILURE: Failed to select all rows");
            }
            else
            {
                Report.Output("FAILURE: Failed to unselect all rows");
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        ///     Select a row from the table
        /// </summary>
        /// <param name="zeroBasedRowIndex">Index of row to be selected</param>
        public void SelectFirstRow(int zeroBasedRowIndex)
        {
            var searchCriteria = SearchCriteria.ByAutomationId(string.Format("Row_{0}", zeroBasedRowIndex));
            var row            = QATableRow.Get(searchCriteria, string.Empty, UIItem, 5000);
            var firstCell      = QAUIItem.Get(SearchCriteria.Indexed(0), string.Empty, row.UIItem, 5000);
            var location       = firstCell.Location;

            location.X -= 2;
            location.Y += 2;
            QAMouse.Click(new Point((int)location.X, (int)location.Y));
        }
Beispiel #3
0
        /// <summary>
        ///     This is to click a row, this will also select the row
        /// </summary>
        /// <param name="zeroBasedIndex"></param>
        private Point GetRowLocationPoint(int zeroBasedIndex)
        {
            var searchCriteria = SearchCriteria.ByAutomationId(string.Format("Row_{0}", zeroBasedIndex));
            var row            = QADataGridRow.Get(searchCriteria, string.Empty, UIItem, 5000);
            var firstCell      = QAUIItem.Get(SearchCriteria.Indexed(0), string.Empty, row.UIItem, 5000);
            var location       = firstCell.Location;

            location.X -= 2;
            location.Y += 2;

            return(location);
        }
Beispiel #4
0
        /// <summary>
        ///     Copies data to the clipboard from the grid using data grid instead of keyboard shortcut CTRL-C
        /// </summary>
        /// <returns>bool to indicate whether grid based copy was possible</returns>
        private bool CopyGridToClipboardAsCSV(Window window)
        {
            var parent    = QAUIItem.GetParent(UIItem, "parent");
            var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");

            var copyToClipboard = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridCopyToClipboardCSV"),
                                                "copyToClipboard", container.UIItem);

            if (copyToClipboard.Exists)
            {
                copyToClipboard.SetValue("1", false);
                return(true);
            }
            Report.Output("FAILURE: unable to copy to clipboard");
            return(false);
        }
Beispiel #5
0
        /// <summary>
        ///     Sets UI to a specific row
        ///     <param name="dataGrid">UI data grid</param>
        ///     <returns>true if row found</returns>
        /// </summary>
        public bool SelectMultipleDataGridRows(List <int> zeroBasedTargetRows)
        {
            var parent         = QAUIItem.GetParent(UIItem, "parent");
            var container      = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container");
            var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow",
                                               container.UIItem);

            if (gotoRowTextBox != null && gotoRowTextBox.Exists)
            {
                gotoRowTextBox.UIItem.SetValue(string.Empty);
                Thread.Sleep(1000);
                gotoRowTextBox.UIItem.SetValue(string.Join(",", zeroBasedTargetRows));
                return(true);
            }
            Report.Output("FAILURE: Row not found");
            return(false);
        }