Example #1
0
        public void CreateBehaviour()
        {
            commonMethodToBehaviourPage();

            IWebElement newCompetency        = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]"));
            IWebElement newCompetencySection = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/.."));

            Assert.IsTrue(newCompetency.Displayed, "New Active Competency '" + activeComp + "' created has not been listed in Competency Behaviour List");
            ExtentReport.test.Log(LogStatus.Pass, "New Active Competency '" + activeComp + "' created has been listed in Competency Behaviour List in seperate section");

            newCompetencySection.Click();

            IWebElement newActiveCompLevel      = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]"));
            IWebElement newActiveCompLevel_Edit = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]/following-sibling::td[2]/a"));

            Thread.Sleep(2000);

            Assert.IsTrue(newActiveCompLevel.Displayed, "Active Competency Level '" + activeCompLevel + "' is not displayed in its respective section");
            ExtentReport.test.Log(LogStatus.Pass, "New Active Competency Level '" + activeCompLevel + "' is displayed in its respective section");

            newActiveCompLevel_Edit.Click();

            IWebElement compName_MngBehaviourPopup = driver.FindElement(By.XPath("//h4[contains(text(),'" + activeComp + "')]"));

            Assert.IsTrue(compName_MngBehaviourPopup.Displayed, "Competency Name '" + activeCompLevel + "' is not displayed in the Manage Behaviour popup of '" + activeCompLevel + "' Competency Level");
            ExtentReport.test.Log(LogStatus.Pass, "Competency Name '" + activeCompLevel + "' is displayed in the Manage Behaviour popup of '" + activeCompLevel + "' Competency Level");

            Assert.IsTrue(AddBehaviourButton.Displayed, "Add Button is not displayed in the Manage Behaviour popup of '" + activeCompLevel + "' Competency Level");
            ExtentReport.test.Log(LogStatus.Pass, "Add Button is displayed in the Manage Behaviour popup of '" + activeCompLevel + "' Competency Level");

            newBehaviour = "Behaviour_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '_').Replace('/', '_');

            NewBehaviourNameTextArea.Clear();
            NewBehaviourNameTextArea.SendKeys(newBehaviour);

            AddBehaviourButton.Click();

            Assert.IsTrue(SuccessMessage.Displayed, "'" + newBehaviour + "' - Behaviour has not been created successfully");
            ExtentReport.test.Log(LogStatus.Pass, "Success Message is displayed, '" + newBehaviour + "' - Behaviour has been created successfully");

            CloseButton_Popup.Click();

            driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/..")).Click();
            IWebElement newActiveCompLevel_Behaviour = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]/following-sibling::td[1]//span[contains(text(),'" + newBehaviour + "')]"));

            Thread.Sleep(2000);

            Assert.IsTrue(newActiveCompLevel_Behaviour.Displayed, "'" + newBehaviour + "' - Behaviour created has not been listed properly for Competency Level '" + activeCompLevel + "' under Competency '" + activeComp + "'");
            ExtentReport.test.Log(LogStatus.Pass, "'" + newBehaviour + "' - Behaviour created has been listed properly for Competency Level '" + activeCompLevel + "' under Competency '" + activeComp + "'");
        }
Example #2
0
        public void EditBehaviour()
        {
            commonMethodToBehaviourPage();

            IWebElement newCompetency        = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]"));
            IWebElement newCompetencySection = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/.."));

            Assert.IsTrue(newCompetency.Displayed, "New Active Competency '" + activeComp + "' created has not been listed in Competency Behaviour List");
            ExtentReport.test.Log(LogStatus.Pass, "New Active Competency '" + activeComp + "' created has been listed in Competency Behaviour List in seperate section");

            newCompetencySection.Click();

            IWebElement newActiveCompLevel      = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]"));
            IWebElement newActiveCompLevel_Edit = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]/following-sibling::td[2]/a"));

            Thread.Sleep(2000);

            newActiveCompLevel_Edit.Click();

            IWebElement compName_MngBehaviourPopup = driver.FindElement(By.XPath("//h4[contains(text(),'" + activeComp + "')]"));

            newBehaviour = "Behaviour_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '_').Replace('/', '_');

            NewBehaviourNameTextArea.Clear();
            NewBehaviourNameTextArea.SendKeys(newBehaviour);

            AddBehaviourButton.Click();

            Thread.Sleep(1000);

            Assert.IsTrue(SuccessMessage.Displayed, "'" + newBehaviour + "' - Behaviour has not been created successfully");
            ExtentReport.test.Log(LogStatus.Pass, "Success Message is displayed, '" + newBehaviour + "' - Behaviour has been created successfully");

            driver.FindElement(By.XPath("//span[text()='" + newBehaviour + "']/../..//button[contains(text(),'Edit')]")).Click();

            Thread.Sleep(2000);

            IWebElement EditBehaviour_SaveButton = driver.FindElement(By.XPath("//textarea[contains(text(),'" + newBehaviour + "')]/../..//button[contains(text(),'Save')]"));

            Assert.IsTrue(EditBehaviour_SaveButton.Displayed, "'" + newBehaviour + "' - Behaviour Save button is not displaying");
            ExtentReport.test.Log(LogStatus.Pass, "'" + newBehaviour + "' - Behaviour Save button has been displayed successfully");

            IWebElement EditBehaviour_CancelButton = driver.FindElement(By.XPath("//textarea[contains(text(),'" + newBehaviour + "')]/../..//button[contains(text(),'Cancel')]"));

            Assert.IsTrue(EditBehaviour_CancelButton.Displayed, "'" + newBehaviour + "' - Behaviour Cancel button is not displaying");
            ExtentReport.test.Log(LogStatus.Pass, "'" + newBehaviour + "' - Behaviour Cancel button has been displayed successfully");

            string oldBehaviour = newBehaviour;

            IWebElement EditBehaviourNameTextArea = driver.FindElement(By.XPath("//textarea[contains(text(),'" + newBehaviour + "')]"));

            newBehaviour = "Behaviour_" + DateTime.Now.ToString().Replace(' ', '_').Replace(':', '_').Replace('/', '_');

            EditBehaviourNameTextArea.Clear();
            EditBehaviourNameTextArea.SendKeys(newBehaviour);

            EditBehaviour_SaveButton.Click();

            Thread.Sleep(3000);

            IWebElement EditedBehaviourListed = driver.FindElement(By.XPath("//span[contains(text(),'" + newBehaviour + "')]"));

            Assert.IsTrue(EditedBehaviourListed.Displayed, "Editing of Behaviour '" + oldBehaviour + "' to '" + newBehaviour + "' was not successful");
            ExtentReport.test.Log(LogStatus.Pass, "Editing of Behaviour '" + oldBehaviour + "' to '" + newBehaviour + "' was completed successfully");

            CloseButton_Popup.Click();

            driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/..")).Click();
            Thread.Sleep(3000);
            IWebElement newActiveCompLevel_Behaviour = driver.FindElement(By.XPath("//h3[contains(text(),'" + activeComp + "')]/../..//td[contains(text(),'" + activeCompLevel + "')]/following-sibling::td[1]//span[contains(text(),'" + newBehaviour + "')]"));

            Assert.IsTrue(newActiveCompLevel_Behaviour.Displayed, "'" + newBehaviour + "' - Behaviour created has not been listed properly for Competency Level '" + activeCompLevel + "' under Competency '" + activeComp + "'");
            ExtentReport.test.Log(LogStatus.Pass, "'" + newBehaviour + "' - Behaviour created has been listed properly for Competency Level '" + activeCompLevel + "' under Competency '" + activeComp + "'");
        }