internal void LangDelete() { ClickLang.Click(); //Click delete GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[@data-tab='first']//table//tbody//tr//td[3]//i[@class='remove icon']")); delLang.Click(); }
internal void LoginSteps() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SignIn"); //Click on SignIn SignIntab.Click(); //Enter Username Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username")); //Enter Password Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password")); //Click login LoginBtn.Click(); try { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[contains(text(),'Mike K')]", 10000); // check login is successfull var loginCheck = "test"; loginCheck = GlobalDefinitions.driver.FindElement(By.XPath("//*[contains(text(),'Mike K')]")).GetAttribute("innerText"); Assert.That(loginCheck == "Mike K"); } catch (Exception ex) { Assert.Fail("Test failed at login step", ex.Message); } }
//Finding Edit Button //private IWebElement EditButton => GlobalDefinitions.driver.FindElement(By.XPath()) internal void EditListings() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings"); By WaitCond1 = By.XPath("//a[@href='/Home/ListingManagement']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCond1, 60); ManageListingsTab.Click(); By WaitCondition = By.XPath("//th[text()='Image']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); string Editrecord = GlobalDefinitions.ExcelLib.ReadData(2, "EditTitle"); GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'" + Editrecord + "')]//following-sibling::td//child::i[@class='outline write icon']")).Click(); By WaitCond = By.XPath("//input[@name='title']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCond, 60); ShareSkill EditSkillInstance = new ShareSkill(); EditSkillInstance.EnterShareSkill(); }
internal int SearchListings(string CategoryToSearch, string TitleToSearch, string DescriptionToSearch) { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Manage Listings"), 5); //Navigate to Manage Listing page manageListingsLink.Click(); //Initialize the Record count to 0 int RecordFound = 0; GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[@id='listing-management-section']/div/div[1]/div[1]"), 5); //Loop for searching record through the pages for (int i = 0; i < paginationButtons.Count - 2; i++) { Thread.Sleep(2000); foreach (IWebElement listingRecord in tableRows) { string Category = listingRecord.FindElement(By.XPath("td[2]")).Text; string Title = listingRecord.FindElement(By.XPath("td[3]")).Text; string Description = listingRecord.FindElement(By.XPath("td[4]")).Text; if (Category == CategoryToSearch && Title == TitleToSearch && Description == DescriptionToSearch) { RecordFound++; } } // It will navigate to next page if the next button is enabled if (nextButton.Enabled == true) { nextButton.Click(); } } // Returning the no. of matching record found return(RecordFound); }
public void ValidateTheSkillAdded() { //click on Manage Listings manageListing.Click(); //Populate data from Excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillShare"); //wait for manage listing GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//h2[contains(text(),'Manage Listings')]"), 10); //number of pages IList <IWebElement> noOfPages = GlobalDefinitions.driver.FindElements(By.XPath("//button[@class='ui button otherPage']")); for (int i = 0; i <= noOfPages.Count; i++) { for (int j = 1; j <= 5; j++) { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//tr[1]//td[3]"), 10); var titleObj = GlobalDefinitions.driver.FindElement(By.XPath("//tr[" + j + "]//td[3]")).Text; Console.WriteLine(titleObj); GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); if (titleObj == (GlobalDefinitions.ExcelLib.ReadData(2, "Title"))) { Base.Test.Log(LogStatus.Pass, "Add Skill successfully, Test passed"); return; } } //click next page nextPageBtn.Click(); } }
internal void ProfileAdd() { // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//i[@class='dropdown icon'])[2]")); //Click Profilename ProfileName.Click(); //Enter Firstname Firstname.Clear(); Firstname.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Firstname")); //Enter Lastname Lastname.Clear(); Lastname.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Lastname")); //Save profilename SaveProfileName.Click(); var fname = GlobalDefinitions.ExcelLib.ReadData(2, "Firstname"); var Lname = GlobalDefinitions.ExcelLib.ReadData(2, "Lastname"); var title = fname + " " + Lname; GlobalDefinitions.wait(40); Assert.AreEqual(Titlename.Text, title); }
//Validate new Language internal void ValidateAddUpdLanguage(int excelrow) { try { GlobalDefinitions.wait(30); //click on language button // LanguageButton.Click(); GlobalDefinitions.WaitForElement(driver, By.XPath("//table/tbody/tr[last()]/td[1]"), 30); string LanguageText = driver.FindElement(By.XPath("//table/tbody/tr[last()]/td[1]")).Text; Console.WriteLine(LanguageText); Console.WriteLine(GlobalDefinitions.ExcelLib.ReadData(excelrow, "Language")); if (LanguageText == GlobalDefinitions.ExcelLib.ReadData(excelrow, "Language")) { Assert.IsTrue(true); } //validate language //Assert.AreEqual(GlobalDefinitions.ExcelLib.ReadData(excelrow, "Language"), LanguageText); } catch (Exception e) { Console.WriteLine(e.Message); Assert.Fail(); } }
/* verifying the data is added edited and remove successfully * */ internal bool Verify() { bool recordFound = false; GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResource.ManageListingsExcelPath, "ManageListings"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[contains(.,'Manage Listings')]"), 10); manageListingsLink.Click(); IWebElement WebElement = GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table"), 10); if (WebElement == null) { return(recordFound); } int ManageListingCount = GlobalDefinitions.driver.FindElements(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table")).Count; for (int i = 1; i <= ManageListingCount; i++) { string Category = string.Format("(//td[contains(.,'{0}')])[1]", GlobalDefinitions.ExcelLib.ReadData(2, "Category")); if (GlobalDefinitions.driver.FindElement(By.XPath(Category)).Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category")) { recordFound = true; break; } } return(recordFound); }
internal void SkillEdit() { // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='second']")); //Click Skill tab ClickSkilltab.Click(); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//*[@data-tab='second']//table//tbody//tr//td[3]//i[@class='outline write icon'])")); //Edit Skill EditSkill.Click(); //Edit Skill AddnewSkill.Clear(); AddnewSkill.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Skill")); //Edit Level SelectElement Edit = new SelectElement(SelectSkillLevel); Edit.SelectByText(GlobalDefinitions.ExcelLib.ReadData(3, "Skill Level")); //Click update UpdateSkill.Click(); }
internal void ValidateAddUpdcertifications(int excelrow) { try { Thread.Sleep(5000); GlobalDefinitions.WaitForElement(driver, By.XPath("(//table/tbody/tr)[last()]"), 90); //Get the table list var lastRow = driver.FindElements(By.XPath("(//table/tbody/tr)[last()]/td")); GlobalDefinitions.wait(40); Assert.Multiple(() => { Assert.That(lastRow[1].Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(excelrow, "CertifiedFrom"))); Assert.That(lastRow[2].Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(excelrow, "CertificationYear"))); Assert.That(lastRow[0].Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(excelrow, "Certificate"))); }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Assert.Fail(); } GlobalDefinitions.wait(30); }
public void Password_Change() { //wait GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//span[contains(@tabindex,'0')]"), 2000); //Click on "Hi Papri" button ConstantHelpers.Click_Operation(Hi_Name); //Wait for Element GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@class='item'][contains(.,'Change Password')]"), 2000); //Click and SELECT "CHANGE PASSWORD" option ConstantHelpers.Click_Operation(Change_Pswrd); //Click "CURRENT PASSWORD" Field ConstantHelpers.Click_Operation(Crnt_Pswrd); //Sending Values to "CURRENT PASSWORD" Field ConstantHelpers.EnterText(Crnt_Pswrd, "123456"); //Sending Values to "NEW PASSWORD" Field ConstantHelpers.EnterText(Nw_Pswrd, "234567"); //Sending Values to "CONFIRM PASSWORD" Field ConstantHelpers.EnterText(Cnfrm_Pswrd, "234567"); //Wait for Element GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//button[@type='button'][contains(.,'Save')]"), 2000); //Click "CHANGE PASSWORD SAVE" Click ConstantHelpers.Click_Operation(Chng_Pswrd_Sv); }
internal void CertDelete() { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='fourth']")); //Click Certification tab ClickCert.Click(); delCert.Click(); }
internal void CertEdit() { // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='fourth']")); //Click Certification tab ClickCert.Click(); EditCert.Click(); //Edit Certification AddCert.Clear(); AddCert.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Certificate")); //Edit Certification from AddCertFrom.Clear(); AddCertFrom.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "From")); //Edit Certification year AddYear.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Year")); //Click update UpdateCert.Click(); }
internal void LanguageAdd() { // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage"); //Explicit wait to click Add new element GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='first']")); //Click Language tab ClickLang.Click(); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[contains(text(),'Add New')][1]")); //Click Add new Addnewlang.Click(); //Add Language AddLang.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Language")); //Add Level SelectLevel.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Level")); //Save Language SaveLang.Click(); }
internal void DeleteShareSkill() { //Wait for Manage Listings to appear GlobalDefinitions.WaitForElement(GlobalDefinitions.Driver, By.LinkText("Manage Listings"), (20)); //Click on Manage Listings manageListingsLink.Click(); GlobalDefinitions.WaitForElement(GlobalDefinitions.Driver, By.XPath("(//td[@class='four wide'][contains(.,'Title edited')])"), 20); //See if listing is displayed and click on edit icon of that listing if (DeleteListingsLink.Displayed && delete.Displayed) { if (DeleteListingsLink.Text == "Title edited" && delete.Equals(GlobalDefinitions.Driver.FindElement(By.XPath("(//i[contains(@class,'remove icon')])")))) { //press the delete button delete.Click(); clickActionsButton.Click(); Thread.Sleep(2000); } } }
//Validate edited details internal void ValidateEditedDetails() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListing"); // Refresh the page GlobalDefinitions.driver.Navigate().Refresh(); //Validate edited data //Click on Manage Listing GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Manage Listings", 10000); manageListingsLink.Click(); Thread.Sleep(5000); //Click on view button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "(//i[@class='eye icon'])[1]", 10000); view.Click(); GlobalDefinitions.driver.Navigate().Refresh(); try { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/h1/span", 20000); var ViewValidation = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/h1/span")).Text; Assert.That(ViewValidation, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(3, "Title"))); Base.test.Log(LogStatus.Pass, "Listing Edited successfully"); } catch (Exception ex) { Assert.Fail("verify the edited share skill page failed", ex.Message); Base.test.Log(LogStatus.Fail, "Unable to edit listing"); } }
public void UpdateEducation() { By WaitCondition = By.XPath("//tbody[1]//tr[1]//td[6]//span[1]//i[1]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); GlobalDefinitions.driver.FindElement(By.XPath("//tbody[1]//tr[1]//td[6]//span[1]//i[1]")).Click(); By WaitCondition_ = By.XPath("//input[contains(@name,'degree')]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition_, 60); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@name,'degree')]")).Clear(); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@name,'degree')]")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Degree")); By WaitCondition__ = By.XPath("//input[@type = 'button'] [1]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition__, 60); Global.GlobalDefinitions.driver.FindElement(By.XPath("//input[@type = 'button'] [1]")).Click(); By WaitCondition1 = By.XPath("//td[contains(text(),'MICT')]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition1, 60); var Title = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'MICT')]")).Text; string ExcelTitle = GlobalDefinitions.ExcelLib.ReadData(3, "Degree"); if (Title == ExcelTitle) { Base.test.Log(LogStatus.Info, "Education updated successfully"); Assert.IsTrue(true); } }
internal void Listings() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListing"); // Refresh the page GlobalDefinitions.driver.Navigate().Refresh(); //Click on Manage Listing GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Manage Listings", 10000); manageListingsLink.Click(); GlobalDefinitions.driver.Navigate().Refresh(); Thread.Sleep(1000); //Click on view button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "(//i[@class='eye icon'])[1]", 10000); view.Click(); // Refresh the page GlobalDefinitions.driver.Navigate().Refresh(); try { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//span[@class='skill-title']", 40000); var ViewValidation = GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='skill-title']")).Text; Assert.That(ViewValidation, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Title"))); } catch (Exception ex) { Assert.Fail("verify the share skill page failed", ex.Message); } }
public void UpdateCertification() { By WaitCondition = By.XPath("//tbody[1]//tr[1]//td[4]//span[1]//i[1]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); GlobalDefinitions.driver.FindElement(By.XPath("//tbody[1]//tr[1]//td[4]//span[1]//i[1]")).Click(); GlobalDefinitions.driver.FindElement(By.XPath("//select[@name='certificationYear']")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Year")); By WaitCondition_ = By.XPath("//input[contains(@value,'Update')]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition_, 60); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@value,'Update')]")).Click(); Base.test.Log(LogStatus.Info, "Certification updated successfully"); var Year = GlobalDefinitions.driver.FindElement(By.XPath("//select[@name='certificationYear']")).Text; string ExcelYear = GlobalDefinitions.ExcelLib.ReadData(3, "Year"); if (Year == ExcelYear) { Base.test.Log(LogStatus.Info, "Certification has been updated"); Assert.IsTrue(true); } }
public void UpdateSkill() { By WaitCondition = By.XPath("//tbody[1]//tr[1]//td[3]//span[1]//i[1]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); GlobalDefinitions.driver.FindElement(By.XPath("//tbody[1]//tr[1]//td[3]//span[1]//i[1]")).Click(); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@placeholder,'Add Skill')]")).Clear(); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@placeholder,'Add Skill')]")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Skill")); //To click on name of the skills box and enter the other skill name GlobalDefinitions.driver.FindElement(By.XPath("//select[contains(@class,'ui fluid dropdown')]")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Skill_Level")); GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@value,'Update')]")).Click(); var Skill = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//table[@class='ui fixed table']/tbody[1]/tr[1]/td[1]")).Text; string ExcelSkill = GlobalDefinitions.ExcelLib.ReadData(3, "skill"); if (Skill == ExcelSkill) { Base.test.Log(LogStatus.Info, "Updated Skill successfully"); Assert.True(true); } }
internal void ChangePassword() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Change Password"); By WaitCondition = By.XPath("//span[@tabindex=\"0\"]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); //Select Change Password in Useraccount IWebElement ProfileDropDownBox = GlobalDefinitions.driver.FindElement(By.XPath("//span[@tabindex=\"0\"]")); ProfileDropDownBox.Click(); //wait untill Change Password option under Profile is visible WebDriverWait wait = new WebDriverWait(GlobalDefinitions.driver, TimeSpan.FromSeconds(30)); IWebElement ChangePassword = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[@tabindex=\"0\"]//a[contains(text(),'Change Password')]"))); ChangePassword.Click(); //Send OldPassword through Excel GlobalDefinitions.driver.FindElement(By.Name("oldPassword")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Old Password")); //Send New Password through Excel GlobalDefinitions.driver.FindElement(By.Name("newPassword")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password")); //Send Confirm Password through Excel GlobalDefinitions.driver.FindElement(By.Name("confirmPassword")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Confirm Password")); //Click on Save button GlobalDefinitions.driver.FindElement(By.XPath("//button[@class='ui button ui teal button']")).Click(); }
//Verify Share skill internal void VerifySkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Verify share skill details GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id=\"listing-management-section\"]/div[2]/div[1]/div[2]/button[2]", 10000); ManageLis.Click(); try { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[2]", 10000); var categorycheck = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[2]")).GetAttribute("textContent"); Assert.That(categorycheck, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Category"))); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[3]", 10000); var titlecheck = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[3]")).GetAttribute("textContent"); Assert.That(titlecheck, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Title"))); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Share skill added successfully"); } catch (Exception ex) { Assert.Fail("verify the share skill page failed", ex.Message); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Share skill not added"); } }
internal void VerifyEditListing() { try { // Wait element turn up try { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "(//i[@class='eye icon'])[1]", 10); } catch (NoSuchElementException) { Assert.Fail("No listing on page or failed to load listings, please add listings first!"); } // Verify the detail is updated var categoryInList = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']//tr[1]/td[2]")).Text; Assert.That(categoryInList, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Category"))); var titleInList = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']//tr[1]/td[3]")).Text; Assert.That(titleInList, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Title"))); var descriptionInList = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']//tr[1]/td[4]")).Text; Assert.That(descriptionInList, Contains.Substring(descriptionInList.Substring(0, descriptionInList.Length - 3))); } catch (Exception ex) { Assert.Fail("Test failed to verify editing listing", ex.Message); } }
public void ThenTheNewSkillShouldBeAddedInTheManageListingsTab() { //Wait untill page is loaded GlobalDefinitions.driver.FindElement(By.LinkText("Manage Listings")).Click(); By WaitCondition = By.XPath("//table[@class='ui striped table']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); //IWebElement table = driver.FindElement(By.XPath("//table[@class='ui striped table']")); //Validate Category string ActualCategory = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']/tbody/tr[1]/td[2]")).Text; string ExpectedCategory = GlobalDefinitions.ExcelLib.ReadData(2, "Category"); Assert.AreEqual(ExpectedCategory, ActualCategory); //Validate Title string ActualTitle = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']/tbody/tr[1]/td[3]")).Text; string ExpectedTitle = GlobalDefinitions.ExcelLib.ReadData(2, "Title"); Assert.AreEqual(ExpectedTitle, ActualTitle); //Validate Description string ActualDescription = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']/tbody/tr[1]/td[4]")).Text; string ExpectedDescription = GlobalDefinitions.ExcelLib.ReadData(2, "Description"); Assert.AreEqual(ExpectedDescription, ActualDescription); }
internal void EducationAdd() { // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='third']")); //Click Skill tab ClickEdu.Click(); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//div[contains(text(),'Add New')])[3]")); //Click Add new ClickAddnewE.Click(); //Add University University.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "University")); //Add Country Country.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Country")); //Add Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Add Degree Degree.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Degree")); //Add Year Year.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "YearOfGraduation")); //Save Education SaveEdu.Click(); }
public void DeleteListings() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "DeleteAction"); By WaitCondition = By.XPath("//a[contains(text(),'Manage')]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); //Click on ManageListings tab ManageListingsTab.Click(); By WaitCondition1 = By.XPath("//th[text()='Image']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition1, 60); string Deleterecord = GlobalDefinitions.ExcelLib.ReadData(2, "Title"); IWebElement delete = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'" + Deleterecord + "')]//following-sibling::td//child::i[@class='remove icon']")); //Click on Delete button delete.Click(); //Click Yes on Popup window // GlobalDefinitions.driver.SwitchTo().Alert().Accept(); GlobalDefinitions.driver.FindElement(By.XPath("//button[@class='ui icon positive right labeled button']")).Click(); }
// Verify Sent-Requests internal void VerifySendRequest(IWebDriver driver) { // Wait and Click on the Manage Requests tab GlobalDefinitions.WaitForElement(driver, "XPath", "//div[@class='ui dropdown link item']", 10); manageRequestsLink.Click(); // Wait and click on dropdown menu the second option: Sent requests GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[@class='item' and @href='/Home/SentRequest']", 10); SentRequestsLink.Click(); // Wait and Assert if the title skill is equal to recorded skill GlobalDefinitions.WaitForElement(driver, "XPath", "//*[@id='sent-request-section']/div[2]/div[1]/table/tbody/tr[1]/td[2]/a", 10); string skillTitleExpected = driver.FindElement(By.XPath("" + "//*[@id='sent-request-section']/div[2]/div[1]/table/tbody/tr[1]/td[2]/a")).Text; if (skillTitle == skillTitleExpected) { // Withdraw the request to facilitate following tests WithdrawRequest.Click(); Base.test.Log(LogStatus.Pass, "Verify sending request successfully!"); } else { Assert.Fail("Failed to verify sending request"); } }
internal void ValidateAddedShareSkill() { GlobalDefinitions.WaitForElement(ManageListingsTableHeader, 50); //Verify if Added ShareSkill existed by checking the description. If non-existent, fail test. Assert.That(TitleOnManageListings.Text, Is.EqualTo(ExcelLib.ReadData(2, "Title"))); }
//Elements internal void ClickEditListings(string EditSkill) { By WaitCondition = By.XPath("//th[text()='Image']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'" + EditSkill + "')]//following-sibling::td//child::i[@class='outline write icon']")).Click(); }
internal void NavigateToManageListing() { //Wait till Manage Listing is visible GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Manage Listings"), 5); //Click Manage Listing Link manageListingsLink.Click(); }