public void SkillSrchResult() { if (ServiceData.ActvStatusData(RowNum) == "Active") { Thread.Sleep(500); if ((SellerInfo.Text == "Sara Susan") && (ServiceData.TitleData(RowNum) == ServiceInfo.Text)) { TestContext.WriteLine("The service has been found in the search list"); } String CreditCharge = "Charge is :$" + ServiceData.CreditValue(RowNum); String CreditActualVal = Charge.Text; Assert.That(CreditActualVal, Is.EqualTo(CreditCharge)); Service.Click(); } }
//Choose the SkillTrade for the services rendered public void ChooseSkillTrade(String SkillTrade, int Cnt) { if (SkillTrade == "Skill-exchange") { //Click on the SkillExchange radio button SkillExchangeButton.Click(); //Implicit wait Wait.wait(1, driver); String[] Skills = ServiceData.SkillExchangeData(RowNum); //Loop in to read all the tags for (int TagCount = 0; TagCount < Cnt; TagCount++) { //Read the data for Tags from excel in case the services is edited to add new tags SkillExchngTag.SendKeys(Skills[TagCount]); //Press ENTER key to add the tag SkillExchngTag.SendKeys(Keys.Enter); } } else { //Delete the Skill Exchange tags if present any if (Cnt > 0) { for (int TagCount = Cnt; TagCount >= 1; TagCount--) { driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/span[" + TagCount + "]/a")).Click(); } Thread.Sleep(100); } //Change the Skill Trade option to Credit CreditButton.Click(); //Enter the value for Credit Credit.SendKeys(ServiceData.CreditValue(RowNum)); } }
//Choose the radio button based on the Skill Trade public void ChooseSkillTrade(String SkillTrade, int Cnt) { if (SkillTrade == "Skill-exchange") { SkillExchangeButton.Click(); Thread.Sleep(200); String[] Skills = ServiceData.SkillExchangeData(RowNum); for (int TagCount = 0; TagCount < Cnt; TagCount++) { //Read the data for Tags from excel and enter the data into the Tags field for Skill-Exchange SkillExchngTag.SendKeys(Skills[TagCount]); //Press ENTER key to add the tag SkillExchngTag.SendKeys(Keys.Enter); } } else { CreditButton.Click(); Credit.SendKeys(ServiceData.CreditValue(RowNum)); } }
public void ValidateServiceDetail() { //Wait until the page loads and description is visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[1]/div/div/div/div[1]"); //Read the Skill exchange tag count from the excel var SkillExchngCount = ServiceData.TagsCntData(RowNum); //Convert the count of the skill exchange tags from String to integer int Count = Int32.Parse(SkillExchngCount); //Convert the Start Date and End Data format from (dd/mm/yyyy to yyyy-mm-dd) String StartDate = (ServiceData.StrtDateData(RowNum).Substring(4, 4)) + "-" + (ServiceData.StrtDateData(RowNum).Substring(2, 2)) + "-" + (ServiceData.StrtDateData(RowNum).Substring(0, 2)); String EndDate = (ServiceData.EndDateData(RowNum).Substring(4, 4)) + "-" + (ServiceData.EndDateData(RowNum).Substring(2, 2)) + "-" + (ServiceData.EndDateData(RowNum).Substring(0, 2)); //Validate the expected and actual values of the different fields in the services Assert.Multiple(() => { Assert.That(titleServiceDetail.Text, Is.EqualTo(ServiceData.TitleData(RowNum))); Assert.That(DescServiceDetail.Text, Is.EqualTo(ServiceData.DescriptionData(RowNum))); Assert.That(CategoryServiceDetail.Text, Is.EqualTo(ServiceData.CategData(RowNum))); Assert.That(SubCategoryServiceDetail.Text, Is.EqualTo(ServiceData.SubCategData(RowNum))); Assert.That(ServTypeServiceDetail.Text, Is.EqualTo(ServiceData.SrvcTypeData(RowNum))); Assert.That(StartDateServiceDetail.Text, Is.EqualTo(StartDate)); Assert.That(EndDateServiceDetail.Text, Is.EqualTo(EndDate)); Assert.That(LocationTypeServiceDetail.Text, Is.EqualTo(ServiceData.LocatnTypeData(RowNum))); }); //If the skill trade is chosen as "Skill-exchange" then need to validate the Skill exchange tags if (ServiceData.SkillTrdeData(RowNum) == "Skill-exchange") { String[] SkillsTradeData = new String[Count]; String[] SkillExchangeData = ServiceData.SkillExchangeData(RowNum); for (int Counter = 0; Counter < Count; Counter++) { SkillsTradeData[Counter] = driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[4]/div[2]/div/div/div[2]/span[" + (Counter + 1) + "]")).Text; TestContext.WriteLine(SkillsTradeData[Counter]); Assert.That(SkillsTradeData[Counter], Is.EqualTo(SkillExchangeData[Counter])); } //Click on the Manage Listings ManageLstings.Click(); //Wait until the Listings are available in the Manage Listing page Wait.ElementIsVisible(driver, "XPath", "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr/td[4]"); } //If the Skill Exchange is chosen as 'Credit' then validate the credit charge value displayed else if (ServiceData.SkillTrdeData(RowNum) == "Credit") { try { String SkillsTrade = SkillsTradeDisplay.Text; //Enter the title in the serach Box SearchBox.SendKeys(ServiceData.TitleData(RowNum)); //Press enter key to search for the skill SearchBox.SendKeys(Keys.Enter); //Implicit wait for the registeration pop up to be available Wait.wait(2, driver); String CreditCharge = "Charge is :$" + ServiceData.CreditValue(RowNum); String CreditActualVal = Charge.Text; Assert.Multiple(() => { Assert.That(CreditActualVal, Is.EqualTo(CreditCharge)); Assert.That(SkillsTrade, Is.EqualTo("None Specified")); }); //Click on the Manage Listings MngLstngs.Click(); //Wait until the Listings are available in the Manage Listing page Wait.ElementIsVisible(driver, "XPath", "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr/td[4]"); }catch (Exception e) { Assert.Fail("One or more webelements could not be found", e.Message); } } }