/// <summary> /// Create Global Questions /// </summary> /// <param name="_driver">IWebDriver</param> public void CreateQuestions(IWebDriver _driver, string Key, string Sheet, string ConditionValue, string Value) { _04_GlobalQtnListPage GQP = new _04_GlobalQtnListPage(_driver); ArrayList list = ExcelData.GetData(Key, Sheet, ConditionValue, Value); int Count = list.Count; int _actualRowCount = Count / 8; int j = 1; for (int i = 0; i < _actualRowCount; i++) { BaseMethods.InfoLogger("Creating Global 0" + (i + 1) + " Question Started"); QuestionDetails(); BaseMethods.DdlSelectByText(eleddlQuestionType, list[j].ToString()); BaseMethods.InfoLogger("Question Type: " + list[(j)].ToString()); string[] formTypesList = list[(j + 1)].ToString().Split(','); BaseMethods.CtrlKeyDown(_driver); for (int k = 0; k < formTypesList.Length; k++) { BaseMethods.DdlSelectByText(eleddlFormType, formTypesList[k]); BaseMethods.InfoLogger("Question Use: " + formTypesList[k].ToString()); } if (list[(j + 2)].ToString() == "Yes") { IsActiveYes(); } else { IsActiveNo(); } ReferenceText(list[(j + 3)].ToString(), true); ShortQuestionText(list[(j + 4)].ToString()); BaseMethods.TinyMCEEditor(_driver, eleFrame, list[(j + 5)].ToString()); Save(); string ExpectedSucessMsg = "×\r\n> Global Question configuration updated successfully. "; string ActualSucessMsg = GetAlertMessage(); BaseMethods.SoftAssertEqual(ExpectedSucessMsg, ActualSucessMsg); if (list[j].ToString() == "Group Question") { CreateGlobalQueWithOptionsPage ChildQue = new CreateGlobalQueWithOptionsPage(_driver); // Click on Answer Options Tab AnswerOptions(); ChildQue.CreateNewChildQuestion(_driver); } if (list[j].ToString() == "Group Question" || list[j].ToString() == "Multi Select") { // Click on Answer Options Tab AnswerOptions(); AddNewAnswers(_driver, list[(j + 6)].ToString()); } j = j + 8; GlobalQuestionLink(); GQP.CreateNewGlbQtn(); } }
public void EditGlobalQuestion(IWebDriver _driver, string Key, string Sheet, string ConditionValue, string Value) { _04_GlobalQtnListPage GQP = new _04_GlobalQtnListPage(_driver); ArrayList list = ExcelData.GetData(Key, Sheet, ConditionValue, Value); int Count = list.Count; int _actualRowCount = Count / 8; int j = 1; for (int i = 0; i < _actualRowCount; i++) { BaseMethods.InfoLogger("Creating Global 0" + (i + 1) + " Question Started"); QuestionDetails(); BaseMethods.DdlSelectByText(eleddlQuestionType, list[j].ToString()); BaseMethods.InfoLogger("Question Type: " + list[(j)].ToString()); string[] formTypesList = list[(j + 1)].ToString().Split(','); BaseMethods.CtrlKeyDown(_driver); for (int k = 0; k < formTypesList.Length; k++) { BaseMethods.DdlSelectByText(eleddlFormType, formTypesList[k]); BaseMethods.InfoLogger("Question Use: " + formTypesList[k].ToString()); } BaseMethods.CtrlKeyUp(_driver); if (list[(j + 2)].ToString() == "Yes") { IsActiveYes(); } else { IsActiveNo(); } ReferenceText(list[(j + 3)].ToString(), true); ShortQuestionText(list[(j + 4)].ToString()); BaseMethods.TinyMCEEditor(_driver, eleFrame, list[(j + 5)].ToString()); Save(); string ExpectedSucessMsg = "×\r\n> Global Question configuration updated successfully. "; string ActualSucessMsg = GetAlertMessage(); BaseMethods.SoftAssertEqual(ExpectedSucessMsg, ActualSucessMsg); if (list[j].ToString() == "Group Question") { CreateGlobalQueWithOptionsPage ChildQue = new CreateGlobalQueWithOptionsPage(_driver); // Click on Answer Options Tab AnswerOptions(); ChildQue.CreateNewChildQuestion(_driver); } if (list[j].ToString() == "Group Question" || list[j].ToString() == "Multi Select") { // Click on Answer Options Tab AnswerOptions(); AddNewAnswers(_driver, list[(j + 6)].ToString()); } // Edit the Question GlobalQuestionLink(); _04_GlobalQtnListPage GlbQtnListPage = new _04_GlobalQtnListPage(_driver); string SearchKeyword = _QuestionReference.Replace("_PM", "").Replace("_AM", ""); GlbQtnListPage.SearchKeyword(_QuestionReference); GlbQtnListPage.Search(); BaseMethods.DdlSelectByText(GlbQtnListPage.eleDdlIsActive, "All"); try { IWebElement ele = _driver.FindElement(By.XPath("//div[@class='tableBoundaries']/table/tbody/tr/td[1]/span/../../td[6]/span[1]")); ele.Click(); QuestionDetails(); if (elerdoIsActiveYES.Selected) { IsActiveNo(); } else { IsActiveYes(); } ReferenceText("Edit_Question Reference Edited", true); ShortQuestionText("Edit_Short Question Edited"); BaseMethods.TinyMCEEditor(_driver, eleFrame, "Global Question Editior Text Modified"); BaseMethods.PageScrollDown(_driver); Save(); string EditExpectedSucessMsg = "×\r\n> Global Question configuration updated successfully. "; string EditActualSucessMsg = GetAlertMessage(); BaseMethods.SoftAssertEqual(EditExpectedSucessMsg, EditActualSucessMsg); ExcelData.InsertData("GlobalQuestionsData", "Delete_GlobalQuestion", "Question_Reference", _QuestionReference); } catch (Exception ex) { Logger.log.Info("No Records Found to Edit" + ex.Message); ExtentReport.test.Log(LogStatus.Fatal, "No Records Found to Edit"); } j = j + 8; GlobalQuestionLink(); GQP.CreateNewGlbQtn(); } }