public void EditService() { //Edit the first item in Listings var manageListingsInstance = new ManageListings(); manageListingsInstance.ClickManageListings(); string firstCategory = Driver.FindElement(By.XPath("//tbody/tr[1]/td[2]")).Text; string firstTitle = Driver.FindElement(By.XPath("//tbody/tr[1]/td[3]")).Text; string firstDescription = Driver.FindElement(By.XPath("//tbody/tr[1]/td[4]")).Text; string firstServiceType = Driver.FindElement(By.XPath("//tbody/tr[1]/td[5]")).Text; string firstSkillTrade = Driver.FindElement(By.XPath("//tbody/tr[1]/td[6]")).Text; manageListingsInstance.ClickEdit(); //Verify if user has been navigated to ServiceListing Page string expectedTitle = "ServiceListing"; string actualTitle = Driver.Title; Assert.That(actualTitle, Is.EqualTo(expectedTitle), "Navigation to ServiceListing Page failed"); //Verify if the Service details are populated in the ServiceListing Page var shareSkillInstance = new ShareSkills(); Assert.IsTrue(shareSkillInstance.ValidateDetails(firstCategory, firstTitle, firstDescription, firstServiceType, firstSkillTrade), "Service details not poplated successfully in edit mode"); //Edit the service #region read data from ShareSkill sheet, row 3 //Populate the excel data ExcelLib.PopulateInCollection(ExcelPath, "ShareSkill"); //Read data string title = ExcelLib.ReadData(3, "Title"); string description = ExcelLib.ReadData(3, "Description"); string category = ExcelLib.ReadData(3, "Category"); string subCategory = ExcelLib.ReadData(3, "SubCategory"); string tags = ExcelLib.ReadData(3, "Tags"); string serviceType = ExcelLib.ReadData(3, "ServiceType"); string locationType = ExcelLib.ReadData(3, "LocationType"); string startDate = ExcelLib.ReadData(3, "Startdate"); string endDate = ExcelLib.ReadData(3, "Enddate"); string day = ExcelLib.ReadData(3, "Selectday"); string startTime = ExcelLib.ReadData(3, "Starttime"); string endTime = ExcelLib.ReadData(3, "Endtime"); string skillTradeOption = ExcelLib.ReadData(3, "SkillTrade"); string skillExchangeTag = ExcelLib.ReadData(3, "Skill-exchange"); string creditAmount = ExcelLib.ReadData(3, "Credit"); string active = ExcelLib.ReadData(3, "Active"); #endregion //Enter the data shareSkillInstance.EditShareSkill(title, description, category, subCategory, tags, serviceType, locationType, startDate, endDate, day, startTime, endTime, skillTradeOption, skillExchangeTag, creditAmount, active); shareSkillInstance.ClickSave(); //Verify if the service has been updated successfully in ListManagement Page //var manageListingsInstance = new ManageListings(); manageListingsInstance.ClickManageListings(); Assert.That(manageListingsInstance.ValidateData(category, title, description, serviceType, skillTradeOption), "Editing Service failed"); }
//Passed public void DeleteService() { //Populate the Excel Sheet ExcelLib.PopulateInCollection(ExcelPath, "ManageListings"); string title = ExcelLib.ReadData(2, "Title"); Console.WriteLine($"the title for deleting is {title}"); //Search service and Delete var managementListingsInstance = new ManageListings(); managementListingsInstance.ClickManageListings(); managementListingsInstance.ClickDelete(title); managementListingsInstance.ClickYes(); //Verify if the service has been deleted string expectedMsg = $"{title} has been deleted"; string actualMsg = Driver.FindElement(By.XPath("/html/body/div/div[@class='ns-box-inner']")).Text; Console.WriteLine("actual msg is " + actualMsg); Console.WriteLine("expected msg is " + expectedMsg); Assert.That(actualMsg, Is.EqualTo(expectedMsg), "Serice has not been deleted"); }
//Failed, Edit not working properly public void EditService() { //Populate the Excel Sheet ExcelLib.PopulateInCollection(ExcelPath, "ManageListings"); string title = ExcelLib.ReadData(2, "Title"); //Search from listing and click edit var managementListingsInstance = new ManageListings(); managementListingsInstance.ClickManageListings(); managementListingsInstance.ClickEdit(title); //Verify if user has been navigated to ServiceListing Page string expectedTitle = "ServiceListing"; string actualTitle = Driver.Title; Assert.That(actualTitle, Is.EqualTo(expectedTitle), "Navigation to ServiceListing Page failed"); //Edit the service #region read data from ShareSkill sheet, row 3 //Populate the excel data ExcelLib.PopulateInCollection(ExcelPath, "ShareSkill"); //Read data //Keep title same //string title = ExcelLib.ReadData(3, "Title"); string description = ExcelLib.ReadData(3, "Description"); string category = ExcelLib.ReadData(3, "Category"); string subCategory = ExcelLib.ReadData(3, "SubCategory"); string tags = ExcelLib.ReadData(3, "Tags"); string serviceType = ExcelLib.ReadData(3, "ServiceType"); string locationType = ExcelLib.ReadData(3, "LocationType"); string startDate = ExcelLib.ReadData(3, "Startdate"); string endDate = ExcelLib.ReadData(3, "Enddate"); string day = ExcelLib.ReadData(3, "Selectday"); string startTime = ExcelLib.ReadData(3, "Starttime"); string endTime = ExcelLib.ReadData(3, "Endtime"); string skillTradeOption = ExcelLib.ReadData(3, "SkillTrade"); string skillExchangeTag = ExcelLib.ReadData(3, "Skill-exchange"); string creditAmount = ExcelLib.ReadData(3, "Credit"); string active = ExcelLib.ReadData(3, "Active"); #endregion //Enter the data var shareSkillInstance = new ShareSkill(); //shareSkillInstance.ClickShareSkill(); shareSkillInstance.EnterShareSkill(title, description, category, subCategory, tags, serviceType, locationType, startDate, endDate, day, startTime, endTime, skillTradeOption, skillExchangeTag, creditAmount, active); shareSkillInstance.ClickSave(); //Verify if the service has been updated successfully in ListManagement Page var manageListingsInstance = new ManageListings(); manageListingsInstance.ClickManageListings(); Assert.That(manageListingsInstance.ValidateData(category, title, description, serviceType, skillTradeOption), "Editing Service failed"); }
public void GivenIClickEditButtonOnTheFirstItemInManagelistingsPage() { //Edit the first item in Listings var manageListingsInstance = new ManageListings(); _scenarioContext["manageListingsInstance"] = manageListingsInstance; manageListingsInstance.ClickManageListings(); _scenarioContext["firstCategory"] = Driver.FindElement(By.XPath("//tbody/tr[1]/td[2]")).Text; _scenarioContext["firstTitle"] = Driver.FindElement(By.XPath("//tbody/tr[1]/td[3]")).Text; _scenarioContext["firstDescription"] = Driver.FindElement(By.XPath("//tbody/tr[1]/td[4]")).Text; _scenarioContext["firstServiceType"] = Driver.FindElement(By.XPath("//tbody/tr[1]/td[5]")).Text; _scenarioContext["firstSkillTrade"] = Driver.FindElement(By.XPath("//tbody/tr[1]/td[6]")).Text; manageListingsInstance.ClickEdit(); }
//Passed, ServiceDetails page not function well public void ViewListings() { //Populate the Excel Sheet ExcelLib.PopulateInCollection(ExcelPath, "ManageListings"); string title = ExcelLib.ReadData(2, "Title"); //Search the service in Listings and click view var manageListingsInstance = new ManageListings(); manageListingsInstance.ClickManageListings(); manageListingsInstance.ClickView(title); //Verify if user is able to click view and view the service details successfully string expectedTitle = "Service Detail"; string actualTitle = Driver.Title; Assert.That(actualTitle, Is.EqualTo(expectedTitle), "Open Service Detail page failed"); }