/// <summary> /// Verified test window grid return some result. It make sure the column "test window name" /// had some value and that it is not empty. Index is the N-th row to check. Index 1, 2 ,3 .... /// Make sure the index is pointing to a data row. /// Index 1 is pagination row /// Index 2 is header row /// Index 3 is the data row /// /// Return true when found the row N-th with some values in the "test window name" column /// </summary> public bool VerifyTestWindowNameColumnHadSomeValues(int index) { Grid.SetGridLists(); SNGridRow row = Grid.GetRowFromList(index - 1); string text = ""; if (row.Type == GridRowType.Data) { PlanHomeRow PlanHomeRow = (PlanHomeRow)row; text = PlanHomeRow.GetTestWindowName(); } // if test window name is not emtpy, values exist if (!string.IsNullOrEmpty(text)) { return(true); } return(false); }
/// <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 <PlanHomeRow> 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 <PlanHomeRow> rowList = new List <PlanHomeRow>(); string text = null; int index = 0; foreach (var row in RowList) { if (row.Type == GridRowType.Data) { PlanHomeRow PlanHomeRow = (PlanHomeRow)row; if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { PlanHomeRow.FakeText = textToFind; } //get the text by column name if (columnName.Equals(PlanHomeColumnNames.TestWindowName)) { text = PlanHomeRow.GetTestWindowName(); //Debug.WriteLine("martin actual text: " + text); //Debug.WriteLine("martin expected text to find: " + textToFind); } if (columnName.Equals(PlanHomeColumnNames.Subject)) { text = PlanHomeRow.GetSubject(); //Debug.WriteLine("martin actual text: " + text); //Debug.WriteLine("martin expected text to find: " + textToFind); } if (columnName.Equals(PlanHomeColumnNames.Grade)) { text = PlanHomeRow.GetGrade(); //Debug.WriteLine("martin actual text: " + text); //Debug.WriteLine("martin expected text to find: " + textToFind); } if (columnName.Equals(PlanHomeColumnNames.TestStage)) { text = PlanHomeRow.GetGrade(); //Debug.WriteLine("martin actual text: " + text); //Debug.WriteLine("martin expected text to find: " + textToFind); } if (columnName.Equals(PlanHomeColumnNames.StartDate)) { text = PlanHomeRow.GetStartDate(); //Debug.WriteLine("martin actual text: " + text); //Debug.WriteLine("martin expected text to find: " + textToFind); } if (columnName.Equals(PlanHomeColumnNames.EndDate)) { text = PlanHomeRow.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(PlanHomeRow); } } } } //may return empty row list if text is not found return(rowList); } }