internal void AddNewSkill(string title, string description, string category, string subcategory, string tags, string credit) { // Click on the Share Skill button on Home page Shareskill.Click(); Thread.Sleep(1000); // Wait for fields to load Thread.Sleep(1000); // Input information into the Title field Title.SendKeys(title); // Input information into the Description field Description.SendKeys(description); // Choose Category Category.SendKeys(category); // Choose Subcategory Subcategory.SendKeys(subcategory); // Input information into the Tags field and press Enter key Tags.SendKeys(tags); Tags.SendKeys(Keys.Enter); // Tick One-off service option of Service Type ServiceType.Click(); // Tick On-site option of Location Type LocationType.Click(); // Set Start date and End date of Available days Startdate.SendKeys("01-06-2019"); Enddate.SendKeys("30-06-2019"); // Tick all weekdays, set Start time as 9:00 and End time as 17:00 for (int i = 1; i <= 5; i++) { GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='fields']//input[@name='Available'][@index='" + i + "']")).Click(); GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='StartTime'][@index='" + i + "']")).SendKeys("0900"); GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='EndTime'][@index='" + i + "']")).SendKeys("1700"); } // Tick Credit option of Skill Trade SkillTrade.Click(); // Input number into price field Credit.SendKeys(credit); // Tick Hidden option of Active Active.Click(); // Click on the Save button Save.Click(); Thread.Sleep(500); }
internal void EditShareSkill(IWebDriver driver) { CommomDriver.Wait(2000); //Click on ShareSkill Button ShareSkillBtn.Click(); //Wait untill driver find title text Field CommomDriver.WaitForVisibility(driver, "Name", "title", 2); //populate login page data collection ExcelLibHelpers.PopulateInCollection(MarsResource.ExcelPath, "EditShareSkill"); //Give a Title Title.SendKeys(ExcelLibHelpers.ReadData(2, "Title")); //Give a Description Description.SendKeys(ExcelLibHelpers.ReadData(2, "Description")); //select one of the option from Category Category.SendKeys(ExcelLibHelpers.ReadData(2, "Category")); ////Select SubCategory Option SubCategory.SendKeys(ExcelLibHelpers.ReadData(2, "Sub Category")); //give input in Tag TextField Tag.SendKeys(ExcelLibHelpers.ReadData(2, "Tag") + Keys.Enter); Tag.SendKeys(ExcelLibHelpers.ReadData(3, "Tag") + Keys.Enter); //choose Radio button option ServiceType.Click(); //Choose Location Location.Click(); //Give StartDate StartDate.SendKeys(ExcelLibHelpers.ReadData(2, "Start Date")); //Give EndDate EndDate.SendKeys(ExcelLibHelpers.ReadData(2, "End Date")); for (int i = 2; i < 9; i++) { for (int j = 2; j < 9; j++) { IWebElement SatrtTime = driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input")); IWebElement EndTime = driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input")); if (i == 2 && j == 2) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(2, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(2, "End Time")); } if (i == 3 && j == 3) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(3, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(3, "End Time")); } if (i == 4 && j == 4) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(4, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(4, "End Time")); } if (i == 5 && j == 5) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(5, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(5, "End Time")); } if (i == 6 && j == 6) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(6, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(6, "End Time")); } if (i == 7 && j == 7) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(7, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(7, "End Time")); } if (i == 8 && j == 8) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(8, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(8, "End Time")); } else { continue; } } } //Click on Share Trade Radio Button SkillTrade.Click(); //give inpute Skill Exchange SkillExchange.SendKeys(ExcelLibHelpers.ReadData(2, "Skill Exchange") + Keys.Enter + ExcelLibHelpers.ReadData(3, "Skill Exchange") + Keys.Enter); //Click on Work Sample WorkSample.Click(); //Handle the window that not belongs to Browser -AutoIt - see blog for more info //below line execute the AutoIT script //Create an object for AutoIt AutoItX3 autoIt = new AutoItX3(); //This statement Active the window and perform set of auctions autoIt.WinActivate("Open"); Thread.Sleep(1000); //set the path to open the file on browser autoIt.Send(@"D:\scrummeeting.png"); Thread.Sleep(1000); //It will click on "Open" button autoIt.Send("{ENTER}"); //click on active radio button Active.Click(); //click on save button savebtn.Click(); CommomDriver.Wait(2); //For Assertion- Go to manage list ManageList.Click(); //Get the text from manage list of Title and Category String ManageTitle = TitleofManage.Text; String ManageListCategory = CategoryofManage.Text; try { //For Assertion - After Save Skills For varification, //Goto manage list page and match Title and Cetegory with Excel Enter Skill Assert.AreEqual(ManageTitle, ExcelLibHelpers.ReadData(2, "Title")); Assert.AreEqual(ManageListCategory, ExcelLibHelpers.ReadData(2, "Category")); } catch (Exception e) { Console.WriteLine(e.Message); } }
////Click on View Button //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[1]/td[8]/i[1]")] //private IWebElement ViewBtn { get; set; } #endregion #region Add Skills public void AddShareSkills() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills"); Thread.Sleep(2000); //Click on ShareSkills Thread.Sleep(5000); Shareskills.Click(); //Click on Title Thread.Sleep(5000); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Thread.Sleep(500); //Click on Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Base.test.Log(LogStatus.Info, "Description Added Sucessfully"); //Add Category Thread.Sleep(4000); //Actions action = new Actions(GlobalDefinitions.driver); //action.Click(Category); Category.Click(); //action.MoveToElement(Category).Build().Perform(); Console.WriteLine("Clicked on the Category"); Thread.Sleep(2000); IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option")); int Count = CategoryList.Count; Thread.Sleep(500); for (int i = 0; i < Count; i++) { Console.WriteLine("in"); if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim()) //if (CategoryList[i].Text == " Graphics & Design ".Trim()) { Thread.Sleep(1000); CategoryList[i].Click(); Base.test.Log(LogStatus.Info, " Category Selected"); } } //Add SubCategory SubCategory.Click(); Console.WriteLine("Clicked on the SubCategory"); Thread.Sleep(2000); IList <IWebElement> SubCatogeryList = SubCategory.FindElements(By.TagName("option")); //int count = SubCatogeryList.Count; Thread.Sleep(500); for (int i = 0; i < SubCatogeryList.Count; i++) { if (SubCatogeryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").Trim()) { Thread.Sleep(1000); SubCatogeryList[i].Click(); Base.test.Log(LogStatus.Info, " SubCategory Selected"); } } // Add Tags AutoItX3 autoIt = new AutoItX3(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); autoIt.Send("{Enter}"); Base.test.Log(LogStatus.Info, " Tags Added successfully"); // Select Service Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == " Hourly badis sevice ") { Servicetype.Click(); } else { ServiceType.Click(); } Base.test.Log(LogStatus.Info, "Service type Added successfully"); //Select Location Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site") { Locationtype.Click(); } else { LocationType.Click(); } Base.test.Log(LogStatus.Info, "Location Type Edited successfully"); //Monday selection MondayCheckBox.Click(); MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); Thread.Sleep(1000); MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); Thread.Sleep(1000); //Tuesday Selection TuesdayCheckBox.Click(); TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time")); TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time")); //Wednesday Selection Wednesdaycheckbox.Click(); WednesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Start Time")); WednesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "End Time")); //Selecting Skill Trade if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit") { Thread.Sleep(1000); Skilltrade.Click(); } else { Thread.Sleep(1000); SkillTrade.Click(); } Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Enter Credit Thread.Sleep(1000); Credit.Clear(); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); Thread.Sleep(1000); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Upload WorkSample Thread.Sleep(3000); WorkSample.Click(); Thread.Sleep(1000); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(@"c:\users\rajesh jasti\Documents\ProfilePhoto.jpg"); Thread.Sleep(2000); autoit.Send("{Enter}"); Base.test.Log(LogStatus.Info, "Image Edited successfully"); //Selecting Active Thread.Sleep(4000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Hidden") { Hidden.Click(); } else { ActiveBtn.Click(); } //Click on Save Button SaveBtn.Click(); }
public void EditSkills() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings"); Thread.Sleep(4000); //Click on ManageListings button Thread.Sleep(5000); Global.GlobalDefinitions.driver.Navigate().Refresh(); ML.Click(); Thread.Sleep(4000); while (true) { var j = 1; while (j <= 10) { // identify 2nd row of table. Then extact the text and assign to a variable var Category1 = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; var EditBtn = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]")); //compare the text with the expected text. "Graphics & Design" if (Category1 == (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category1"))) { //Click on Edit Button EditBtn.Click(); Thread.Sleep(3000); // Adding Title Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Thread.Sleep(500); //Add Description Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Thread.Sleep(3000); //SaveBtn.Click(); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Add Category Thread.Sleep(1500); //Actions action = new Actions(GlobalDefinitions.driver); //action.Click(Category); Category.Click(); //action.MoveToElement(Category).Build().Perform(); Console.WriteLine("Clicked on the Category"); Thread.Sleep(2000); IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option")); int Count = CategoryList.Count; Thread.Sleep(500); for (int i = 0; i < Count; i++) { Console.WriteLine("in"); if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim()) { Thread.Sleep(1000); CategoryList[i].Click(); Base.test.Log(LogStatus.Info, " Category Selected"); } } //Add SubCategory SubCategory.Click(); Console.WriteLine("Clicked on the SubCategory"); Thread.Sleep(2000); IList <IWebElement> SubCategoryList = SubCategory.FindElements(By.TagName("option")); //int count = SubCatogeryList.Count; Thread.Sleep(500); for (int i = 0; i < SubCategoryList.Count; i++) { if (SubCategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")) //if (SubCatogeryList[i].Text == " Other".Trim()) { Thread.Sleep(1000); SubCategoryList[i].Click(); Base.test.Log(LogStatus.Info, " SubCategory Selected"); } } // Add Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Select Service Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service") { ServiceType.Click(); } else { Servicetype.Click(); } Base.test.Log(LogStatus.Info, "Service type Edited successfully"); //Select Location Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online") { LocationType.Click(); } else { Locationtype.Click(); } Base.test.Log(LogStatus.Info, "Location Type Edited successfully"); //Monday Check Box Selection Thread.Sleep(2000); Boolean X = MondayCheckBox.Selected; if (X == false) { MondayCheckBox.Click(); } MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); Thread.Sleep(1000); MondayEndTime.Clear(); MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); Thread.Sleep(1000); //Tuesday Selection //TuesdayCheckBox.Click(); //TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time")); //TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time")); //Days selection Thursdaycheckbox.Click(); Thread.Sleep(2000); ThursdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); ThursdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); //Selecting Skill Trade if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange") { SkillTrade.Click(); } else { Skilltrade.Click(); } Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Enter Skill Exchange AutoItX3 autoItx = new AutoItX3(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); autoItx.Send("{Enter}"); Thread.Sleep(3000); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Upload WorkSample Thread.Sleep(4000); WorkSample.Click(); Thread.Sleep(1000); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(@"c:\users\rajesh jasti\Documents\Worksamples.xlsx"); Thread.Sleep(5000); autoit.Send("{Enter}"); Base.test.Log(LogStatus.Info, "Work Sample Updated successfully"); // select Active Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Active") { ActiveBtn.Click(); } else { Hidden.Click(); } //Click on Save Button SaveBtn.Click(); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); return; } j++; } var btnNext = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div/button[4]")); btnNext.Click(); } var Title1 = (Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[3]/td[2]")).Text); Assert.AreEqual("Test Analyst", Title1); Console.WriteLine(" Skills Edited Successfully"); }
public void AddShareSkill(IWebDriver Driver) { //Click Share Skill button ShareSkillBtn.Click(); Thread.Sleep(5000); //Title Input Title.SendKeys(Helpers.ExcelLib.ReadData(2, "Title")); //Description Input Description.SendKeys(Helpers.ExcelLib.ReadData(2, "Description")); //Select Category var selectElement1 = new SelectElement(Category); selectElement1.SelectByValue("6"); Console.WriteLine("Category selcted"); //Select Sub-Catergory var selectElement2 = new SelectElement(Subcategory); selectElement2.SelectByText("QA"); Console.WriteLine("Sub-Category selcted"); //Select Tags Tag1.SendKeys(Helpers.ExcelLib.ReadData(2, "Tag1")); Tag1.SendKeys(Keys.Enter); Console.WriteLine("Enter clicked"); //Select Service Type Servicetype.Click(); //Select Location Type Locationtype.Click(); //Select End date Enddate.SendKeys("29-07-2019"); //Input for the whole week //Monday time MonCheck.Click(); MonStart.SendKeys(Helpers.ExcelLib.ReadData(2, "MonStart")); MonEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "MonEnd")); //Tuesday time TuesCheck.Click(); TuesStart.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesStart")); TuesEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesEnd")); //Wednesday time WedCheck.Click(); WedStart.SendKeys(Helpers.ExcelLib.ReadData(2, "WedStart")); WedEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "WedEnd")); //Thursday time ThursCheck.Click(); ThursStart.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursStart")); ThursEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursEnd")); //Friday time FriCheck.Click(); FriStart.SendKeys(Helpers.ExcelLib.ReadData(2, "FriStart")); FriEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "FriEnd")); //Select Skill trade SkillTrade.Click(); //Select Skill Exchange SkillExchange.SendKeys(Helpers.ExcelLib.ReadData(2, "SkillExchange")); SkillExchange.SendKeys(Keys.Enter); //Upload Work Sample Upload click IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver; js1.ExecuteScript("arguments[0].click();", Upload); Thread.Sleep(5000); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(4000); autoIt.Send("{ENTER}"); //Select Active SkillActive.Click(); //Click Save Savebtn.Click(); Thread.Sleep(5000); //Verification //CommonDriver.Driver.FindElement(By.XPath("//a[contains(text(),'Manage Listings')]")).Click(); //string ExpectedResult1 = "Software Tester 7"; //string ActualResult1 = CommonDriver.Driver.FindElement(By.XPath("//td[contains(text(),'q')]")).Text; //if (ActualResult1 == ExpectedResult1) //{ // Console.WriteLine("Test Pass: Skill Added"); //} //else //{ // Console.WriteLine("Test Fail: Skill Not Added"); //} try { Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed); Console.WriteLine("Test Pass: Skill listing Added"); } catch (Exception e) { Console.WriteLine(e); } }
internal void AddShareSkill(IWebDriver Driver) { //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkillTestData"); Thread.Sleep(1000); //Click Share Skill button ShareSkillBtn.Click(); Thread.Sleep(5000); //Title Input Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Description Input Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category var selectElement1 = new SelectElement(Category); selectElement1.SelectByValue("6"); Console.WriteLine("Category selcted"); //Select Sub-Catergory var selectElement2 = new SelectElement(Subcategory); selectElement2.SelectByText("QA"); Console.WriteLine("Sub-Category selcted"); //Select Tags Tag1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tag1")); Tag1.SendKeys(Keys.Enter); Console.WriteLine("Enter clicked"); //Select Service Type Servicetype.Click(); //Select Location Type Locationtype.Click(); //Select End date Enddate.SendKeys("29-07-2019"); //Input for the whole week //Monday time MonCheck.Click(); MonStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonStart")); MonEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonEnd")); //Tuesday time TuesCheck.Click(); TuesStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesStart")); TuesEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesEnd")); //Wednesday time WedCheck.Click(); WedStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedStart")); WedEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedEnd")); //Thursday time ThursCheck.Click(); ThursStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursStart")); ThursEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursEnd")); //Friday time FriCheck.Click(); FriStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriStart")); FriEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriEnd")); //Select Skill trade SkillTrade.Click(); //Select Skill Exchange SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange")); SkillExchange.SendKeys(Keys.Enter); ////Upload Work Sample Upload click IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver; js1.ExecuteScript("arguments[0].click();", Upload); Thread.Sleep(5000); AutoItX3 autoIt = new AutoItX3(); Thread.Sleep(5000); autoIt.WinActivate("Open"); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(4000); autoIt.Send("{ENTER}"); //Select Active SkillActive.Click(); //Click Save Savebtn.Click(); Thread.Sleep(5000); Base.test.Log(LogStatus.Info, "Skill added successfully"); //Verification Thread.Sleep(4000); string ExpectedResult1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"); string ActualResult1 = ActualValue1.Text; if (ActualResult1 == ExpectedResult1) { Console.WriteLine("Test Pass: Skill Added"); // Screenshot String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); //AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); Base.test.Log(LogStatus.Info, "Image example: " + img); // end test. (Reports) Base.extent.EndTest(Base.test); // calling Flush writes everything to the log file (Reports) Base.extent.Flush(); // Close the driver :) //GlobalDefinitions.driver.Close(); } else { Console.WriteLine("Test Fail: Skill Not Added"); } //try //{ // Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed); // Console.WriteLine("Test Pass: Skill listing Added"); //} //catch (Exception e) //{ // Console.WriteLine("Test Fail: Skill listing not present"); //} }
public void ListingSteps() { //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys("Automation Testing"); Description.SendKeys("Tools used in testing and methods followed in handling tools"); Category1.SendKeys("Programming & Tech"); Category2.SendKeys("QA"); Tags1.SendKeys("Selenium"); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/4/2020"); ChooseMon.Click(); StartTimeMon.SendKeys("8.30AM"); EndTimeMon.SendKeys("4.30PM"); SkillTrade.Click(); Credit.SendKeys("5"); Active.Click(); Save.Click(); Thread.Sleep(6000); //verification ManagelistingsMenu.Click(); Thread.Sleep(8000); try { Assert.AreEqual("Automation Testing", ActualResult1.Text); Console.WriteLine("Test case 1 PASS: record added succesfully"); } catch (Exception e) { Console.WriteLine(e); } }
internal void AddSkill() { //Click on ShareSkill Tab SkillTab.Click(); //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); Thread.Sleep(1000); //Add in ShareSkill Title SkillTitle.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Assert.That(SkillTitle != null); //Add in ShareSkill Discription SkillDescription.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Assert.That(SkillDescription != null); //Click on ShareSkill Category SkillCategory.Click(); //Select Category SkillCategory.SendKeys(Keys.ArrowDown + Keys.ArrowDown + Keys.Enter); //Click on ShareSkill SubCategory SkillSubCategory.Click(); //Select SubCategory SkillSubCategory.SendKeys(Keys.ArrowDown + Keys.ArrowDown + Keys.Enter); for (int i = 1; i < 3; i++) { //Click on ShareSkill Tag SkillTag.Click(); if (i == 1) { //Add in Tag1 Thread.Sleep(1000); SkillTag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tag1") + Keys.Enter); } else { //Add in Tag2 Thread.Sleep(1000); SkillTag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tag2") + Keys.Enter); } } //Click on redio button [One-off service] ServiceType.Click(); //Click on redio button [On-site] LocationType.Click(); //Add Start Date StartDate.SendKeys("08/11/2019"); //Add End Date EndDate.SendKeys("09/11/2019"); //Tick on weekdays checkbox, Add Start time and End time for (int i = 1; i <= 7; i++) { Thread.Sleep(1000); GlobalDefinitions.driver.FindElement(By.XPath("(//INPUT[@tabindex='0'])[" + (i + 4) + "]")).Click(); Thread.Sleep(1000); GlobalDefinitions.driver.FindElement(By.XPath("(//INPUT[@name='StartTime'])[" + i + "]")).SendKeys("10:00AM"); Thread.Sleep(1000); GlobalDefinitions.driver.FindElement(By.XPath("(//INPUT[@name='EndTime'])[" + i + "]")).SendKeys("08:00PM"); } //Click on Skill Trade [Credit] SkillTrade.Click(); //Add value in Credit Credit.SendKeys("6"); //Upload File using AutoIT UploadBtn.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); Thread.Sleep(1000); autoIt.Send(@"C:\Users\nilay\Documents\Richa 2019\Richa Vyas-Test Analyst.pdf"); Thread.Sleep(1000); autoIt.Send("{ENTER}"); //Click on Active [Active] Active.Click(); //Click on Save Button SaveBtn.Click(); }
public void ListingSteps() { //populate excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkill"); //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Category1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category1")); Category2.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category2")); Tags1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags1")); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/04/2020"); ChooseMon.Click(); StartTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTimeMon")); EndTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTimeMon")); SkillTrade.Click(); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, " Credit")); PlusIcon.Click(); Thread.Sleep(7000); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); //activate the window, so that next set of action actives n this window Thread.Sleep(5000); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(7000); autoIt.Send("{ENTER}"); Active.Click(); Save.Click(); //verify Thread.Sleep(9000); ManagelistingsMenu.Click(); Thread.Sleep(9000); try { Console.WriteLine("Entered try"); Assert.IsTrue(ActualResult1.Text.Contains("Automation testing")); { Console.WriteLine("Test case 1 PASS : Added Record successfully"); Base.test.Log(LogStatus.Info, "Record added"); } ////Screenshot //String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); ////AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); //Base.test.Log(LogStatus.Info, "Image example: " + img); //// end test. (Reports) //Base.extent.EndTest(Base.test); //// calling Flush writes everything to the log file (Reports) //Base.extent.Flush(); } catch (Exception e) { Console.WriteLine(e); } }