//Skill Trade internal void SelectSkillTrade(string skillTrade) { if (skillTrade.Equals("Skill-exchange")) { SkillTradeOptionSkillExchange.Click(); } else if (skillTrade.Equals("Credit")) { SkillTradeOptionCredit.Click(); } }
internal void EditManageListings() { Thread.Sleep(500); //Clicking the manage listing button manageListingsLink.Click(); Thread.Sleep(500); //Clicking edit button(edit is acting as adding option only) edit.Click(); Thread.Sleep(500); //Populating with excel data GlobalDefinitions.ExcelLib.PopulateInCollection(@"MarsFramework\ExcelData\TestDataManageListings.xlsx", "ManageListings"); //Enetering Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Entering Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Selecting Category SelectElement Category = new SelectElement(CategoryDropDown); Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Slecting Subcategory SelectElement SubCategory = new SelectElement(SubCategoryDropDown); SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Entering the Tag Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //Clicking the Service type ServiceTypeOptions.Click(); //Clicking the Type option LocationTypeOption.Click(); //Handling the Date and time Thread.Sleep(500); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Sending start date data Thread.Sleep(500); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //sending end date data Thread.Sleep(1500); //Looping for the targeted day, timings and corresponding check box for (int i = 0; i <= 9; i++) { var checkBox = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/input")); var dayName = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/label")); var startTime = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[2]/input")); var endTime = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[3]/input")); if (GlobalDefinitions.ExcelLib.ReadData(2, "Selectday") == dayName.Text) { Thread.Sleep(500); //Clicking checkbox checkBox.Click(); Thread.Sleep(500); //Entering particular start timing in targeted day startTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); Thread.Sleep(500); //Entering particular End timings in targeted day endTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); break; } } Thread.Sleep(500); //Clicking Skills Exchange SkillTradeOptionSkillExchange.Click(); Thread.Sleep(500); //Enetering Skill Exchnge Tag SkillExchangeTags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange") + "\n"); Thread.Sleep(500); //Clicking Credit SkillTradeOptionCredit.Click(); Thread.Sleep(500); //Entering Credit CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); //Uploading File Thread.Sleep(500); workSamples.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); Thread.Sleep(3000); autoIt.Send(Base.FileToUploadPath); Thread.Sleep(2000); autoIt.Send("{ENTER}"); //Clicking Active option ActiveOption.Click(); //Saving the new/ updated Manage skills Save.Click(); //Asserts Thread.Sleep(3000); var DescriptionAssert = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[4]")).Text; NUnit.Framework.Assert.That(DescriptionAssert, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Description"))); }
internal void EnterShareSkill() { Global.GlobalDefinitions.ExcelLib.PopulateInCollection(AppDomain.CurrentDomain.BaseDirectory.Replace(@"MarsFramework\bin\Debug\", @"MarsFramework\ExcelData\TestDataShareSkill.xlsx"), "ShareSkill"); //wait for element to appear Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.LinkText("Share Skill"), (20)); //Click on the share skill button ShareSkillButton.Click(); //Click on the title field Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("title"), (20)); Title.Click(); //Type on the title field Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Title")); //Click on the description Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("description"), (20)); Description.Click(); //Type on the Description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Description")); //Click on category dropdown CategoryDropDown.Click(); //Choose an option from category dropdown CategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Category") + Keys.Enter); //Click on sub category SubCategoryDropDown.Click(); //Choose an option from subcategory dropdown SubCategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "SubCategory") + Keys.Enter); //Click on Tags Field Tags.Click(); //Type on the Tags Field then press Enter Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Tags") + Keys.Enter); //Click and choose an option for Service type ServiceTypeOptions.Click(); //Click and Choose an option for location type LocationTypeOption.Click(); //click on a skill trade option skill exchange SkillTradeOptionSkillExchange.Click(); //Click on skill exchange SkillExchange.Click(); //Type and add a tag SkillExchange.SendKeys("Test tag" + Keys.Enter); //click on a skill trade option credit SkillTradeOptionCredit.Click(); //Click on credit amount CreditAmount.Click(); //type and add a credit amount CreditAmount.SendKeys("2" + Keys.Enter); //Click an option on Active ActiveOption.Click(); //Save the skill Save.Click(); Thread.Sleep(2000); }