public void VerifyFieldsExist(List<ViewPortalResultsSearchFields> requiredFields) { //input the required fields foreach (var requiredField in requiredFields) { //wait for the fields. To check if the field is visible. //If field is visible, the field exist if (requiredField.Equals(ViewPortalResultsSearchFields.TestNameId)) { TestNameId.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.Subject)) { this.SubjectSelect.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.GradeLevelFrom)) { this.GradeFromSelect.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.GradeLevelTo)) { this.GradeToSelect.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.AdminDateRangeFrom)) { AdminDateRangeFrom.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.AdminDateRangeTo)) { AdminDateRangeTo.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.DataCollectionStatus)) { DataCollectionStatus.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.TestContent)) { TestContent.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.TestCreatorFirstname)) { TestCreatorFirstName.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.TestCreatorLastname)) { TestCreatorLastName.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.StandardSet)) { StandardSet.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.AdaptiveTests)) { AdaptiveTests.Wait(3); } if (requiredField.Equals(ViewPortalResultsSearchFields.TestCategory)) { TestCategory.Wait(3); } } }
//implemented methods public override void InputFormFields() { if (Data.TestNameId != null) { TestNameId.Clear(); TestNameId.SendKeys(Data.TestNameId); } if (Data.Subject != null) { SubjectSelect.Wait().SelectByText(Data.Subject); } if (Data.GradeLevelFrom != null) { GradeFromSelect.Wait().SelectByText(Data.GradeLevelFrom); } if (Data.GradeLevelTo != null) { GradeToSelect.Wait().SelectByText(Data.GradeLevelTo); } if (Data.AdminDateRangeFrom != null) { AdminDateRangeFrom.Clear(); AdminDateRangeFrom.SendKeys(Data.AdminDateRangeFrom); } if (Data.AdminDateRangeTo != null) { AdminDateRangeTo.Clear(); AdminDateRangeTo.SendKeys(Data.AdminDateRangeTo); } switch (GridName) { case ViewPortalResultsGridNames.MyTests: if (isAdvancedSearchExpanded) { if (Data.DataCollectionStatus != null) { DataCollectionStatus.SelectByText(Data.DataCollectionStatus); } if (Data.TestContent != null) { TestContent.Clear(); TestContent.SendKeys(Data.TestContent); } if (Data.StandardSet != null) { StandardSet.SelectByText(Data.StandardSet); } if (Data.AdaptiveTests != null) { AdaptiveTests.SelectByText(Data.AdaptiveTests); } } break; case ViewPortalResultsGridNames.InProgressTests: if (isAdvancedSearchExpanded) { if (Data.TestContent != null) { TestContent.Clear(); TestContent.SendKeys(Data.TestContent); } if (Data.TestCreatorFirstName != null) { TestCreatorFirstName.Clear(); TestCreatorFirstName.SendKeys(Data.TestCreatorFirstName); } if (Data.TestCreatorLastName != null) { TestCreatorLastName.Clear(); TestCreatorLastName.SendKeys(Data.TestCreatorLastName); } if (Data.StandardSet != null) { StandardSet.SelectByText(Data.StandardSet); } if (Data.AdaptiveTests != null) { AdaptiveTests.SelectByText(Data.AdaptiveTests); } } else { if (Data.DataCollectionStatus != null) { DataCollectionStatus.SelectByText(Data.DataCollectionStatus); } } break; case ViewPortalResultsGridNames.ScheduledTests: if (isAdvancedSearchExpanded) { if (Data.DataCollectionStatus != null) { DataCollectionStatus.SelectByText(Data.DataCollectionStatus); } if (Data.TestContent != null) { TestContent.Clear(); TestContent.SendKeys(Data.TestContent); } if (Data.TestCreatorFirstName != null) { TestCreatorFirstName.Clear(); TestCreatorFirstName.SendKeys(Data.TestCreatorFirstName); } if (Data.TestCreatorLastName != null) { TestCreatorLastName.Clear(); TestCreatorLastName.SendKeys(Data.TestCreatorLastName); } if (Data.StandardSet != null) { StandardSet.SelectByText(Data.StandardSet); } if (Data.AdaptiveTests != null) { AdaptiveTests.SelectByText(Data.AdaptiveTests); } } break; case ViewPortalResultsGridNames.RecommendedTests: if (isAdvancedSearchExpanded) { if (Data.TestContent != null) { TestContent.Clear(); TestContent.SendKeys(Data.TestContent); } if (Data.TestCreatorFirstName != null) { TestCreatorFirstName.Clear(); TestCreatorFirstName.SendKeys(Data.TestCreatorFirstName); } if (Data.TestCreatorLastName != null) { TestCreatorLastName.Clear(); TestCreatorLastName.SendKeys(Data.TestCreatorLastName); } if (Data.StandardSet != null) { StandardSet.SelectByText(Data.StandardSet); } if (Data.AdaptiveTests != null) { AdaptiveTests.SelectByText(Data.AdaptiveTests); } } else { if (Data.TestCategory != null) { TestCategory.SelectByText(Data.TestCategory); } } break; default: throw new ArgumentOutOfRangeException(); } }