//Update skill internal void UpdateSkill() { //click on skill // SkillsButton.Click(); for (int i = 1; i <= 5; i++) { ExtentionHelpers.TurnOnWait(driver); //get text of language var skilltext = driver.FindElement(By.XPath("//div[3]/div/div[2]/div/table/tbody[" + i + "]/tr/td[1]")).Text; ExtentionHelpers.TurnOnWait(driver); ExcelLibHelper.PopulateInCollection(ConstantHelpers.TestDataPath, "FieldValues"); if (skilltext == ExcelLibHelper.ReadData(2, "Skills")) { ExtentionHelpers.TurnOnWait(driver); //click on pen icon update driver.FindElement(By.XPath("//div[@data-tab='second']/div/div[2]/div/table/tbody[" + i + "]/tr/td[3]/span[1]")).Click(); //get language text box IWebElement skilledittext1 = driver.FindElement(By.XPath("//div/table/tbody[" + i + "]/tr/td/div/div[1]/input")); skilledittext1.Clear(); //enter language skilledittext1.SendKeys(ExcelLibHelper.ReadData(3, "Skills")); //Enter language level SelectElement select = new SelectElement(driver.FindElement(By.XPath("//div[@data-tab = 'second']/div/div[2]/div/table/tbody[" + i + "]/tr/td/div/div[2]/select"))); select.SelectByValue(ExcelLibHelper.ReadData(3, "SkillLevel")); //click on update driver.FindElement(By.XPath("//div[@data-tab = 'second']/div/div[2]/div/table/tbody[" + i + "]/tr/td/div/span/input[1]")).Click(); Console.WriteLine("Skill updated"); break; } } }
public void ThenShouldBeAbleToVerifyTheDeletedLanguage() { ExcelLibHelper.PopulateInCollection(ConstantHelpers.DataFilePath, "Language"); bool actualResult = addLanguage.VerifyLanguage(ExcelLibHelper.ReadData(3, "Language")); //Assert.False(actualResult); if (!actualResult) { Assert.False(actualResult); } else { Assert.Fail("Verification Failed."); throw new Exception("Result does not match"); } }
public static void VerifyAddCertification() { Thread.Sleep(1000); ExcelLibHelper.PopulateInCollection(@"D:\Mars\AdvancedTaskTeam-master\onboarding.specflow-master\MarsQA-1\SpecflowTests\Data\ProfileData.xlsx", "Certification"); var ActCertificate = CertificatelastRowValue.Text; var ActFrom = CertificateFromlastRowValue.Text; var Actyear = CertificateYearlastRowValue.Text; Assert.AreEqual(ActCertificate, ExcelLibHelper.ReadData(2, "Certificate"), "Certificate is not added"); Assert.AreEqual(ActFrom, ExcelLibHelper.ReadData(2, "From"), "From is not added"); Assert.AreEqual(Actyear, ExcelLibHelper.ReadData(2, "Year"), "Year is not added"); }
public static void DeleteLanguage() { for (int j = 1; j <= 5; j++) { var all = Driver.driver.FindElement(By.XPath("//div[@data-tab = 'first']/div/div[2]/div/table/tbody[" + j + "]/tr/td[1]")); Console.WriteLine(all.Text); ExcelLibHelper.PopulateInCollection(@"C:\Advance task\MarsQA-1\SpecflowTests\Data\\Mars.xlsx", "language"); if (all.Text == (ExcelLibHelper.ReadData(2, "langdelete"))) { IWebElement deleteLanguage = Driver.driver.FindElement(By.XPath("//div[@data-tab = 'first']/div/div[2]/div/table/tbody[" + j + "]/tr/td[3]/span[2]")); deleteLanguage.Click(); Console.WriteLine("Record deleted"); return; } } }
public static void AddNewLanguage() { Driver.TurnOnWait(); //Click on Add new button Addnew.Click(); //Ientify and enter language ExcelLibHelper.PopulateInCollection(@"C:\Advance task\MarsQA-1\SpecflowTests\Data\Mars.xlsx", "language"); Addlanguage.SendKeys(ExcelLibHelper.ReadData(2, "language")); //Identify and select from the dropdown SelectElement s = new SelectElement(languageDropdown); s.SelectByIndex(2); //Click on Add button Addbtn.Click(); }
public void Setup() { //IWebDriver driver = new ChromeDriver(); //Defining the browser Driver driver = new Driver(); driver.Initialize(); ExcelLibHelper.PopulateInCollection(@"D:\Internship_2020\MarsQA_1\MarsQA_1\SpecflowTests\Data\Mars.xlsx", "Credentials"); Thread.Sleep(2000); Mars_Login _login = new Mars_Login(); _login.ClickIn(); _login.SignIn(); }
internal void join() { Driver.NavigateUrl(); Driver.TurnOnWait(); //WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20)); //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//A[@class='item'][text()='Sign In']"))); Joinbtn.Click(); ExcelLibHelper.PopulateInCollection(@"C:\Advance task\MarsQA-1\SpecflowTests\Data\Mars.xlsx", "Join"); firstName.SendKeys(ExcelLibHelper.ReadData(2, "First")); lastName.SendKeys(ExcelLibHelper.ReadData(2, "Last")); email.SendKeys(ExcelLibHelper.ReadData(2, "email")); password.SendKeys(ExcelLibHelper.ReadData(2, "password")); confirmpassword.SendKeys(ExcelLibHelper.ReadData(2, "confirm")); checkbox.Click(); Join.Click(); }
public static void Verifyskilldeleted() { try { ExcelLibHelper.PopulateInCollection(@"D:\Mars\AdvancedTaskTeam-master\onboarding.specflow-master\MarsQA-1\SpecflowTests\Data\ProfileData.xlsx", "Skill"); var ActSkillname = Skillnamevalue.Text; var ActSkilllevel = Skilllevelvalue.Text; Assert.AreNotEqual(ActSkillname, ExcelLibHelper.ReadData(2, "Skill"), "Skill name is not deleted"); Assert.AreNotEqual(ActSkilllevel, ExcelLibHelper.ReadData(3, "Level"), "Skill level is not deleted"); } catch (Exception) { Assert.True(true, "Element not found"); } }
public void ThenClickOnAddButtonSellerShouldAbleToAddVerifySkillSuccesfully() { ExcelLibHelper.PopulateInCollection(ConstantHelpers.DataFilePath, "Skill"); skillPage = new SkillPage(); skillPage.AddSkill(ExcelLibHelper.ReadData(2, "Skill"), ExcelLibHelper.ReadData(2, "Level")); bool actualResult = skillPage.VerifySkill(ExcelLibHelper.ReadData(2, "Skill")); if (actualResult) { Assert.True(actualResult); } else { Assert.Fail("Verification Failed."); throw new Exception("Result does not match"); } }
public void ShareSkillPageRemaining() { var Startdatedata = ExcelLibHelper.ReadData(rownum, "StartDate"); StartDate.SendKeys(Startdatedata); var Enddatedata = ExcelLibHelper.ReadData(rownum, "EndDate"); EndDate.SendKeys(Enddatedata); Sunday.Click(); Monday.Click(); var Starttimedata = ExcelLibHelper.ReadData(rownum, "StartTime"); Starttime.SendKeys(Startdatedata); var Endtimedata = ExcelLibHelper.ReadData(rownum, "EndTime"); Endtime.SendKeys(Enddatedata); }
public void LoginPage(IWebDriver driver) { this.driver = driver; var Name = ExcelLibHelper.ReadData(rownum, "name"); WaitClass.ElementPresent(driver, "XPath", "//a[normalize-space()='Sign In']"); SignIn.Click(); driver.SwitchTo().ActiveElement(); EmailAddress.SendKeys(ExcelLibHelper.ReadData(rownum, "username")); Password.SendKeys(ExcelLibHelper.ReadData(rownum, "password")); LoginBtn.Click(); Thread.Sleep(2000); TestContext.WriteLine(Name); Assert.That(PName.Text == "Hi " + Name); // WaitClass.ElementPresent(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/span"); }
public static void CheckName(int DataRow) { //Prepares de ExcelSheet for reading ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "Profile"); //Check if the Name is displayed correctly string CheckName = ExcelLibHelper.ReadData(DataRow, "FirstName") + " " + ExcelLibHelper.ReadData(DataRow, "LastName"); if (Name.Text == CheckName) { Assert.Pass("The name " + Name.Text + " matches: " + CheckName); } else { Assert.Fail("The name " + Name.Text + " doesn't matches: " + CheckName); } }
public static void AddCertification() { Certificationstab.Click(); //Click on Add new button AddNewCertificationbtn.Click(); ExcelLibHelper.PopulateInCollection(@"C:\Advance task\MarsQA-1\SpecflowTests\Data\Mars.xlsx", "language"); //Enter the Certicate name Certificate.SendKeys(ExcelLibHelper.ReadData(2, "certification")); //Enter the Institution Institute.SendKeys("Adobe"); //Select year of certification from the dropdown SelectElement yearOfCertification = new SelectElement(Driver.driver.FindElement(By.XPath("//div[@data-tab = 'fourth']/div/div[2]/div/div/div[2]/div[2]/select"))); yearOfCertification.SelectByText("2015"); //Click on Add button AddCertificationbtn.Click(); }
internal void SearchName() { //Populate excel data ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "SearchSkill"); //Click search skill WaitHelpers.WaitForElementVisibility(Driver.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[2]/i", 10000); ClickSearckSkill.Click(); //Search user WaitHelpers.WaitForElementVisibility(Driver.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[3]/div[1]/div/div[1]/input", 10000); SearchUser.Click(); SearchUser.SendKeys(ExcelLibHelper.ReadData(2, "UserName")); //SearchUser.SendKeys("zorawar badhan"); Thread.Sleep(2000); }
internal void SearchSucessfull() { //Populate excel data ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "SearchSkill"); //Start the Reports CommonMethods.ExtentReports(); Thread.Sleep(1000); CommonMethods.test = CommonMethods.extent.StartTest("Search By Category"); // search skill catagory WaitHelpers.WaitForElementVisibility(Driver.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[2]/input", 10000); searchSkill.Click(); searchSkill.SendKeys(ExcelLibHelper.ReadData(2, "SearchSkillCategory")); CommonMethods.test.Log(LogStatus.Info, "Skill search using category is successfull"); SaveScreenShotClass.SaveScreenshot(Driver.driver, "SearchCategory"); }
public static void SearchLanguage(int NumberOfLanguagesToAdd) { for (int i = 1; i <= NumberOfLanguagesToAdd; i++) { ReadOnlyCollection <IWebElement> LanguageRecords = Driver.driver.FindElements(By.XPath(LanguageTable)); for (int j = 1; j <= LanguageRecords.Count; j++) { String LanguageValue = Driver.driver.FindElement(By.XPath(LanguageTable + "[" + j + "]//tr//td[1]")).Text; String LanguageLevelValue = Driver.driver.FindElement(By.XPath(LanguageTable + "[" + j + "]//tr//td[2]")).Text; if (LanguageValue == (ExcelLibHelper.ReadData(i + 1, "Language")) && LanguageLevelValue == (ExcelLibHelper.ReadData(i + 1, "Language Level"))) { NumberOfLanguagesFound++; break; } } } }
public static void VerifyDeletedService() { try { IWebElement TilteActual = Driver.driver.FindElement(By.XPath("//*[@id='listing-management-section']//tbody/tr[1]/td[3]")); var ExpTitle = ExcelLibHelper.ReadData(2, "Title"); var ActTitle = TilteActual.Text; Driver.TurnOnWait(); Assert.AreNotEqual(ActTitle, ExpTitle, "Title not deleted"); } catch (Exception e) { Assert.True(true, "Element not found"); } }
public void Validate_ShareSkill_NewRecord() { Thread.Sleep(2000); //Click on Manage Listing button Click_Action(manageListingsLink); //Iterating through the table on First Page try { for (int a = 1; a <= 5; a++) { for (int i = 2; i <= 18; i = i + 4) { Thread.Sleep(2000); //Get the Text of the "Category" var Category = Driver.driver.FindElement(By.XPath("(//td[contains(@class,'one wide')])[+ i +]")).Text; //Assert the Category Assert.Equals(Category, ExcelLibHelper.ReadData(2, "Category")); for (int j = 1; j <= 9; j = j + 2) { //Get The Text of the "Title" Thread.Sleep(2000); var Title = Driver.driver.FindElement(By.XPath("(//td[@class='four wide'])[+ j +]")).Text; //Assert the Titel Assert.Equals(Title, ExcelLibHelper.ReadData(2, "Title")); for (int k = 2; k <= 10; k = k + 2) { Thread.Sleep(2000); //Get The Text of "Description" var Description = Driver.driver.FindElement(By.XPath("(//td[contains(@class,'four wide')])[+ k +]")).Text; Assert.Equals(Description, ExcelLibHelper.ReadData(2, "Description")); break; //Assert the Description } } } } } catch (Exception) { Console.WriteLine("Test case is Failed"); } }
public void ThenSellerShouldBeAbleToDeleteTheSkillToTheProfilePage() { skillPage = new SkillPage(); ExcelLibHelper.PopulateInCollection(ConstantHelpers.DataFilePath, "Skill"); skillPage.SkillDelete(ExcelLibHelper.ReadData(3, "Skill")); bool isRecordPresent = skillPage.VerifySkill(ExcelLibHelper.ReadData(3, "Skill")); // Assert.False(isRecordPresent); if (!isRecordPresent) { Assert.False(isRecordPresent); } else { Assert.Fail("Verification Failed."); throw new Exception("Result does not match"); } }
public Profile LoginSteps() { Driver.NavigateUrl(); //Click on Join button SignIntab.Click(); //Enter First Name Email.SendKeys(ExcelLibHelper.ReadData(2, "username")); //Enter LastName Password.SendKeys(ExcelLibHelper.ReadData(2, "password")); //Enter click button LoginBtn.Click(); return(new Profile()); }
public static void VerifySavedSeriveList() { var ExpTitle = ExcelLibHelper.ReadData(2, "Title"); var ActTitle = TitleS1.Text; var ExpDes = ExcelLibHelper.ReadData(2, "Description"); var ActDes = DescriptionS1.Text; var ExpCat = ExcelLibHelper.ReadData(2, "Category"); var ActCat = CategoryS1.Text; Assert.AreEqual(ExpTitle, ActTitle, "Title is not saved"); Assert.AreEqual(ExpDes, ActDes, "Description does not match"); Assert.AreEqual(ExpCat, ActCat, "Categoty does not match"); }
public static void EditDescription() { ExcelLibHelper.PopulateInCollection(@"C:\AdvancedTaskLevel1\onboarding.specflow-master\MarsQA-1\SpecflowTests\Data\ProfileData.xlsx", "Description"); // Click on description edit icon and navigate to Descrition field Driver.TurnOnWait(); DescriptionEditIcon.Click(); // Add Description content Driver.TurnOnWait(); DescriptionTextField.Clear(); DescriptionTextField.SendKeys(ExcelLibHelper.ReadData(2, "Text")); SaveButton.Click(); Thread.Sleep(1000); }
public static void AddEducation(int DataRow) { //Prepares de ExcelSheet for reading ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "Profile"); //Fill Education after changing tab and waiting for elements to be interactable tabEducation.Click(); WaitHelper.WaitClickble(Driver.driver, buttonAddEducation); buttonAddEducation.Click(); textboxCollege.SendKeys("CETI"); dropdownCollege.Click(); dropdownCollegeOption.Click(); dropdownTitle.Click(); dropdownTitleOption.Click(); textboxDegree.SendKeys((ExcelLibHelper.ReadData(DataRow, "University"))); dropdownGraduation.Click(); dropdownGraduationOption.Click(); buttonAddEducationSave.Click(); }
//Custom Method - Dynamic Table public void SelectDaytime() { StartDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Startdate")); EndDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Enddate")); for (int i = 0; i <= 6; i++) { var day = Driver.driver.FindElement(By.CssSelector("input[name='Available'][index='" + i + "']")); var starttime = Driver.driver.FindElement(By.CssSelector("input[name='StartTime'][index='" + i + "']")); var endtime = Driver.driver.FindElement(By.CssSelector("input[name='EndTime'][index='" + i + "']")); var label = Driver.driver.FindElement(By.XPath("//div[@class='fields'][" + (2 + i) + "]/div/div//label")); if (ExcelLibHelper.ReadData(2, "Selectday") == label.Text) { day.Click(); starttime.SendKeys(ExcelLibHelper.ReadData(2, "Starttime")); endtime.SendKeys(ExcelLibHelper.ReadData(2, "Endtime")); } } }
//Validate new Language internal void ValidateAddLanguage() { Console.WriteLine("******************************"); try { //Start the Reports // test = extent.CreateTest("Add Language"); // test.Log(Status.Info, "Add new language"); //language test driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); //click on language button // LanguageButton.Click(); //text lang String Lang = driver.FindElement(By.XPath("(//div[@data-tab='first']//table//tbody//tr[1]//td[1])[1]")).Text; ExtentionHelpers.TurnOnWait(driver); //text level String level = driver.FindElement(By.XPath("(//div[@data-tab='first']//table//tbody//tr[1]//td[2])[1]")).Text; //Validation Assert.Multiple(() => { Assert.AreEqual(Lang, ExcelLibHelper.ReadData(3, "Language")); Assert.AreEqual(level, ExcelLibHelper.ReadData(2, "LanguageLevel")); }); SaveScreenShotClass save = new SaveScreenShotClass(); string img = save.SaveScreenshot(driver, "AddLanguage"); Console.WriteLine("Assertion Pass"); Console.WriteLine("******************************"); } catch (Exception e) { Console.WriteLine(e.Message); } }
//Function for Clicking on Category and sub-category public static void ClickOnCategory(int DataRow) { //Prepares the Excel Sheet ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "ShareSkill"); WaitHelper.WaitClickble(Driver.driver, AllCategory[5]); //Count Category var countCategory = AllCategory.Count(); for (int i = 0; i < countCategory; i++) { string Category = AllCategory[i].Text; //Get whole text from web page string[] trimmedText = Category.Split(new char[] { '\n' }); //Split by enter string CategoryName = trimmedText.First(); //Find first word //Check if web Element matches Category in a Excel file if (CategoryName == (ExcelLibHelper.ReadData(DataRow, "Category") + "\r")) { //Click on Category AllCategory[i].Click(); //Count Subcategory var countSubCat = Sub_Category.Count(); for (int j = 1; j <= countSubCat; j++) { string subCategory = Sub_Category[j].Text; //Get whole text from web page string[] trimText = subCategory.Split(new char[] { '\n' }); //Split by enter string subCategoryName = trimText.First(); //Find first word //Check if web Element matches Sub-Category in a Excel file if (subCategoryName == (ExcelLibHelper.ReadData(DataRow, "Sub-Category") + "\r")) { //Click on Sub-Category Sub_Category[j].Click(); i--; countCategory = AllCategory.Count(); break; } } } } }
public static void CheckSentRequest() { //Waits for the elements to load WaitHelper.LongWait(); WaitHelper.WaitClickble(Driver.driver, SentTitle); //Prepares the Excel Sheet ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "ShareSkill"); //Compares the request title with the "Add Skill Share" or "Edit Skill Share" test cases if (SentTitle.Text == ExcelLibHelper.ReadData(2, "Title") || SentTitle.Text == ExcelLibHelper.ReadData(3, "Title") || SentTitle.Text == "TitleText" || SentTitle.Text == "DevOps") { Assert.Pass("Request Title Found!"); } else { Assert.Fail(SentTitle.Text + "::doesn't match::" + ExcelLibHelper.ReadData(2, "Title") + "::nor::" + ExcelLibHelper.ReadData(3, "Title")); } }
internal void EnterLanguage() { //Populate excel data ExcelLibHelper.PopulateInCollection(ConstantHelpers.ExcelPath, "Profile"); //Click on language add new LangBtn.Click(); WaitHelpers.WaitForElementVisibility(Driver.driver, "XPath", "//div[@id='account-profile-section']/div/section[2]/div/div/div/div[3]/form/div[2]/div/div[2]/div/table/thead/tr/th[3]/div", 10000); AddNewLangBtn.Click(); //Add new language AddLangText.Click(); ChooseLang.SendKeys(ExcelLibHelper.ReadData(2, "Language")); //Select language level ChooseLevel.Click(); new SelectElement(ChooseLevel).SelectByText(ExcelLibHelper.ReadData(2, "LanguageLevel")); Thread.Sleep(1000); }
public static void VerifyUsername() { Thread.Sleep(1000); ExcelLibHelper.PopulateInCollection(@"C:\AdvancedTaskLevel1\onboarding.specflow-master\MarsQA-1\SpecflowTests\Data\ProfileData.xlsx", "ProfileData"); String fname = ExcelLibHelper.ReadData(2, "First Name"); String lname = ExcelLibHelper.ReadData(2, "Last Name"); String actualText = Driver.driver.FindElement(By.XPath("//div[@class='title']")).Text; String expectedText = fname + " " + lname; if (actualText.Contains(expectedText)) { Assert.True(true, "Is as expected"); } else { Assert.False(false, "Is not as expected"); Assert.Fail("User Name is not updated"); } }
public static void AddCertification() { ExcelLibHelper.PopulateInCollection(@"C:\AdvancedTaskLevel1\onboarding.specflow-master\MarsQA-1\SpecflowTests\Data\ProfileData.xlsx", "Cerification"); Driver.TurnOnWait(); CertificateAddNew.Click(); CertificateAward.SendKeys(ExcelLibHelper.ReadData(2, "Certificate")); CertificateFrom.SendKeys(ExcelLibHelper.ReadData(2, "From")); SelectElement year = new SelectElement(CertificationYear); year.SelectByText(ExcelLibHelper.ReadData(2, "Year")); CertificationAddData.Click(); Thread.Sleep(1000); }