public void VerifyMandatoryFields_AddCompetencyLevel() { Thread.Sleep(2000); AddCompetencyLevelButton.Click(); Thread.Sleep(6000); PopupSubmit_Button.Click(); Thread.Sleep(2000); Assert.IsTrue(ErrorMessage.Displayed, "Error message for validating the Competency Level is not displayed in Add Competency Level popup"); ExtentReport.test.Log(LogStatus.Pass, "Error message for validating the Competency Level is displayed in Add Competency Level popup"); try { Assert.IsTrue(PopupName_LabelMandatory.Displayed); ExtentReport.test.Log(LogStatus.Info, "Validation for Name field is enabled in Add Competency Level popup"); Assert.IsTrue(PopupName_TextboxValidationMessage.Displayed, "Validation message of Name field for validating the Competency Level is not displayed in Add Competency Level popup"); ExtentReport.test.Log(LogStatus.Pass, "Validation message of Name field for validating the Competency Level is displayed in Add Competency Level popup"); } catch (NoSuchElementException e) { ExtentReport.test.Log(LogStatus.Info, "Validation for Name field is not enabled in Add Competency Level popup"); } CloseButton_Popup.Click(); Thread.Sleep(2000); }
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 + "'"); }
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 VerifyActionsButton_CompetencyListPage() { if (CompetencyList.Count > 0) { bool searchResult = true; for (int i = 1; i <= CompetencyList.Count; i++) { IWebElement editButton = driver.FindElement(By.XPath("//table/tbody/tr[" + i + "]/td[4]/a[contains(text(),'Edit')]")); if (!editButton.Displayed) { searchResult = false; break; } } Assert.IsTrue(searchResult, "Edit buttons has not been displayed appropriately in the Competencies List Grid"); ExtentReport.test.Log(LogStatus.Pass, "Edit buttons has been displayed appropriately in the Competencies List Grid"); string cName = CompetencyName.Text; Thread.Sleep(2000); CompetencyActionDownButton.Click(); Thread.Sleep(4000); ExtentReport.test.Log(LogStatus.Info, "<b>" + cName + "</b> - Down button clicked and moved the competency down by one row in the Competencies List Grid"); CompetencyActionUpButton.Click(); Thread.Sleep(4000); ExtentReport.test.Log(LogStatus.Info, "<b>" + cName + "</b> - Up button clicked and moved the competency up by one row in the Competencies List Grid"); CompetencyActionEditButton.Click(); Thread.Sleep(6000); Assert.IsTrue(CompetencyEdit_Popup.Displayed, "Edit button click is not opening the Competency Edit popup properly in the Competencies List Grid"); ExtentReport.test.Log(LogStatus.Pass, "Edit button click is opening the Competency Edit popup properly in the Competencies List Grid"); CloseButton_Popup.Click(); Thread.Sleep(3000); } }
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 + "'"); }