internal void ViewListing(IWebDriver driver) { //Wait untill driver find Manage listing tab CommomDriver.WaitForVisibility(driver, "LinkText", "Manage Listings", 2); //click on Manage Listing tab ManageList.Click(); //Wait untill driver find View button CommomDriver.WaitForVisibility(driver, "XPath", "(//i[@class='eye icon'])[1]", 2); //click on view - (eye icon) View.Click(); try { //Assert that if View icon to be clicked than URl Contains "ServiceDetail" String urlTitle = driver.Title; Console.WriteLine(urlTitle); //Assertion Assert.AreEqual("Service Detail", urlTitle); } catch (Exception e) { Console.WriteLine(e.Message); } }
internal void DeleteListing(IWebDriver driver) { //Wait untill driver find Manage listing tab CommomDriver.WaitForVisibility(driver, "LinkText", "Manage Listings", 2); //click on manage list ManageList.Click(); //Wait untill Driver finds Delete button to click CommomDriver.WaitForVisibility(driver, "XPath", "(//i[@class='remove icon'])[1]", 2); //Click on Delete icon Delete.Click(); //Wait untill Driver finds pop up YES or NO button to click CommomDriver.WaitForVisibility(driver, "XPath", "//div[@class='actions']/button[2]", 2); //Click on Yes or No button ClickAuctionButton.Click(); CommomDriver.WaitForVisibility(driver, "ClassName", "ns-box-inner", 2); try { //Assert - Get the pop up text in PopUpMsg Variable. String PopUpMsg = DeletePopUp.Text; //Assert that popUp will open and has not to be null(or Emplty) Assert.NotNull(PopUpMsg); } catch (Exception e) { Console.WriteLine(e.Message); } }
internal void EditListing(IWebDriver driver) { //Wait untill driver find Manage listing tab CommomDriver.WaitForVisibility(driver, "LinkText", "Manage Listings", 2); //After Viewing Skills click on ManageList to go back to Manage Listing ManageList.Click(); //Wait untill driver finf Edit button CommomDriver.WaitForVisibility(driver, "XPath", "(//i[@class='outline write icon'])[1]", 2); //Get Text from Category and Title from Manage list before Edit Aucketion String TitleBeforEdit = TitleofManage.Text; String CategoryBeforeEdit = CategoryofManage.Text; //Click on Edit icon Edit.Click(); //Random Wait CommomDriver.Wait(2); //create page object of share skill and call EnterShareSkill function //to perform Edit function in manage Listing Page ShareSkillPage ShareskillObj = new ShareSkillPage(); ShareskillObj.EnterShareSkill(driver); //Get text from Category and Title from Manage list after Edit String TitleAfterEdit = TitleofManage.Text; String CategoryAfterEdit = CategoryofManage.Text; Console.WriteLine(TitleBeforEdit); Console.WriteLine(TitleAfterEdit); Console.WriteLine(CategoryBeforeEdit); Console.WriteLine(CategoryAfterEdit); try { //Assert that text from Befor Edit and After Edit dose not have to match Assert.AreNotEqual(TitleBeforEdit, TitleAfterEdit); Assert.AreNotEqual(CategoryBeforeEdit, CategoryAfterEdit); Console.WriteLine("pass"); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Fail"); } }
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); } }