internal void ClickDelete() { Global.Base bases = new Global.Base(); Global.Base.ExtentReports(); Thread.Sleep(1000); Global.Base.test = Global.Base.extent.StartTest("Delete skill"); //Populate the Excel Sheet DeleteSkill GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataManageListings.xlsx", "DeleteSkill"); int counts = 0; counts = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; int check = 0; if (counts != 0) { for (var i = 1; i <= counts; i++) { Thread.Sleep(1000); IWebElement Category = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[2]")); IWebElement Title = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement Description = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && Description.Text == ExcelLib.ReadData(2, "Description")) { delete.Click(); Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/button[2]")).Click(); check++; return; } } } }
internal void viewtheskill() { Global.Base bases = new Global.Base(); Global.Base.ExtentReports(); Thread.Sleep(1000); Global.Base.test = Global.Base.extent.StartTest("Share skill Added"); int count = 0; count = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; while (true) { for (var i = 1; i <= count; i++) { Thread.Sleep(1000); IWebElement Category = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[2]")); IWebElement Title = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement Description = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && Description.Text == ExcelLib.ReadData(2, "Description")) { //test = extent.StartTest("Add a Share Skill"); // Global.Base.test.Log(LogStatus.Info, "Snapshot below: " + Global.Base.test.AddScreenCapture(SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"))); Global.Base.test.Log(LogStatus.Pass, "Test Passed, Share Skill Added successfully"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Share skill updated successfully"); Assert.AreEqual(Title.Text, GlobalDefinitions.ExcelLib.ReadData(2, "Title")); return; } } return; } }
internal void YesDelete() { Global.Base bases = new Global.Base(); Global.Base.ExtentReports(); Thread.Sleep(1000); Global.Base.test = Global.Base.extent.StartTest("Delete skill"); int counts = 0; counts = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataManageListings.xlsx", "DeleteSkill"); int check = 0; Thread.Sleep(1000); if (counts != 0) { for (var i = 1; i <= counts; i++) { IWebElement Title = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement desc = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && desc.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Description")) { Global.Base.test.Log(LogStatus.Fail, "Test Failed, Manage Listing Not Deleted"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Manage Listing Not Deleted"); Assert.AreEqual(Title.Text, GlobalDefinitions.ExcelLib.ReadData(2, "Title")); check++; return; } if (check == 0) { Global.Base.test.Log(LogStatus.Pass, "Test passed, Manage Listing Deleted"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Manage Listing Deleted"); Assert.AreEqual(check, 0); return; } } } else { Global.Base.test.Log(LogStatus.Pass, "Test passed, Skill List is Empty"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "List in Manage Listing is Empty"); Assert.AreEqual(counts, 0); } }
internal void ClickView() { GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataManageListings.xlsx", "ViewSkill"); Global.Base bases = new Global.Base(); Global.Base.ExtentReports(); Thread.Sleep(1000); Global.Base.test = Global.Base.extent.StartTest("View skill"); int counts = 0; counts = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; check = 0; if (counts != 0) { if (counts == 1) { Thread.Sleep(1000); IWebElement Category = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr/td[2]")); IWebElement Title = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr/td[3]")); IWebElement Description = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && Description.Text == ExcelLib.ReadData(2, "Description")) { check++; if (check != 0) { view.Click(); viewListing(); } } return; } else { for (var i = 1; i <= counts; i++) { Thread.Sleep(1000); IWebElement Category = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[2]")); IWebElement Title = Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement Description = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && Description.Text == ExcelLib.ReadData(2, "Description")) { check++; if (check != 0) { Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[8]/div/button[1]/i")).Click(); viewListing(); } return; } } } if (check == 0) { check = 1; Global.Base.test.Log(LogStatus.Pass, "Test Passed, Conserened Skill not found"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Conserned Skill not found"); Assert.AreEqual(check, 0); return; } } else { Global.Base.test.Log(LogStatus.Pass, "Test passed, Skill List is Empty for view"); SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "List in Manage Listing is Empty to view"); Assert.AreEqual(counts, 0); } }