Beispiel #1
0
        /// <summary>
        /// click on select link
        /// Index begin at 1, 2, 3...
        /// </summary>
        public void SelectTestUsingSelectLink(int index)
        {
            Grid.SetGridLists();

            ViewTestWindowRow testFound = Grid.GetDataRow(index);

            if (testFound != null)
            {
                Report.Write("Found test: " + testFound + ". Attempting to click on select link.");
                testFound.SelectSelectLink();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sets the Rows List
        /// </summary>
        public override void SetRowLists()
        {
            base.SetRowLists();
            int rowIndex = 0;

            foreach (var webElement in WebElementRows)
            {
                Report.Write("GridRow by index: " + rowIndex);
                GridRowType rowType = GetGridRowType(rowIndex);
                Report.Write("GridRowType: " + rowType);
                var lineItem = new ViewTestWindowRow(gridCssSelector, webElement, rowIndex, rowType, ColumnList, ControlPrefix);
                RowList.Add(lineItem);
                rowIndex++;
            }
        }
Beispiel #3
0
        /// <summary>
        /// gets data row with the specified index. Note: data row are NOT pagination
        /// or header row. Data row is a row with actual data value. For example,
        /// "Mathematics,  Gr 1 - Gr 2, Completed, 01/01/2012".
        ///
        /// </summary>
        /// <param name="index">Index start 1, 2, 3... Index 1 is the first data row user wants</param>
        /// <returns>list of GridRow</returns>
        public ViewTestWindowRow GetDataRow(int index)
        {
            //find where data row start. Usually first 2 rows are pagination and header.
            int firstDataRow = 0;

            for (int i = 0; i < 3; i++)
            {
                if (RowList[i].Type == GridRowType.Data)
                {
                    firstDataRow = i;
                }
            }

            ViewTestWindowRow rowFound = (ViewTestWindowRow)RowList[firstDataRow + index - 1];

            return(rowFound);
        }
Beispiel #4
0
        /// <summary>
        /// gets a list of rows containing the text to find from the row list
        /// </summary>
        /// <param name="columnName">the column name</param>
        /// <param name="textToFind">the text to find</param>
        /// <returns>list of GridRow</returns>
        public new List <ViewTestWindowRow> GetsRowsContainingTextToFindFromList(string columnName, string textToFind)
        {
            if (RowList.Count == 0)
            {//changed to debug for test cases where we want to assert that no search results were found
                Report.Write("No items were found in the search results column list.");
                return(null);
            }
            else
            {
                List <ViewTestWindowRow> rowList = new List <ViewTestWindowRow>();
                string text  = null;
                int    index = 0;
                foreach (var row in RowList)
                {
                    if (row.Type == GridRowType.Data)
                    {
                        ViewTestWindowRow ViewTestWindowRow = (ViewTestWindowRow)row;

                        if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                        {
                            ViewTestWindowRow.FakeText = textToFind;
                        }

                        //get the text by column name
                        if (columnName.Equals(ViewTestWindowColumnNames.TestName))
                        {
                            text = ViewTestWindowRow.GetTestWindowName();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        if (columnName.Equals(ViewTestWindowColumnNames.Subject))
                        {
                            text = ViewTestWindowRow.GetSubject();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        if (columnName.Equals(ViewTestWindowColumnNames.Grade))
                        {
                            text = ViewTestWindowRow.GetGrade();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        if (columnName.Equals(ViewTestWindowColumnNames.TestStage))
                        {
                            text = ViewTestWindowRow.GetGrade();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        if (columnName.Equals(ViewTestWindowColumnNames.StartDate))
                        {
                            text = ViewTestWindowRow.GetStartDate();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        if (columnName.Equals(ViewTestWindowColumnNames.EndDate))
                        {
                            text = ViewTestWindowRow.GetEndDate();
                            //Debug.WriteLine("martin actual text: " + text);
                            //Debug.WriteLine("martin expected text to find: " + textToFind);
                        }
                        //if the text is not null
                        if (text != null)
                        {
                            //if the text contains the text to find
                            if (text.Contains(textToFind))
                            {
                                rowList.Add(ViewTestWindowRow);
                            }
                        }
                    }
                }
                //may return empty row list if text is not found
                return(rowList);
            }
        }