public void TestAddTimeAndMaterial() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click TimeAndMaterialsPage timeAndMaterialsPage = null; TimeAndMaterial timeAndMaterialObject = null; try { timeAndMaterialsPage = homePage.GoToTimeAndMaterialsPage(Driver); // Verify that you are on Time & Materials Page by checking the URL ValidateURL(Driver, timeAndMaterialUrl); // Create new Time and Material item // Locate TypeCode dropdown field and Select Time // Locate Code textfield and enter test123 // Locate Description textfield and enter current timestamp as the description for uniqueness // Locate Price per unit field and enter 10.00; // Locate and click Save Button timeAndMaterialObject = CreateNewTimeAndMaterial( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Code"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Price")); timeAndMaterialsPage.CreateNewTimeAndMaterial(Driver, timeAndMaterialObject); // Verify that the item was added } catch (WebDriverException e) { Console.WriteLine(e.StackTrace); Assert.Fail("Unexpected exception occurred - TestAddTimeAndMaterial failed", e); } Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Not.Null, "Time and Material was not added - TestAddTimeAndMaterial failed"); }
public void LoginSteps(IWebDriver driver) { //Maximize the browser driver.Manage().Window.Maximize(); //Navigate to login page // driver.Navigate().GoToUrl("http://horse-dev.azurewebsites.net/Account/Login"); //Read navigate url from Excel file driver.Navigate().GoToUrl(ExcelLibHelpers.ReadData(2, "url")); //Enter user name using ID // Username.SendKeys("hari //Reading userid from excel Username.SendKeys(ExcelLibHelpers.ReadData(2, "username")); //Enter password using ID // Password.SendKeys("123123"); //Readin password from excel Password.SendKeys(ExcelLibHelpers.ReadData(2, "password")); //Click login button LoginButton.Click(); //Validate if the user had logged in succfully Assert.That(LoggedinUser.Text, Is.EqualTo("Hello hari!")); }
public void LoginSteps(IWebDriver driver) { // open up chrome browser //IWebDriver driver = new ChromeDriver(@"D:\chrome_webdriver"); // enter the url driver.Navigate().GoToUrl("http://horse-dev.azurewebsites.net/Account/Login?ReturnUrl=%2f"); // maximize the browser driver.Manage().Window.Maximize(); //Populate Loging Page test data Collection ExcelLibHelpers.PopulateInCollection(@"C:\Users\myfri\Source\Repos\pavulurikc\chowdary\Chowdary\TestData\TestData.xls", "LoginPage"); // identify username and enter username value driver.FindElement(By.Id("UserName")).SendKeys(ExcelLibHelpers.ReadData(2, "UserName")); // identify password and enter password driver.FindElement(By.Id("Password")).SendKeys(ExcelLibHelpers.ReadData(2, "Password")); // identify login button and click driver.FindElement(By.XPath("//*[@id='loginForm']/form/div[3]/input[1]")).Click(); // verify if the home page is displayed as expected if (driver.FindElement(By.XPath("//*[@id='logoutForm']/ul/li/a")).Text == "Hello hari!") { Console.WriteLine("Test Passed"); } else { Console.WriteLine("Test Failed"); } }
public void VerifyEnterProfileCertifications() { //Populate data saved in Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); //Refresh the page driver.Navigate().Refresh(); //Wait for all text present in Element WaitHelpers.WaitForTextPresentInElement(driver, profileName, ExcelLibHelpers.ReadData(3, "Column18"), 10); #region Verify Certifications //Jump to Certification tab CertificationTab.Click(); //Verify Certificate Name var lastRowCertificateName = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[5]//div[2]//tbody[last()]/tr/td[1]")).Text; Assert.IsTrue(lastRowCertificateName.Contains(ExcelLibHelpers.ReadData(3, "Column12"))); //Verify Certificate Issuing Place var lastRowCertificateFrom = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[5]//div[2]//tbody[last()]/tr/td[2]")).Text; Assert.IsTrue(lastRowCertificateFrom.Contains(ExcelLibHelpers.ReadData(3, "Column13"))); //Verify Certificate Year var lastRowCertificateYear = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[5]//div[2]//tbody[last()]/tr/td[3]")).Text; Assert.IsTrue(lastRowCertificateYear.Contains(ExcelLibHelpers.ReadData(3, "Column14"))); #endregion }
public void DeleteProfile() { //Populate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); //Wait for all text present in Element WaitHelpers.WaitForTextPresentInElement(driver, profileName, ExcelLibHelpers.ReadData(3, "Column18"), 10); #region Delete Language //Delete the last record LanguageTab.Click(); LanguageDeleteBtn.Click(); #endregion #region Delete Skills //Delete last record SkillTab.Click(); SkillDeleteBtn.Click(); #endregion #region Delete Education //Delete last record EducationTab.Click(); EducationDeleteBtn.Click(); #endregion #region Delete Certification //Delete last record CertificationTab.Click(); CertificateDeleteBtn.Click(); #endregion }
public void TestDeleteTimeAndMaterial() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click TimeAndMaterialsPage timeAndMaterialsPage = null; TimeAndMaterial timeAndMaterialObject = null; try { timeAndMaterialsPage = homePage.GoToTimeAndMaterialsPage(Driver); // Verify that you are on Time & Materials Page by checking the URL ValidateURL(Driver, timeAndMaterialUrl); timeAndMaterialObject = CreateNewTimeAndMaterial( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Code"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Price")); timeAndMaterialsPage.CreateNewTimeAndMaterial(Driver, timeAndMaterialObject); // Verify that the item was added PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject); Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Not.Null, "Time and Material was not created - TestDeleteTimeAndMaterial failed"); // Now perform delete by clicking Delete button timeAndMaterialsPage.DeleteTimeAndMaterial(Driver, timeAndMaterialObject); } catch (WebDriverException e) { Console.WriteLine(e.StackTrace); Assert.Fail("Unexpected exception occurred - TestDeleteTimeAndMaterial failed" + e.Message); } // verify that deletion was successful Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Null, "Time and Material was not deleted - TestDeleteTimeAndMaterial failed"); }
public void LoginSteps(IWebDriver driver) { //Wait for login page to be loaded and 'Sign In' to become visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='home']/div/div/div[1]/div/a"); //Identify the Sign In button and click IWebElement signIn = driver.FindElement(By.XPath("//*[@id='home']/div/div/div[1]/div/a")); signIn.Click(); //Wait for email textbox to be present Wait.ElementPresent(driver, "Name", "email"); ExcelLibHelpers.PopulateInCollection(@"D:\Internship\Onboarding_task\SkillExchange\SkillExchange\TestData\TestData.xls", "LoginPage"); //Identify the email textbox and click IWebElement email = driver.FindElement(By.Name("email")); email.SendKeys(ExcelLibHelpers.ReadData(2, "email")); //Identify the password textbox and click IWebElement pswrd = driver.FindElement(By.Name("password")); pswrd.SendKeys(ExcelLibHelpers.ReadData(2, "password")); //Identify the Login button and click IWebElement login = driver.FindElement(By.XPath("//html/body/div[2]/div/div/div[1]/div/div[4]/button")); login.Click(); //Wait for Home page to be loaded by checking if 'Sign Out' is visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/a[2]/button"); }
public void VerifyEnterProfileEducation() { //Populate data saved in Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); //Refresh the page driver.Navigate().Refresh(); //Wait for all text present in Element WaitHelpers.WaitForTextPresentInElement(driver, profileName, ExcelLibHelpers.ReadData(3, "Column18"), 10); #region Verify Education //Jump to Education tab EducationTab.Click(); //Verify Education Country var lastRowEducationCountry = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[4]//div[2]//tbody[last()]/tr/td[1]")).Text; Assert.IsTrue(lastRowEducationCountry.Contains(ExcelLibHelpers.ReadData(3, "Column7"))); //Verify Education Name var lastRowEducationName = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[4]//div[2]//tbody[last()]/tr/td[2]")).Text; Assert.IsTrue(lastRowEducationName.Contains(ExcelLibHelpers.ReadData(3, "Column6"))); //Verify Education Title var lastRowEducationTitle = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[4]//div[2]//tbody[last()]/tr/td[3]")).Text; Assert.IsTrue(lastRowEducationTitle.Contains(ExcelLibHelpers.ReadData(3, "Column8"))); //Verify Education Degree var lastRowEducationDegree = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[4]//div[2]//tbody[last()]/tr/td[4]")).Text; Assert.IsTrue(lastRowEducationDegree.Contains(ExcelLibHelpers.ReadData(3, "Column9"))); //Verify Education Graduation Year var lastRowEducationGraduationYear = driver.FindElement(By.XPath("//*[@id='account-profile-section']" + "/div/section[2]//div[3]/form/div[4]//div[2]//tbody[last()]/tr/td[5]")).Text; Assert.IsTrue(lastRowEducationGraduationYear.Contains(ExcelLibHelpers.ReadData(3, "Column10"))); #endregion }
//Validate the functionality of 'Search' Button with valid data. internal void ValidateSearch() { ExcelLibHelpers.PopulateInCollection(Base.ExcelPath, "Search"); AdvancedLnk.Click(); KeywrdTxtbox.SendKeys(ExcelLibHelpers.ReadData(3, "searchKeyword")); BuyNowCheckbx.Click(); AdvanceSearchBtn.Click(); Thread.Sleep(4000); var ResultLbl = Driver.driver.FindElement(By.XPath("html/body/div[5]/div[2]/div[1]/div[1]/div/div[1]/div/div[1]/div/div[3]/h1")).Text; if (ResultLbl == ExcelLibHelpers.ReadData(2, "searchresult")) { Console.WriteLine("Test case Passed. 0 results found."); } else { for (var i = 1; i <= 50; i++) { var SearchResult = Driver.driver.FindElement(By.XPath("html/body/div[5]/div[2]/div[1]/div[1]/div/div[1]/div/div[3]/div/div[1]/div/w-root/div/div/ul/li[" + i + "]/h3")).Text; if (SearchResult.StartsWith(ExcelLibHelpers.ReadData(2, "searchKeyword"))) { Console.WriteLine("Test case Passed. Searched record found."); return; } else { Console.WriteLine("Test case Failed. Searched record not found."); } } } }
internal void LoginSteps(IWebDriver driver) { //After hiting URl //Click in SignIn button SignInTab.Click(); //populate login page data collection ExcelLibHelpers.PopulateInCollection(MarsResource.ExcelPath, "SignIn"); //Give Email Address Email.SendKeys(ExcelLibHelpers.ReadData(2, "Email")); //give password Password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); //check on check-box CheckBox.Click(); //click on Login Button Login.Click(); try { //Wait untill CommomDriver.WaitForVisibility(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/span", 5); //Assertion for checking condition Assert.That(LoginText.Text, Is.EqualTo(ExcelLibHelpers.ReadData(2, "Text"))); } catch (NoSuchElementException e) { Console.WriteLine(e.Message); } }
public void AvailabilityDetailsValidation() { //Validation of avaibility type details try { Assert.IsTrue(AvailabilityTime.Text.Contains(ExcelLibHelpers.ReadData(3, "Column20"))); } catch (Exception ex) { Assert.Fail("Test failed to verify Entering Availability Type", ex.Message); } //Validation of avaibility time details try { Assert.IsTrue(AvailabilityHours.Text.Contains(ExcelLibHelpers.ReadData(3, "Column21"))); } catch (Exception ex) { Assert.Fail("Test failed to verify Entering Availability Hours", ex.Message); } //Validation of salary details try { Assert.IsTrue(Salary.Text.Contains(ExcelLibHelpers.ReadData(3, "Column22"))); } catch (Exception ex) { Assert.Fail("Test failed to verify Entering Earn Target", ex.Message); } }
public void TestAddCustomer() { HomePage homePage = new HomePage(); CustomersPage customersPage = null; Customer customerObject = null; // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click try { customersPage = homePage.GoToCustomersPage(Driver); Contact contactObject = new Contact( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactFirstName"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactLastName"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactPhoneNumber")); customerObject = new Customer(ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "CustomerName"), contactObject, contactObject); customersPage.CreateNewCustomer(Driver, customerObject); // go back to the summary page // creating a new customer does not change the landing page // have to explicitly go back to the summary page... //Driver.Navigate().Back(); //customersPage.refreshTable(Driver); Driver.Navigate().GoToUrl(customersUrl); } catch (Exception e) { Assert.Fail("Unexpected error has occurred - TestAddCustomer failed " + e.Message); } // verify Assert.That(PerformValidation(Driver, customersPage, customerObject), Is.Not.Null, "Unable to create new customer - TestAddCustomer failed"); }
public void AvailabilityDetails() { //Populate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); #region Availability Type details entry //Waiting for Profile page to load after signing in WaitHelpers.ExplicitWait(driver, "ElementToBeClickable", "XPath", "//span[contains(text(),'Time')]/i", 10); // Click Edit icon AvailabilityTimeEdit.Click(); // Click dropdown menu AvailabilityTime.Click(); // Choose Availability parttime; fulltime new SelectElement(AvailabilityTime).SelectByText(ExcelLibHelpers.ReadData(3, "Column20")); #endregion #region Availability Time details entry //Enter Availability Hours AvailabilityHoursEdit.Click(); // Click dropdown menu AvailabilityHours.Click(); // Select Hours 0-less than 30h; 1-more than 30h 2-as needed new SelectElement(AvailabilityHours).SelectByText(ExcelLibHelpers.ReadData(3, "Column21")); #endregion #region Salary details entry //Enter Earn Target SalaryEdit.Click(); // Click dropdown menu Salary.Click(); // Click earn 0-less than 500; 1-500~1000; 2-more than 1000 new SelectElement(Salary).SelectByText(ExcelLibHelpers.ReadData(3, "Column22")); #endregion }
public void LoginSteps() { //Wait for login page to be loaded and 'Sign In' to become visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='home']/div/div/div[1]/div/a"); //Click on Sign in button signIn.Click(); ExcelLibHelpers.PopulateInCollection(ServiceData.ExcelPath, "SignUp"); //Wait for email textbox to be present Wait.ElementPresent(driver, "Name", "email"); //Read the emailID data from excel and enter the data into the Email Textbox email.SendKeys(ExcelLibHelpers.ReadData(2, "EmailID")); //Read the Password data from excel and enter the data into the Password Textbox pswrd.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); //Click on the Login button login.Click(); //Wait for Home page to be loaded by checking if 'Sign Out' is visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/a[2]/button"); }
public void LoginSteps() { //Go to Url //CommonDriver.driver.Navigate().GoToUrl("http://horse-dev.azurewebsites.net/Account/Login?ReturnUrl=%2f"); CommonDriver.driver.Navigate().GoToUrl(ExcelLibHelpers.ReadData(2, "url")); //Enter USer Name //username.SendKeys("hari"); username.SendKeys(ExcelLibHelpers.ReadData(2, "username")); //Enter Password password.SendKeys(ExcelLibHelpers.ReadData(2, "password")); // Enter Login login.Click(); ///Check if home page is displayed //if (CommonDriver.driver.FindElement(By.XPath("/html/body/div[3]/div/a")).Text == "TurnUp") //{ // Console.WriteLine("Logged in Successfully,Test Pased"); //} //else //{ // Console.WriteLine("Login fail"); //} var homePageText = CommonDriver.driver.FindElement(By.XPath("/html/body/div[3]/div/a")).Text; Assert.AreEqual("TurnUp", homePageText); }
public void AddTM(IWebDriver driver) { // identify Create New button driver.FindElement(By.XPath("//*[@id='container']/p/a")).Click(); // Populate Create TM test data collection ExcelLibHelpers.PopulateInCollection(@"A:\TestCases\Login Page\Login Page\TestData\TestData.xls", "TMPage"); //identify code button driver.FindElement(By.Id("Code")).SendKeys(ExcelLibHelpers.ReadData(2, "Code")); //identify description button driver.FindElement(By.Id("Description")).SendKeys(ExcelLibHelpers.ReadData(2, "Description")); //click on Save button driver.FindElement(By.Id("SaveButton")).Click(); // wait // Thread.Sleep(1000); // wait for the TM page to be loaded and Go to last page button rendered Sync.WaitForVisiblitity(driver, "XPath", "//*[@id='tmsGrid']/div[4]/a[4]", 10); // go to the last page driver.FindElement(By.XPath("//*[@id='tmsGrid']/div[4]/a[4]")).Click(); // wait for the TM page to be loaded and Go to last page button rendered Sync.WaitForVisiblitity(driver, "XPath", ".//*[@id='tmsGrid']/div[3]/table/tbody/tr[last()]/td[1]", 20); // Implementation of Assertion Assert.That(driver.FindElement(By.XPath(".//*[@id='tmsGrid']/div[3]/table/tbody/tr[last()]/td[1]")).Text, Is.EqualTo(ExcelLibHelpers.ReadData(2, "Code"))); //// verify if T&M present record is presen or not //if (driver.FindElement(By.XPath("//*[@id='tmsGrid']/div[3]/table/tbody/tr[last()]/td[1]")).Text == "Perfect") //{ // Console.WriteLine("TM created successfully, Test Passed"); //} //else //{ // Console.WriteLine("Test Failed"); //} }
public void loginSteps(IWebDriver driver) { ExcelLibHelpers.PopulateInCollection(@"/Users/oiyo/Projects/Industryconnect/Industryconnect/TestData.xlsx", "LoginPage"); //Enter the url driver.Navigate().GoToUrl("http://horse-dev.azurewebsites.net/Account/Login?ReturnUrl=%2f"); //Locate Username textbox and enter the username IWebElement Username = driver.FindElement(By.Id("UserName")); Username.SendKeys(ExcelLibHelpers.ReadData(2, "Username")); //Locate Password textbox and enter the password IWebElement Password = driver.FindElement(By.Id("Password")); Password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); //Locate the login button and click on it IWebElement Login = driver.FindElement(By.XPath("//*[@id='loginForm']/form/div[3]/input[1]")); Login.Click(); //Check if the home page is displayed IWebElement helloHari = driver.FindElement(By.XPath("//*[@id='logoutForm']/ul/li/a")); if (helloHari.Text == "Hello hari!") { Console.WriteLine("Logged in successfully, Test passed"); } else { Console.WriteLine("Login page not seen, Test Failed"); } }
public void EnterProfileEducation() { // Populate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); #region Enter Education //Click Add New EducationAddNewBtn.Click(); //Enter University Name EducationName.SendKeys(ExcelLibHelpers.ReadData(3, "Column6")); //Enter Degree EducationDegree.SendKeys(ExcelLibHelpers.ReadData(3, "Column9")); //Choose Country EducationCountryDropdownBox.Click(); new SelectElement(EducationCountryDropdownBox).SelectByText(ExcelLibHelpers.ReadData(3, "Column7")); //Choose Title 0-Associate; 1-B.A; 2-BArch; 3-BFA; 4-B.Sc... EducationTitleDropdownBox.Click(); new SelectElement(EducationTitleDropdownBox).SelectByText(ExcelLibHelpers.ReadData(3, "Column8")); //Choose Year EducationGraduationYearDropdownBox.Click(); new SelectElement(EducationGraduationYearDropdownBox).SelectByText(ExcelLibHelpers.ReadData(3, "Column10")); //Click Add EducationAddBtn.Click(); #endregion }
public void AddCustome(IWebDriver driver) { // identify Create New button driver.FindElement(By.XPath("//*[@id='container']/p/a")).Click(); // Populate Add Customer test data collection ExcelLibHelpers.PopulateInCollection(@"A:\TestCases\Login Page\Login Page\TestData\TestData.xls", "CustomerPage"); //identify Name button driver.FindElement(By.XPath("//*[@id='Name']")).SendKeys(ExcelLibHelpers.ReadData(2, "Name")); //identify Edit Contact button driver.FindElement(By.XPath("//*[@id='EditContactButton']")).Click(); //wait //Thread.Sleep(1000); // wait for the Edit Contact page to be loaded and First name, LastName textbox rendered Sync.WaitForVisiblitity(driver, "XPath", "//*[@id='contactDetailWindow']/iframe", 10); // Handle second window driver.SwitchTo().Frame(driver.FindElement(By.XPath("//*[@id='contactDetailWindow']/iframe"))); // identify First Name of edit contact driver.FindElement(By.XPath("//*[@id='FirstName']")).SendKeys(ExcelLibHelpers.ReadData(2, "FirstName")); // identify Last Name botton of Edit Contact driver.FindElement(By.XPath("//*[@id='LastName']")).SendKeys(ExcelLibHelpers.ReadData(2, "LastName")); // identify the Phone botton of Edit contact driver.FindElement(By.XPath("//*[@id='Phone']")).SendKeys(ExcelLibHelpers.ReadData(2, "Phone")); //click on Save Edit contact button driver.FindElement(By.XPath(".//*[@id='submitButton' ][@value='Save Contact']")).Click(); driver.SwitchTo().DefaultContent(); // click on Save as above driver.FindElement(By.XPath("//*[@id='IsSameContact']")).Click(); // Click on save button driver.FindElement(By.XPath(".//*[@id='submitButton' ]")).Click(); // click on administration driver.FindElement(By.XPath("/html/body/div[3]/div/div/ul/li[5]/a")).Click(); // Click on Customer driver.FindElement(By.XPath("/html/body/div[3]/div/div/ul/li[5]/ul/li[1]/a")).Click(); // wait // Thread.Sleep(3000); // wait for the Customer page to be loaded and Go to Last Page button rendered Sync.WaitForVisiblitity(driver, "XPath", "//*[@id='clientsGrid']/div[4]/a[4]", 10); // go to the last page driver.FindElement(By.XPath("//*[@id='clientsGrid']/div[4]/a[4]")).Click(); // wait //Thread.Sleep(1000); // wait for the Last record of Customer page to be loaded and new record to be display Sync.WaitForVisiblitity(driver, "XPath", "//*[@id='clientsGrid']/div[2]/table/tbody/tr[last()]/td[2]", 10); // Implementation of Assertion Assert.That(driver.FindElement(By.XPath("//*[@id='clientsGrid']/div[2]/table/tbody/tr[last()]/td[2]")).Text, Is.EqualTo(ExcelLibHelpers.ReadData(2, "Name"))); //// verify if Customer record is present or not //if (driver.FindElement(By.XPath("//*[@id='clientsGrid']/div[2]/table/tbody/tr[last()]/td[2]")).Text == "Bharati") //{ // Console.WriteLine("Customer created successfully, Test Passed"); //} //else //{ // Console.WriteLine("Test Failed"); //} }
internal void LoginSuccess() { username.SendKeys(ExcelLibHelpers.ReadData(2, "UserName")); password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); clickbutton.Click(); }
public void PasswordChangeValidation() { //Password change validation if (CurrentPass == NewPass) { //Wait for error message to appear WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "CssSelector", "a.ns-close", 10); Assert.IsTrue(GetErrorPopUpMessage() == "Current Password and New Password should not be same"); //Close opened form for password change CloseForm(); //Close error message MessageBoxClose(); } else { //Wait for success messgae to appear WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "CssSelector", "a.ns-close", 10); Assert.IsTrue(GetSuccessPopUpMessage() == "Password Changed Successfully"); //Close success message MessageBoxClose(); //Again changing the password to the older Actions actions = new Actions(driver); actions.MoveToElement(ProfileName).Perform(); WaitHelpers.ExplicitWait(driver, "ElementExists", "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/span", 10); actions.MoveToElement(ChangePasswordClick).Perform(); ChangePasswordClick.Click(); //Enter Current, new and confirm password CurrentPassword.SendKeys(ExcelLibHelpers.ReadData(5, "Column0")); NewPassword.SendKeys(ExcelLibHelpers.ReadData(5, "Column1")); ConfirmPassword.SendKeys(ExcelLibHelpers.ReadData(5, "Column2")); SaveButton.Click(); } }
public void Setup() { driver = new ChromeDriver(); //populate the data in excel ExcelLibHelpers.PopulateInCollection(@"C:\Code\ic\ic-2019-05\horsedev\Data\testdata.xlsx", "timeTestData"); LoginPage loginPage = new LoginPage(driver); loginPage.LoginSuccess(); }
public void SkillSearch() { SearchBox.Click(); //Populate data from Excel and search for skill ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Search"); SearchBox.SendKeys(ExcelLibHelpers.ReadData(3, "Column0") + Keys.Enter); //Wait for page load with search results WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[2]/div/div[1]/div", 10); }
public void login() { CommonDriver.driver = new ChromeDriver(); ExcelLibHelpers.PopulateInCollection(@"C:\Users\aadhith.bose\Dropbox\Software Testing\Industry Connect\10 AutomationTesting\2018 Aug\Demo\Demo\Data\data.xlsx", "tc1"); LoginPage loginObj = new LoginPage(); loginObj.LoginSteps(); }
internal void CreateTimeAndMaterial() { // For Creating First Record Id.SendKeys(ExcelLibHelpers.ReadData(2, "Code")); Descid.SendKeys(ExcelLibHelpers.ReadData(2, "Description")); driver.FindElement(By.XPath(".//*[@id='TimeMaterialEditForm']/div/div[4]/div/span[1]/span/input[1]")).SendKeys(ExcelLibHelpers.ReadData(2, "PricePerUnit")); driver.FindElement(By.XPath("//input[@id='SaveButton']")).Click(); //WebElementExtensions.ElementExists(driver, By.Name(""), TimeSpan.FromDays(1)); }
internal void EnterValidDataandSave() { ExcelLibHelpers.PopulateInCollection(@"C:\Users\KHeartMiranda\source\repos\ConsoleApp2\ConsoleApp2\Test Data\Test.xlsx", "Data Sheet"); //driver.FindElement(By.XPath("(//span[contains(.,'Time')])[3]")); driver.FindElement(By.Id("Code")).SendKeys(ExcelLibHelpers.ReadData(2, "Code")); driver.FindElement(By.Id("Description")).SendKeys(ExcelLibHelpers.ReadData(2, "Description")); driver.FindElement(By.XPath("//input[contains(@class,'k-formatted-value k-input')]")).SendKeys(ExcelLibHelpers.ReadData(2, "Price")); driver.FindElement(By.Id("SaveButton")).Click(); }
public void ThenIShouldBeAbleToEditTimeAndMaterial() { // Time & Material Page - Click on Edit Button and Edit Time and Material Value. TimeandMaterialPage instanceNameTandM = new TimeandMaterialPage(GlobalDriver.driver); ExcelLibHelpers.PopulateInCollection(@"E:\TestData\TestDataForHorseDev.xlsx", "EditTimeAndMaterials"); instanceNameTandM.EditTimenMaterail(); //Closing driver instance GlobalDriver.driver.Close(); }
internal void deleteTimenMaterial() { // WebElementExtensions.ElementExists(driver, By.XPath("//tr[1]/td[5]/a[@class='k-button k-button-icontext k-grid-Delete' and 2]"), TimeSpan.FromSeconds(10)); WebElementExtensions.ElementExists(driver, By.XPath("//a[contains(.,'Edit')]"), TimeSpan.FromSeconds(10)); try { while (true) { for (var i = 1; i <= 10; i++) { IWebElement code = driver.FindElement(By.XPath("//tr[" + i + "]/td[1]")); IWebElement desc = driver.FindElement(By.XPath("//tr[" + i + "]/td[3]")); IWebElement TypeCode = driver.FindElement(By.XPath("//tr[" + i + "]/td[2]")); IWebElement Price = driver.FindElement(By.XPath("//tr[" + i + "]/td[4]")); IWebElement btndelete = driver.FindElement(By.XPath("//tr[" + i + "]/td[5]/a[@class='k-button k-button-icontext k-grid-Delete' and 2]")); Console.WriteLine(code.Text); Console.WriteLine(desc.Text); Console.WriteLine(TypeCode.Text); Console.WriteLine(Price.Text); if (code.Text == ExcelLibHelpers.ReadData(2, "Code") && desc.Text == ExcelLibHelpers.ReadData(2, "Description")) //if (code.Text == "SSRR112" && desc.Text == "SSRR112")// && TypeCode.Text == "M" && Price.Text == "7.90") { Console.WriteLine("Test Passed"); btndelete.Click(); Thread.Sleep(2000); driver.SwitchTo().Alert().Accept(); Thread.Sleep(2000); //Deletbtn.Click(); //Editbtn.Click(); //Id.Clear(); //Id.SendKeys("Testnew"); //Descid.SendKeys("Test Descritionnew"); //driver.FindElement(By.XPath(".//*[@id='TimeMaterialEditForm']/div/div[4]/div/span[1]/span/input[1]")).SendKeys("7.90"); //driver.FindElement(By.XPath("//input[@id='SaveButton']")).Click(); //WebElementExtensions.ElementExists(driver, By.XPath("//a[contains(.,'Edit')]"), TimeSpan.FromSeconds(10)); return; } } nextbtn.Click(); } } catch (Exception) { Console.WriteLine("Test Failed"); } }
//Function to register new user public void Register() { ExcelLibHelpers.PopulateInCollection(ServiceData.ExcelPath, "SignUp"); //Click Join to sign up for the skill exchange Portal Join.Click(); //Enter the data for First name FirstName.SendKeys(ExcelLibHelpers.ReadData(2, "FirstName")); //Enter the data for Last name LastName.SendKeys(ExcelLibHelpers.ReadData(2, "LastName")); //Enter the data for EmailID Email.SendKeys(ExcelLibHelpers.ReadData(2, "EmailID")); //Enter the data for Password Password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); //Enter the data for Confirm Password CnfrmPswrd.SendKeys(ExcelLibHelpers.ReadData(2, "ConfirmPassword")); //Check on the terms and conditions check box prior to clicking the Join button TermsCndtnsChkbox.Click(); //Click on the Join button to complete the registration JoinButton.Click(); //Implicit wait for the registeration pop up to be available Wait.wait(2, driver); try { if (FirstTime) { if (PopUp.Text == "Registration Successfull") { TestContext.WriteLine(PopUp.Text); } } else { String EmailValidationMsg = EmailValidation.Text; if (EmailValidationMsg == "This email has already been used to register an account.") { TestContext.WriteLine("The account has already been created with this emailID, Please log in using exisitng account details"); } } } catch (Exception e) { Assert.Fail("Registration failed due to 1 or more errors. Make sure that there isn't an existing account", e.Message); } }
public void ThenIShouldBeAbleToDeleteTimeAndMaterial() { // Time & Material Page - Click on Delete and Confirm Delete Time and Material value. TimeandMaterialPage instanceNameTandM = new TimeandMaterialPage(GlobalDriver.driver); ExcelLibHelpers.PopulateInCollection(@"E:\TestData\TestDataForHorseDev.xlsx", "DeleteTimeAndMaterials"); instanceNameTandM.deleteTimenMaterial(); //Closing driver instance GlobalDriver.driver.Close(); }