public void CreateCompetency_SameName()
        {
            int    i    = 0;
            string name = "Competency_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '_').Replace('/', '_');

            while (i < 2)
            {
                Thread.Sleep(2000);
                AddCompetencyButton.Click();
                Thread.Sleep(6000);

                PopupName_Textbox.Clear();
                PopupName_Textbox.SendKeys(name);

                PopupDescription_Textbox.Clear();
                PopupDescription_Textbox.SendKeys("Competency Description");

                PopupActiveYes_RadioButton.Click();

                PopupSubmit_Button.Click();
                i++;
                Thread.Sleep(3000);
                Assert.IsTrue(SuccessMessage.Displayed, name + " - Active Competency is not created successfully");
                ExtentReport.test.Log(LogStatus.Pass, "Success Message is displayed, " + name + " - Active Competency created successfully");
            }
            SearchCompetency(name);

            Assert.AreEqual(2, CompetencyList.Count, "Creating of same name '" + name + "' - Competency was unsuccessful");
            ExtentReport.test.Log(LogStatus.Pass, name + " - Competency of same name has been created successfully and listed properly in the Competencies List Grid");
        }
        public string CreateCompetency(string type, bool isCreate)
        {
            Thread.Sleep(2000);
            if (isCreate)
            {
                AddCompetencyButton.Click();
                Thread.Sleep(6000);
            }

            string name = "Competency_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '_').Replace('/', '_');

            PopupName_Textbox.Clear();
            PopupName_Textbox.SendKeys(name);

            PopupDescription_Textbox.Clear();
            PopupDescription_Textbox.SendKeys("Competency Description " + type);

            if (type == "Active")
            {
                PopupActiveYes_RadioButton.Click();
            }
            else//type will be InActive
            {
                PopupActiveNo_RadioButton.Click();
            }

            PopupSubmit_Button.Click();
            Thread.Sleep(3000);
            Assert.IsTrue(SuccessMessage.Displayed, name + " - " + type + " Competency is not " + formSubmitType + " successfully");
            ExtentReport.test.Log(LogStatus.Pass, "Success Message is displayed, " + name + " - " + type + " Competency " + formSubmitType + " successfully");

            return(name);
        }
        public void VerifyAddPopupElements_CompetencyListPage()
        {
            Thread.Sleep(2000);
            AddCompetencyButton.Click();
            Thread.Sleep(6000);

            Assert.IsTrue(PopupManageCompetency_Title.Displayed, "The title of the Add Competency popup – Manage Competency is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "The title of the Add popup – Manage Competency is displaying in the Competencies List Page");

            Assert.IsTrue(PopupName_Label.Displayed, "Name field label of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Name field label of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupName_Textbox.Displayed, "Name field textbox of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Name field textbox of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupDescription_Label.Displayed, "Description field label of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Description field label of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupDescription_Textbox.Displayed, "Description field textbox of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Description field textbox of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupActive_Label.Displayed, "Active field label of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Active field label of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupActiveYes_RadioButton.Displayed, "Active field Yes Radio button of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Active field Yes Radio button of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupActiveNo_RadioButton.Displayed, "Active field No Radio button of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Active field No Radio button of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupActiveYes_RadioButton.Selected, "Active field is not defaulted to Yes Radio button of the Add Competency popup in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Active field is defaulted to Yes Radio button of the Add Competency popup in the Competencies List Page");

            Assert.IsTrue(PopupSubmit_Button.Displayed, "Submit button of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Submit button of the Add Competency popup is displaying in the Competencies List Page");

            Assert.IsTrue(PopupCancel_Button.Displayed, "Cancel button of the Add Competency popup is not displaying in the Competencies List Page");
            ExtentReport.test.Log(LogStatus.Pass, "Cancel button of the Add Competency popup is displaying in the Competencies List Page");

            CloseButton_Popup.Click();
            Thread.Sleep(2000);
        }
        public void VerifyMandatoryFields_AddCompetency()
        {
            Thread.Sleep(2000);
            AddCompetencyButton.Click();
            Thread.Sleep(6000);

            PopupSubmit_Button.Click();
            Thread.Sleep(2000);

            Assert.IsTrue(ErrorMessage.Displayed, "Error message for validating the competency is not displayed in Add Competency popup");
            ExtentReport.test.Log(LogStatus.Pass, "Error message for validating the competency is displayed in Add Competency popup");

            try
            {
                Assert.IsTrue(PopupName_LabelMandatory.Displayed);
                ExtentReport.test.Log(LogStatus.Info, "Validation for Name field is enabled in Add Competency popup");
                Assert.IsTrue(PopupName_TextboxValidationMessage.Displayed, "Validation message of Name field for validating the competency is not displayed in Add Competency popup");
                ExtentReport.test.Log(LogStatus.Pass, "Validation message of Name field for validating the competency is displayed in Add Competency popup");
            }
            catch (NoSuchElementException e)
            {
                ExtentReport.test.Log(LogStatus.Info, "Validation for Name field is not enabled in Add Competency popup");
            }

            try
            {
                Assert.IsTrue(PopupDescription_LabelMandatory.Displayed);
                ExtentReport.test.Log(LogStatus.Info, "Validation for Description field is enabled in Add Competency popup");
                Assert.IsTrue(PopupDescription_TextboxValidationMessage.Displayed, "Validation message of Description field for validating the competency is not displayed in Add Competency popup");
                ExtentReport.test.Log(LogStatus.Pass, "Validation message of Description field for validating the competency is displayed in Add Competency popup");
            }
            catch (NoSuchElementException e)
            {
                ExtentReport.test.Log(LogStatus.Info, "Validation for Description field is not enabled in Add Competency popup");
            }

            CloseButton_Popup.Click();
            Thread.Sleep(2000);
        }