//Delete a property internal void DeleteAProperty() { try { //Calling the common methods Common_methods(); //property name before delete string PropertyName_BeforeDelete = Driver.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/a/h3")).Text; //Click on the right side menu of the first property RightSideMenu.Click(); Thread.Sleep(1000); //Click on the "Delete" option DeleteOption.Click(); Thread.Sleep(1000); //Click on the "Confirm" button on RemoveProperty page // Create an class and object to call the method RemoveProperty obj = new RemoveProperty(); obj.ConfirmDelete(); Thread.Sleep(2000); //Verification bool isPropertyDeleted = Driver.driver.PageSource.Contains(PropertyName_BeforeDelete); Assert.IsTrue(!isPropertyDeleted); SaveScreenShotClass.SaveScreenshot(Driver.driver, "Delete"); //property name after delete string PropertyName_AfterDelete = Driver.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/a/h3")).Text; if (PropertyName_AfterDelete != PropertyName_BeforeDelete) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Passed, Delete successfull"); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Delete Unsuccessfull"); } } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Delete Unsuccessfull", e.Message); } }
//Edit a property internal void EditAProperty(string TestCaseCode) { try { //Calling the common methods Common_methods(); //property name before edit string PropertyName_BeforeEdit = Driver.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/a/h3")).Text; //Click on the right side menu of the first property RightSideMenu.Click(); Thread.Sleep(1000); //Click on the "Edit Property" option EditOption.Click(); Thread.Sleep(1000); //Click on the "Save" button on Edit Property page // Create an class and object to call the method EditProperty obj = new EditProperty(); if (TestCaseCode == "TC_027_01") { obj.EditAPropertyFromExcelData(); } else if (TestCaseCode == "TC_027_02") { obj.EditAPropertyByUploadPicture(); } else if (TestCaseCode == "TC_027_03") { obj.EditAPropertyBySearchAddress(); } Thread.Sleep(2000); //Verification //property name after edit string PropertyName_AfterEdit = Driver.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/a/h3")).Text; bool isPropertyModified = Driver.driver.PageSource.Contains(PropertyName_AfterEdit); Assert.IsTrue(isPropertyModified); SaveScreenShotClass.SaveScreenshot(Driver.driver, "Edit"); string logSuccess = ""; string logUnsuccess = ""; if (TestCaseCode == "TC_027_01") { logSuccess = "Test Passed, Edit a property from excel data successfull"; logUnsuccess = "Test Failed, Edit a property from excel data Unsuccessfull"; } else if (TestCaseCode == "TC_027_03") { logSuccess = "Test Passed, Edit a property by searching address successfull"; logUnsuccess = "Test Failed, Edit a property by searching address Unsuccessfull"; } else if (TestCaseCode == "TC_027_02") { logSuccess = "Test Passed, Edit a property by uploading a picture successfull"; logUnsuccess = "Test Passed, Edit a property by uploading a picture Unsuccessfull"; } if (PropertyName_AfterEdit != PropertyName_BeforeEdit) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, logSuccess); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, logUnsuccess); } } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Edit Unsuccessfull", e.Message); } }