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 SelectApplicationByName(string applicationName) { _pageSpinner.WaitForSpinner(); WaitHelpers.ExplicitWait(); Thread.Sleep(5000); _selectedApplication.SelectFromDropdown(_applicationsDropdown, applicationName); }
public void DeleteToggleOnEdit() { WaitHelpers.ExplicitWait(); _deleteFeatureToggleButtonOnEdit.ActionClick(); WaitHelpers.ExplicitWait(); Browser.WebDriver.FindElements(_deleteFeatureToggleButton)[1].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 Login() { _usernameInput.ActionSendKeys(Constants.Username); _passwordInput.ActionSendKeys(Constants.Password); _loginButton.ActionClick(); WaitHelpers.ExplicitWait(); }
public void ValidationFailedRegistration() { //Wait for error message to appear WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "XPath", "/html/body/div[2]/div/div/form/div[3]/div", 10); Assert.IsTrue(ErrorMessage.Text.Contains("This email has already been used to register an account.")); //Close opened form for password change CloseForm(); }
public void ChangePassowedClick() { 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(); }
public void SuccessMessage() { //Wait for success message to appear WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "CssSelector", "div.ns-box.ns-growl.ns-effect-jelly.ns-type-success.ns-show", 10); //Comparing success message text for skill add Assert.IsTrue(Message.Text.Contains("has been added")); //Close success message MessageClose.Click(); }
public void ErrorMessage() { //Wait for error message to appear WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "CssSelector", "div.ns-box.ns-growl.ns-effect-jelly.ns-type-error.ns-show", 10); //Comparing error message appeared Assert.IsTrue(Errormsg.Text.Contains("First character can only be digit or letters") || Errormsg.Text.Contains("Please, a description is required")); //Close error message MessageClose.Click(); }
public void RefineSearchResultsByCategory() { //Select Category for search FilterByCategory.Click(); //Wait for the listing page updated with the refined search WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[2]/div/div[2]/div/div/div[1]/a/img", 10); //Open 1st listing appeared on the page as search result OpenedListing = driver.FindElement(By.XPath("//*[@id='service-search-section']/div[2]/div/section/div/div[2]/div/div[2]/div/div/div[1]/a/img")); }
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 AddNewEnvironment(string newEnvironmentName) { WaitHelpers.ExplicitWait(); Thread.Sleep(2000); _toolsButton.SelectFromDropdown(_toolsMenuDropdown, "Add New Environment"); _environmentNameInput.ActionSendKeys(newEnvironmentName); _addEnvironmentButton.ActionClick(); WaitHelpers.ExplicitWait(); _closeAddEnvironmentModalBtn.ActionClick(); }
public void AddOrRemoveProductFromCart(string name) { var productNameList = _productNameList.GetElements(); var addToCartButtons = _addToCartButtons.GetElements(); var productIndex = productNameList.IndexOf(productNameList.First(x => string.Equals(x.Text, name))); addToCartButtons[productIndex].Click(); WaitHelpers.ExplicitWait(); ExtentTestManager.GetTest().CreateStep(MethodBase.GetCurrentMethod().Name); }
public void EditEnvironment(string environmentName) { WaitHelpers.ExplicitWait(); var element = Utils.GetHeaderSpecifiedByIndex(FeatureTogglesGrid, 3); WaitHelpers.ExplicitWait(); if (element.Text.Equals(environmentName)) { element.FindElement(_editEnvironmentIcon).Click(); } }
public void DesValidate() { //Refreshing the web page driver.Navigate().Refresh(); //Waiting for Profile page to load after signing in WaitHelpers.ExplicitWait(driver, "ElementToBeClickable", "XPath", "//h3[.='Description']/span/i", 10); //Saving already available Description text into a String after edit AfterEdit = DesText.Text; //Comparing befor and after edit Description data for validation Assert.IsTrue(BeforeEdit.Equals(AfterEdit)); }
public void OpenShareSkillPage() { //Waiting for Profile page to load WaitHelpers.ExplicitWait(driver, "ElementExists", "LinkText", "Share Skill", 10); //Click on Share Skill button ShareSkillButton.Click(); //Waiting for Share Skill page to load WaitHelpers.ExplicitWait(driver, "ElementToBeClickable", "Name", "title", 10); }
public void DeleteApplication(string expectedApplicationName) { WaitHelpers.ExplicitWait(); if (expectedApplicationName != GetSelectedApplicationName()) { return; } _editApplicationIcon.ActionClick(); _deleteApplicationButton.ActionClick(); _confirmDeleteApplicationButton.ActionClick(); WaitHelpers.ExplicitWait(); }
public void AddFeatureToggle(string newFeatureToggleName) { WaitHelpers.ExplicitWait(); Thread.Sleep(2000); _toolsButton.SelectFromDropdown(_toolsMenuDropdown, "Add Feature Toggle"); _featureToggleNameInput.ActionSendKeys(newFeatureToggleName); //_workItemIdInput.ActionSendKeys("TESTING PBI 00000"); _notesInput.ActionSendKeys("test notes"); _addFeatureToggleButton.ActionClick(); WaitHelpers.ExplicitWait(); _closeAddToggleModalBtn.ActionClick(); }
public void LogInSteps() { //Populate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Login"); //Enter Email and Password for login Email.SendKeys(ExcelLibHelpers.ReadData(3, "Column0")); Password.SendKeys(ExcelLibHelpers.ReadData(3, "Column1")); //Click on login button LoginButton.Click(); //Wait for the Profile page to load after login WaitHelpers.ExplicitWait(driver, "ElementExists", "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/span", 10); }
public void AddNewApplication(string newApplicationName, string firstEnvName) { _pageSpinner.WaitForSpinner(); WaitHelpers.ExplicitWait(); Thread.Sleep(2000); _openAddApplicationModalBtn.ActionClick(); _applicationNameInput.ActionSendKeys(newApplicationName); _firstEnvNameInput.ActionSendKeys(firstEnvName); _addApplicationButton.ActionClick(); WaitHelpers.ExplicitWait(); _closeAddApplicationModalBtn.ActionClick(); }
public void ChangeApplicationName(string currentApplicationName, string editedApplicationName) { WaitHelpers.ExplicitWait(); if (currentApplicationName != GetSelectedApplicationName()) { return; } _editApplicationIcon.ActionClick(); _editApplicationNameInput.ClearField(); _editApplicationNameInput.ActionSendKeys(editedApplicationName); _saveApplicationChangesButton.ActionClick(); WaitHelpers.ExplicitWait(); }
public bool IsFeatureToggleDisplayed(string newFeatureToggleName) { WaitHelpers.ExplicitWait(); var rows = FeatureTogglesGrid.GetAllRowsFromGrid(_rowSelector); foreach (var row in rows) { var cells = row.FindElements(By.TagName("td")); if (cells[0].Text.Equals(newFeatureToggleName) || cells[1].Text.Equals(newFeatureToggleName)) { return(true); } } return(false); }
public void EditFeatureToggle(string newFeatureToggleName) { WaitHelpers.ExplicitWait(); Thread.Sleep(2000); var rows = FeatureTogglesGrid.GetAllRowsFromGrid(_rowSelector); for (var i = 0; i <= rows.Count - 1; i++) { var cells = rows[i].FindElements(By.TagName("td")); if (cells[1].Text.Contains(newFeatureToggleName)) { FeatureTogglesGrid.GetColumnSpecifiedByIndex(_rowSelector, i, 0).FindElement(_editFeatureToggleIcon) .Click(); } WaitHelpers.ExplicitWait(); } }
public void InvalidDescription() { //Populate data from excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); //Waiting for Profile page to load after signing in WaitHelpers.ExplicitWait(driver, "ElementToBeClickable", "XPath", "//h3[.='Description']/span/i", 10); //Saving already available Description text into a String before edit BeforeEdit = DesText.Text; //Click on Description edit button EditButton.Click(); //Remove already available data from text area Description.SendKeys(Keys.Control + "a"); Description.SendKeys(Keys.Delete); //Enter Description Description.SendKeys(ExcelLibHelpers.ReadData(4, "Column16")); //Save Description SaveButton.Click(); }
public void DeleteFeatureToggle(string newFeatureToggleName) { WaitHelpers.ExplicitWait(); var rows = FeatureTogglesGrid.GetAllRowsFromGrid(_rowSelector); for (var i = 0; i <= rows.Count - 1; i++) { var cells = rows[i].FindElements(By.TagName("td")); if (!cells[1].Text.Contains(newFeatureToggleName)) { continue; } WaitHelpers.ExplicitWait(); FeatureTogglesGrid.GetColumnSpecifiedByIndex(_rowSelector, i, 0).FindElement(_deleteFeatureToggleIcon) .Click(); WaitHelpers.ExplicitWait(); _deleteFeatureToggleButton.WaitForElementToBeClickable(); _deleteFeatureToggleButton.ActionClick(); } }
public void ChangePassword() { //Populate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "ChangePassword"); CurrentPass = (ExcelLibHelpers.ReadData(4, "Column0")); NewPass = (ExcelLibHelpers.ReadData(4, "Column1")); 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(4, "Column0")); NewPassword.SendKeys(ExcelLibHelpers.ReadData(4, "Column1")); ConfirmPassword.SendKeys(ExcelLibHelpers.ReadData(4, "Column2")); SaveButton.Click(); }
public void UpdateDescription() { //Populate data from excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "Profile"); //Waiting for Profile page to load after signing in WaitHelpers.ExplicitWait(driver, "ElementToBeClickable", "XPath", "//h3[.='Description']/span/i", 10); EditButton.Click(); //Remove already available data from text area and enter new one Description.SendKeys(Keys.Control + "a"); Description.SendKeys(Keys.Delete); Description.SendKeys(ExcelLibHelpers.ReadData(3, "Column16")); //Save the newly entered description SaveButton.Click(); //Validate Description entry try { Assert.IsTrue(Description.Text.Contains(ExcelLibHelpers.ReadData(3, "Column16"))); } catch (Exception ex) { Assert.Fail("Test failed to verify Entering Description", ex.Message); } }
public void ValidationRefineSearch(string type, string value) { //Open the 1st listing appeared after refined search OpenedListing.Click(); //Wait for the listing to be loaded WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "XPath", "//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[2]/div/div[1]/div/div[2]", 10); //Validating refined search by comparing the Category, SubCategory and Location type element text switch (type) { case "ListingCategory": elementType = driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[2]/div/div[1]/div/div[2]")); break; case "ListingSubCategory": elementType = driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[2]/div/div[2]")); break; case "ListingLocationType": elementType = driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[3]/div/div[3]")); break; } Assert.IsTrue(elementType.Text.Contains(value)); }
public void ExplicitWait(int timeout = 500) { WaitHelpers.ExplicitWait(timeout); }
public void EnterShareSkill() { //PopulatePopulate data from Excel ExcelLibHelpers.PopulateInCollection(Paths.ExcelPath, "ShareSkill"); //Enter Title Title.SendKeys(ExcelLibHelpers.ReadData(3, "Column0") + TimeStamp); //Enter Description Description.SendKeys(ExcelLibHelpers.ReadData(3, "Column1")); //Select Category from DropDown CategoryDropDown.SendKeys(ExcelLibHelpers.ReadData(3, "Column2")); //Select SubCategory from DropDown SubCategoryDropDown.SendKeys(ExcelLibHelpers.ReadData(3, "Column3")); //Enter Tags Tags.SendKeys(ExcelLibHelpers.ReadData(3, "Column4") + Keys.Enter); //Select ServiceType from Option switch ((ExcelLibHelpers.ReadData(3, "Column5"))) { case "Hourly basis service": //Select Hourly basis service from options ServiceTypeOptions[0].Click(); break; case "One-off service": //Select One-off service from options ServiceTypeOptions[1].Click(); break; } //Select LocationType from Option switch ((ExcelLibHelpers.ReadData(3, "Column6"))) { case "On-site": //Select On-site from location options LocationTypeOption[0].Click(); break; case "Online": //Select Online from location options LocationTypeOption[1].Click(); break; } //Enter StartDate from DropDown StartDateDropDown.SendKeys(ExcelLibHelpers.ReadData(3, "Column7")); //Enter EndDate from DropDown EndDateDropDown.SendKeys(ExcelLibHelpers.ReadData(3, "Column8")); //Select Days and enter Start and End time if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Sun") { //Select Sunday Days[0].Click(); //Enter StartTime from DropDown StartTimeDropDown[1].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[0].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Mon") { //Select Monday Days[1].Click(); //Enter StartTime from DropDown StartTimeDropDown[2].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[1].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Tue") { //Select Tuesday Days[2].Click(); //Enter StartTime from DropDown StartTimeDropDown[3].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[2].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Wed") { //Select Wednesday Days[3].Click(); //Enter StartTime from DropDown StartTimeDropDown[4].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[3].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Thu") { //Select Thursday Days[4].Click(); //Enter StartTime from DropDown StartTimeDropDown[5].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[4].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Fri") { //Select Friday Days[5].Click(); //Enter StartTime from DropDown StartTimeDropDown[6].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[5].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } else if ((ExcelLibHelpers.ReadData(3, "Column9")) == "Sat") { //Select Saturday Days[6].Click(); //Enter StartTime from DropDown StartTimeDropDown[7].SendKeys(ExcelLibHelpers.ReadData(3, "Column10")); //Enter EndTime from DropDown EndTimeDropDown[6].SendKeys(ExcelLibHelpers.ReadData(3, "Column11")); } //Select Skill Trade from options if ((ExcelLibHelpers.ReadData(3, "Column12")) == "Skill-Exchange") { //Select Skill-exchange from available options SkillTradeOption[0].Click(); //Enter SkillExchange SkillExchange.SendKeys(ExcelLibHelpers.ReadData(3, "Column13") + Keys.Enter); } else if ((ExcelLibHelpers.ReadData(3, "Column12")) == "Credit") { //Select Credit from available options SkillTradeOption[1].Click(); //Enter Credit Amount CreditAmount.SendKeys(ExcelLibHelpers.ReadData(3, "Column14")); } //Select ActiveOption switch ((ExcelLibHelpers.ReadData(3, "Column15"))) { case "Active": //Select Active status ActiveOption[0].Click(); break; case "Hidden": //Select Hidden status ActiveOption[1].Click(); break; } //Click on work sample file add icon //FileAdd.Click(); //FileUpload.SendKeys(Paths.FileUploadPath); //Click on Save button Save.Click(); //Waiting for Manage Listing page to load WaitHelpers.ExplicitWait(driver, "ElementIsVisible", "XPath", "//table[1]/tbody[1]", 10); }