// ****************************   Editing Form Template

        public void Edit_AddQuestionToStep(IWebDriver _driver)
        {
            AddQuestiontoStepPage AQS = new AddQuestiontoStepPage(_driver);

            IList <IWebElement> eleList = QuestionEleList(_driver);

            for (int i = 0; i < eleList.Count; i++)
            {
                IWebElement ele = eleList[i];
                if (_FormType == "Pre Application Form")
                {
                    AQS.AddQuestion(_driver, i, "FormTemplatesData", "Edit_PreApplicationFormLocalQue", (i + 1).ToString());
                }
                else
                {
                    AQS.AddQuestion(_driver, i, "FormTemplatesData", "Edit_AddQuestiontoStep", (i + 1).ToString());
                }
            }
        }
        /// <summary>
        /// Add Local Question to Step
        /// </summary>
        /// <param name="_driver">IWebDriver</param>
        public void AddQuestionToStep(IWebDriver _driver, string ConfigKey, string Sheet)
        {
            AddQuestiontoStepPage AQS = new AddQuestiontoStepPage(_driver);

            IList <IWebElement> eleList = QuestionEleList(_driver);

            for (int i = 0; i < eleList.Count; i++)
            {
                IWebElement ele = eleList[i];
                if (_FormType == "Pre Application Form")
                {
                    AQS.AddQuestion(_driver, i, ConfigKey, "PreApplicationFormLocalQue", (i + 1).ToString());
                }
                else
                {
                    AQS.AddQuestion(_driver, i, ConfigKey, Sheet, (i + 1).ToString());
                }
            }
        }
        public void Edit_Delete_FormTemplate(IWebDriver _driver)
        {
            string _EditFormName = eletxtFormName.GetAttribute("Value");

            LinkFormList();
            IWebElement ele = _driver.FindElement(By.XPath("//div[@class='tableBoundaries']/table/tbody[1]/tr[2]/td[5]/select"));

            BaseMethods.DdlSelectByText(ele, "All");
            BaseMethods.SleepTimeOut(4000);
            #region Edit the Form
            try
            {
                string      _xpath   = "//td[text()='" + _EditFormName + "']/../td[6]/span[1]";
                IWebElement EditLink = _driver.FindElement(By.XPath(_xpath));
                EditLink.Click();
                BaseMethods.InfoLogger("Clicked on Form Edit Link");
                _EditFormName = "Edit_" + _EditFormName;
                FormName(_EditFormName);
                SaveFormTemplate();
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Edit the Form.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Edit the Step
            try
            {
                IWebElement eleStepEdit = _driver.FindElement(By.XPath("(//div[@class='formStepHeader']/span)[2]/a"));
                eleStepEdit.Click();
                BaseMethods.InfoLogger("Clicked on Step Edit Link");
                StepTitle("Edit_Step_Title_Auto");
                BaseMethods.TinyMCEEditor(_driver, StepDescription(), "Entered Step Description");
                BaseMethods.PageScrollDown(_driver);
                QuestionLabelWidth(_driver, "System Default");
                SaveStepDetails();
                BaseMethods.InfoLogger("Clicked on Save button - After Edit");
                string Edit_ExpectedSucessMsg = "×\r\n>   Form Section configuration updated.   ";
                string Edit_ActualSucessMsg   = GetAlertMessage();
                Assert.AreEqual(Edit_ExpectedSucessMsg, Edit_ActualSucessMsg);
                BaseMethods.InfoLogger("Step has been Edited");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Edit the Step.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Edit the Added Question
            try
            {
                IWebElement EditQueEle = _driver.FindElement(By.XPath("//div[@class='formStepArea']/ul/li[1]/div[4]/span[1]"));
                EditQueEle.Click();
                BaseMethods.InfoLogger("Clicked on Question Step Edit Link");
                AddQuestiontoStepPage AQS = new AddQuestiontoStepPage(_driver);
                BaseMethods.TinyMCEEditor(_driver, AQS.eletxtQuestion, "Edit Functionality Testing");
                BaseMethods.PageScrollDown(_driver);
                AQS.Save();
                BaseMethods.InfoLogger("Clicked on Question Save button - After Edit");
                string ExpectedMsg = "×\r\n>   Question saved successfully.   ";
                string ActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(ExpectedMsg, ActualMsg);
                BaseMethods.InfoLogger("Question has been Successfully Edited");
                BaseMethods.Navigate_Back(_driver);
                BaseMethods.Navigate_Back(_driver);
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Edit the Added Question.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Delete the Added Question
            try
            {
                IWebElement DeleteQueEleText = _driver.FindElement(By.XPath("//div[@class='formStepArea']/ul/li[1]/div[3]/strong"));
                string      _DeleteQueText   = DeleteQueEleText.Text;
                IWebElement DeleteQueEle     = _driver.FindElement(By.XPath("//div[@class='formStepArea']/ul/li[1]/div[4]/span[2]"));
                DeleteQueEle.Click();
                BaseMethods.InfoLogger("Clicked on Question Step Delete Link");
                Delete();
                string DeleteExpectedMsg = "×\r\n>   The form question '" + _DeleteQueText + "' was deleted successfully.   ";
                string DeleteActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(DeleteExpectedMsg, DeleteActualMsg);
                BaseMethods.InfoLogger("Question has been Successfully Deleted");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Delete the Added Question.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Delete the Step
            try
            {
                IWebElement eleStepDelete = _driver.FindElement(By.XPath("(//div[@class='formStepHeader']/span)[3]/span/a"));
                eleStepDelete.Click();
                BaseMethods.InfoLogger("Clicked on Step Delete Link");
                BaseMethods.SleepTimeOut(2000);
                Delete();
                string StepDeleteExpectedMsg = "×\r\n>   The form step was deleted successfully.   ";
                string StepDeleteActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(StepDeleteExpectedMsg, StepDeleteActualMsg);
                BaseMethods.InfoLogger("Step has been Successfully Deleted");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Delete the Step.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Preview the Form Template
            try
            {
                string ParentWindow = _driver.CurrentWindowHandle;
                LinkFormList();
                IWebElement Preview = _driver.FindElement(By.XPath("//div[@class='tableBoundaries']/table/tbody[1]/tr[2]/td[5]/select"));
                BaseMethods.DdlSelectByText(Preview, "All");
                BaseMethods.SleepTimeOut(4000);
                string      _Prexpath   = "//td[text()='" + _EditFormName + "']/../td[6]/a";
                IWebElement PreviewLink = _driver.FindElement(By.XPath(_Prexpath));
                PreviewLink.Click();
                BaseMethods.InfoLogger("Clicked on Form Preview Link");
                IList <string> AllWindowHandles = _driver.WindowHandles;
                if (AllWindowHandles.Count > 1)
                {
                    BaseMethods.InfoLogger("Preview has been verified");
                }
                _driver.SwitchTo().Window(AllWindowHandles[1]);
                _driver.Close();
                _driver.SwitchTo().Window(ParentWindow);
            }
            catch (NoSuchWindowException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Preview Form was not Displayed");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Delete the Form Template
            try
            {
                //LinkFormList();
                IWebElement Delele = _driver.FindElement(By.XPath("//div[@class='tableBoundaries']/table/tbody[1]/tr[2]/td[5]/select"));
                BaseMethods.DdlSelectByText(Delele, "All");
                BaseMethods.SleepTimeOut(4000);
                string      _Delxpath  = "//td[text()='" + _EditFormName + "']/../td[6]/span[3]";
                IWebElement DeleteLink = _driver.FindElement(By.XPath(_Delxpath));
                DeleteLink.Click();
                BaseMethods.InfoLogger("Clicked on Form Delete Link");
                Delete();
                string FormDeleteExpectedMsg = "×\r\n>   The Form " + _EditFormName + " has been deleted.   ";
                string FormDeleteActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(FormDeleteExpectedMsg, FormDeleteActualMsg);
                BaseMethods.InfoLogger("Step has been Successfully Deleted");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Delete the Form.");
                Logger.log.Info(ex.Message);
            }
            #endregion
        }
Пример #4
0
        public void Edit_PositionDetailsForm()
        {
            #region Edit the Step
            try
            {
                IWebElement eleStepEdit = _driver.FindElement(By.XPath("(//div[@class='formStepHeader'])[2]/span[2]/a"));
                eleStepEdit.Click();
                BaseMethods.InfoLogger("Clicked on Step Edit Link");
                _05_FormTemplateCreationPage Ftc = new _05_FormTemplateCreationPage(_driver);
                Ftc.StepTitle("Edit_Step_Title_Auto");
                BaseMethods.TinyMCEEditor(_driver, Ftc.StepDescription(), "Entered Step Description");
                BaseMethods.PageScrollDown(_driver);
                Ftc.QuestionLabelWidth(_driver, "System Default");
                Ftc.SaveStepDetails();
                BaseMethods.InfoLogger("Clicked on Save button - After Edit");
                string Edit_ExpectedSucessMsg = "×\r\n>   Form Section configuration updated.   ";
                string Edit_ActualSucessMsg   = GetAlertMessage();
                Assert.AreEqual(Edit_ExpectedSucessMsg, Edit_ActualSucessMsg);
                BaseMethods.InfoLogger("Step has been Edited");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Edit the Step.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Edit the Added Question
            try
            {
                IWebElement EditQueEle = _driver.FindElement(By.XPath("(//div[@class='formStepArea'])[2]/ul/li[1]/div[4]/span[1]"));
                EditQueEle.Click();
                BaseMethods.InfoLogger("Clicked on Question Step Edit Link");
                AddQuestiontoStepPage AQS = new AddQuestiontoStepPage(_driver);
                BaseMethods.TinyMCEEditor(_driver, AQS.eletxtQuestion, "Edit Functionality Testing");
                BaseMethods.PageScrollDown(_driver);
                AQS.Save();
                BaseMethods.InfoLogger("Clicked on Question Save button - After Edit");
                string ExpectedMsg = "×\r\n>   Question saved successfully.   ";
                string ActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(ExpectedMsg, ActualMsg);
                BaseMethods.InfoLogger("Question has been Successfully Edited");
                BaseMethods.Navigate_Back(_driver);
                BaseMethods.Navigate_Back(_driver);
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Edit the Added Question.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Delete the Added Question
            try
            {
                IWebElement DeleteQueEleText = _driver.FindElement(By.XPath("(//div[@class='formStepArea'])[2]/ul/li[1]/div[4]/span[2]/a"));
                string      _DeleteQueText   = DeleteQueEleText.Text;
                IWebElement DeleteQueEle     = _driver.FindElement(By.XPath("//div[@class='formStepArea']/ul/li[1]/div[4]/span[2]"));
                DeleteQueEle.Click();
                BaseMethods.InfoLogger("Clicked on Question Step Delete Link");
                Delete();
                string DeleteExpectedMsg = "×\r\n>   The form question '" + _DeleteQueText + "' was deleted successfully.   ";
                string DeleteActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(DeleteExpectedMsg, DeleteActualMsg);
                BaseMethods.InfoLogger("Question has been Successfully Deleted");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Delete the Added Question.");
                Logger.log.Info(ex.Message);
            }
            #endregion

            #region Delete the Step
            try
            {
                IWebElement eleStepDelete = _driver.FindElement(By.XPath("(//div[@class='formStepHeader'])[2]/span[3]/span/a"));
                eleStepDelete.Click();
                BaseMethods.InfoLogger("Clicked on Step Delete Link");
                BaseMethods.SleepTimeOut(2000);
                Delete();
                string StepDeleteExpectedMsg = "×\r\n>   The form step was deleted successfully.   ";
                string StepDeleteActualMsg   = GetAlertMessage();
                BaseMethods.SoftAssertEqual(StepDeleteExpectedMsg, StepDeleteActualMsg);
                BaseMethods.InfoLogger("Step has been Successfully Deleted");
            }
            catch (NoSuchElementException ex)
            {
                ExtentReport.test.Log(LogStatus.Fatal, "Failed to Delete the Step.");
                Logger.log.Info(ex.Message);
            }
            #endregion
        }
        public void AddLocalQuestion(string ConfigKey, string SheetName)
        {
            AddQuestiontoStepPage AQS = new AddQuestiontoStepPage(driver);

            AQS.AddQuestion(driver, 0, ConfigKey, SheetName, "1");
        }