public void LinkTemporaryDeferral() { OnsiteHelper.generatedeferralid(); DateTime txtcurrentchapterdate = Convert.ToDateTime(Actions.GetText(lblchapterdate).Substring(0, 10)).AddDays(30); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); CommonActions.SetText(txtdeferralid, "c" + gblunitdeferralid + "c"); CommonActions.SetText(txtdeferthrudate, Convert.ToString(txtcurrentchapterdate.ToString("MM/dd/yyyy"))); CommonActions.SetText(selectreason, "LINK"); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(btnlink); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ElementContainsText(txtmessage, "This deferral will be linked to the donation. Do you want to proceed?"); Report.LogPassedTest("Deferral ID is going to be linked"); Report.TakeScreenshot(); Actions.Click(btnyes); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); OnsiteHelper.Loginpopup(); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ElementContainsText(txtmessage, "Msg: 21030: Donor Registered as Deferral"); Report.LogPassedTest("Deferral ID linked"); Report.TakeScreenshot(); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(btnok); }
/// <summary> /// Selects system to equipment type /// </summary> public void SelectSystemEquipmentType() { Waits.Wait(driver, 3000); SelectElement element = new SelectElement(dropdownlistEquipmentType); element.SelectByText("All"); }
public string ClickOnIdentifier(int identifier) { // ReadOnlyCollection<IWebElement> lstIdentifier = Actions.FindElements(_elementListIdentifier); // for (int i = 0; i < lstIdentifier.Count; i++) // { // IWebElement str = lstIdentifier[i]; // Console.WriteLine(str); // if (i == identifier) // { // Thread.Sleep(2000); // String strelem = lstIdentifier[i].Text; // lstIdentifier[i].Click(); // Thread.Sleep(5000); Actions.Click(_elementIdentifierLink); Thread.Sleep(500); Waits.WaitForElementToBeVisible(_elementListIdentifier, WaitType.Large); Actions.Click(_elementListIdentifier); //Thread.Sleep(1000); if (Actions.IsDisplayed(_elementDrCeDonorIDText)) { donorIDText = Actions.GetText(_elementDrCeDonorIDText); } // Console.WriteLine("TEXT name is on first identifir here" + strelem); return(donorIDText); }
public CalculationPage ClickBeginCalculationsButton() { LogHelpers.Write(string.Format("Click \"Begin calculation\" button.")); BeginCalculationButton.ClickJS(); Waits.WaitForProcessToFinish(drv => CalculationProgress); return(this); }
/// <summary> /// Open and Search in Google /// </summary> /// <param name="text"></param> public void GoogleSearch(String text) { Actions.NavigateToUrl(WebEnvironment.AppSettings["GoogleUrl"]); Actions.SendKeys(_fld_Search, text); Actions.PressKey(Keys.Enter); Waits.WaitForPageLoad(); if (Actions.IsAlertPresent()) { Actions.AcceptAlert(); } Actions.Click(_lnkFifthValue); Waits.WaitForPageLoad(); Actions.NavigateToUrl(WebEnvironment.AppSettings["GoogleUrl"]); Actions.SendKeys(_fld_Search, text); Actions.PressKey(Keys.Enter); Waits.WaitForPageLoad(); if (Actions.IsAlertPresent()) { Actions.AcceptAlert(); } for (int it = 0; it <= 19; it++) { Actions.ScrollToBottom(); Actions.Click(_lnkNext); Waits.WaitForPageLoad(); } Actions.ScrollToBottom(); Actions.Click(_lnk25thResult); Waits.WaitForPageLoad(); }
public void IsDefaultValuesWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); createButton.Click(); _driver.Navigate().Refresh(); _addNewRowButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[text()='Add New']")); if (_addNewRowButton == null) { Assert.Fail("Could not load the 'Add New' button in under 5 seconds, after the default values had been used!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using default values!"); } }
public UserMgmtPage ClickOnUserMgmt() { Waits.WaitForElementToBeClickable(_elementUserMgmt, WaitType.Small); Actions.Click(_elementUserMgmt); Console.WriteLine("Clicked on User Management link"); return(CreateInstance <UserMgmtPage>()); }
/// <summary> /// /// </summary> /// <param name="timeout"></param> public static void WaitUntilProgressBlockDisappears(this Waits waits, int timeout) { //try //{ // var wait = new WebDriverWait(BddHooks.Environment.Driver, new TimeSpan(0, 0, 0,timeout)); // wait.IgnoreExceptionTypes(new Type[] { new StaleElementReferenceException().GetType() }); // wait.Until<Boolean>(driver => // { // if (!driver.FindElement(By.CssSelector("#ctrlTopMenu1__updateProgress")).GetAttribute("style").Contains("display: block")) // { // Console.WriteLine("Loading message disappeared"); // return true; // } // else // { // System.Threading.Thread.Sleep(1000); // return false; // } // }); //} //catch (Exception) { Console.WriteLine("Waiting for 5 seconds for loading message to disappear"); } //System.Threading.Thread.Sleep(5000); }
public void OnsiteStatusQueryRegister() { Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(lnkOnsiteStatusQuery); //Waits.WaitForPageLoad(); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ExactPageTitle(ONSITESTATUSQUERY); Actions.Click(statustitle); Actions.Click(statustitle); for (int ipage = 1; ipage < 5; ipage++) { if (Actions.IsElementContainsText(GetDonorStatusLocator(OnsiteHelper.txtDonorIDonly), "Pending")) { Actions.Click(GetDonorStatusLocator(OnsiteHelper.txtDonorIDonly)); Verify.ElementContainsText(GetDonorStatusLocator(OnsiteHelper.txtDonorIDonly), "Pending"); Verify.ElementContainsText(By.XPath(onsitequeryoverride), ":"); } else { Actions.Click(btnnextpage); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(GetDonorStatusLocator(OnsiteHelper.txtDonorIDonly)); Verify.ElementContainsText(GetDonorStatusLocator(OnsiteHelper.txtDonorIDonly), "Pending"); Verify.ElementContainsText(By.XPath(onsitequeryoverride), ":"); } } Report.LogPassedTest("Donor " + txtDonorID + " has a status of Pending"); Report.TakeScreenshot(); Actions.Click(lnkonsitemodulemenu); }
public void AddFirstFoodInList() { Waits.WaitUntilModalBackgroundIsNotVisible(); //Patikriname, ar krepselyje nera prekiu kikaHomePage.Header.AssertCartIconNumber("0"); //Parenkame pirma rodoma item kikaHomePage.ClickFirstItem(); var itemFromListName = item.GetItemName(); var itemFromListPrice = item.GetItemPrice(); //Parenkame item kieki item.SelectItemQuantity(); item.AddToCart(); //Patikriname, ar item idetas i krepseli Thread.Sleep(4000); kikaHomePage.Header.AssertCartIconNumber("1"); kikaHomePage.Header.ClickOnCartIcon(); cart.AssertItemNameAndItemInCartName(itemFromListName); cart.AssertItemPriceAndItemInCartPrice(itemFromListPrice); cart.RemoveItemFromCart(); Thread.Sleep(2000); kikaHomePage.Header.ClickOnProfileMenuIcon(); kikaHomePage.Header.LogOut(); Thread.Sleep(3000); }
//this method is used to fill in the pop window and select a file path public void FillInFileUploadPopUp() { // Assert.True(Actions.IsDisplayed(_elementDescriptionFieldInPopUp), "Pop up window is not appeared"); //Thread.Sleep(1000); //WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(2)); Waits.WaitForElementToBeClickable(_elementCategoryDDLDocument, WaitType.Medium); //wait.Until(ExpectedConditions.ElementToBeClickable(_elementCategoryDDLDocument)); //Waits.WaitForPageLoad(); //Waits.WaitForPageLoad(); //Waits.WaitForElementToBePresent(_elementCategoryDDLDocument, WaitType.Medium); Actions.SendKeys(_elementCategoryDDLDocument, "Testing!"); Console.WriteLine("Testing! was entered in description"); Actions.SelectByRandoxIndex(_elementCategoryDDLDocument); object directoryName = ""; Console.WriteLine("Current Path is " + AppContext.BaseDirectory); string filePath = AppContext.BaseDirectory; filePath = filePath.Replace(@"\Flux.TranstemLab\bin\Debug\", "\\Attachment\\Test Attachment.xlsx"); //Waits.WaitForElementToBePresent(_elementChooseAFile, WaitType.Large); //Waits.WaitForPageLoad(); Waits.WaitForElementToBeClickable(_elementChooseAFile, WaitType.Large); // wait.Until(ExpectedConditions.ElementToBeClickable(_elementChooseAFile)); Actions.SendKeys(_elementChooseAFile, filePath); directoryName = new DirectoryInfo(filePath).Name; Console.WriteLine("File has been uploaded successfully"); }
public AddUserPage ClickOnAddUser() { Waits.WaitForElementToBeClickable(_elementAddUser, WaitType.Small); Actions.Click(_elementAddUser); Console.WriteLine("Clicked on Add User link"); return(CreateInstance <AddUserPage>()); }
private IEnumerator RepeatDamage(SkillDeployer deployer, CharacterStatus characterStatus) { float attackedTime = 0; var skillData = deployer.SkillData; do { int targetsLen; int damage; if ((damage = (int)(characterStatus.baseDamage * skillData.damageRatio)) > 0) { if (skillData.attackTargets != null && (targetsLen = skillData.attackTargets.Length) > 0) { for (int i = targetsLen - 1; i >= 0; i--) { var targetStatus = skillData.attackTargets[i].GetComponent <CharacterStatus>(); targetStatus.OnDamage(damage); var targetFxTF = targetStatus.hitFxTF; var hitFx = GameObjectPool.Instance.CreateObject( skillData.hitFxName, skillData.hitFxPrefab, targetFxTF.position, targetFxTF.rotation, targetFxTF ); GameObjectPool.Instance.CollectObject(hitFx, 0.2f); } } } yield return(Waits.GetWaitForSeconds(skillData.damageInterval)); attackedTime += skillData.damageInterval; skillData.attackTargets = deployer.CalculateTargets(); }while(attackedTime < skillData.durationTime); }
public TranstemLabHomePage ClickLogOutName() { Waits.WaitForElementToBeClickable(_elementLogOutName, WaitType.ImplicitWaitTime); Actions.Click(_elementLogOutName); Console.WriteLine("Log Out Successful"); return(CreateInstance <TranstemLabHomePage>()); }
public bool IsErrorPresentForEmptyField(string nameOfEmptyField) { Waits.ElementIsVisible(ErrorMessageBy); return(Driver.FindElement(By.XPath(string.Format(UserContactField, nameOfEmptyField))). GetAttribute("class").Equals("text-input--error__input") && ErrorMessage.Text.Equals($"{nameOfEmptyField} can't be blank")); }
public UserMgmtPage ClickOnAddUser() { Actions.Click(_elementAddUser); Console.WriteLine("Clicked on Add User"); Waits.WaitForPageLoad(); return(CreateInstance <UserMgmtPage>()); }
public void NullLoginVerify() { CommonActions.WaitForPageLoad(); Report.LogInfo("Null login message is displayed"); Report.TakeScreenshot(); Waits.WaitForElementToBeVisible(txterror, Core.WaitType.Small); }
/// <summary> /// /// </summary> /// <returns> NA </returns> public void Temp(string UserName, string Password) { int attempt = 0; bool loginSuccess = false; ReAttempt: try { Waits.WaitForElementToBeClickable(txtUserName, WaitType.Medium); Actions.SendKeys(txtUserName, UserName); Actions.SendKeys(txtPassword, Password); if (Actions.ClickLogin(btnSignin)) { Waits.WaitForPageLoad(); loginSuccess = true; } } catch (Exception ex) { if (IsAlreadyLoggedIn()) { loginSuccess = true; } } if (attempt <= 3 && !loginSuccess) { attempt++; LaunchApplication(); //multiple attempts goto ReAttempt; } }
public LoginPage() { _wait = new Waits(); _fileLocations = new FileLocations(); _elementActions = new ElementActions(); PageFactory.InitElements(BeforeHooks.driver, this); }
public void HHPFDonorInformation() { Waits.WaitForPageLoad(); Verify.ElementIsDisabled(btnselectdonor); Report.LogInfo("1.01.2 Select Donor button is disabled."); Report.TakeScreenshot(); if (Actions.IsElementPresent(GetDonorRadioBtnLocator(OnsiteHelper.txtDonorIDonly)) == false) { Actions.Click(btnnextpage); } Verify.ElementContainsText(GetDonorNameLocator(OnsiteHelper.txtDonorIDonly), gblLastName + ", " + gblFirstName); Verify.ElementContainsText(GetDonorIdLocator(OnsiteHelper.txtDonorIDonly), txtDonorID); if (gblSSN is null) { Verify.TextboxIsEmpty(GetDonorSsnLocator(OnsiteHelper.txtDonorIDonly)); } else { gblSSN = gblSSN.Substring(0, 3) + "-" + gblSSN.Substring(3, 2) + "-" + gblSSN.Substring(5, 4); } Verify.ElementContainsText(GetDonorSsnLocator(OnsiteHelper.txtDonorIDonly), gblSSN); gblDateOfBirth = gblDateOfBirth.Substring(0, 2) + "/" + gblDateOfBirth.Substring(3, 2) + "/" + gblDateOfBirth.Substring(6, 4); Verify.ElementContainsText(GetDonorDobLocator(OnsiteHelper.txtDonorIDonly), gblDateOfBirth); Report.LogInfo("1.01.1 Regisered donor information is displayed in the list."); Report.TakeScreenshot(); Actions.Click(GetDonorRadioBtnLocator(OnsiteHelper.txtDonorIDonly)); Verify.ElementIsEnabled(btnselectdonor); Report.LogInfo("1.01.5 Select Donor button is enabled after donor is selected."); Report.TakeScreenshot(); }
public void OpenArticleByTitle(string title) { IWebElement article = Driver.FindElement(By.XPath(string.Format(ArticleByTitle, title))); Waits.ElementToBeClickable(article); article.Click(); }
public void ConfirmComment() { String pagetotal; string strpagedate; int intpagenumber; int totalpage; pagetotal = Actions.GetText(pagenumber); intpagenumber = pagetotal.IndexOf("of"); totalpage = pagetotal.LastIndexOf(pagetotal); totalpage = pagetotal.Count(); pagetotal = pagetotal.Substring((intpagenumber + 3), (totalpage - (intpagenumber + 3))); Waits.WaitForPageLoad(); strpagedate = Actions.GetText(GetCommentEnteredDate(pagetotal)); Verify.ElementContainsText(GetCommentNote(pagetotal), "This is a test comment 3"); if (strCommentDate == strpagedate) { Verify.ElementContainsText(GetCommentEnteredDate(pagetotal), strCommentDate); Report.LogPassedTest("Comment is saved for Donor: " + OnsiteHelper.txtDonorID); Report.TakeScreenshot(); } else { Verify.ElementContainsText(GetCommentEnteredDate(pagetotal), (strCommentDate.Substring(1, 13))); Report.LogPassedTest("Comment is saved for Donor: " + OnsiteHelper.txtDonorID); Report.TakeScreenshot(); } }
public void WaitForBackendCalcEnd() { /*The elapsed time is updated with a Backend process, this occurs after * a Process completed" label appeared. Four elements with a green check * icon are also searched for since it's one of the visual changes that * ocurr in the page prior to the time being updated.*/ LogHelpers.Write(string.Format("Wait for \"Calculation\" process to finish.")); int backEndSuggestedTime = 60; Waits.WaitForProcessToFinish(drv => RegularTaxCalcDoneCheck); Waits.WaitForProcessToFinish(drv => AmtCalcDoneCheck); Waits.WaitForProcessToFinish(drv => EandPCalcDoneCheck); Waits.WaitForProcessToFinish(drv => StateCalcDoneCheck); try { Waits.WaitForElementIfChanges(drv => CalculationTimeElement, backEndSuggestedTime); } catch (WebDriverTimeoutException) { /*It's not sure if the data will always change after "Process completed" * label appeared, how many seconds after that it will occur or even if it * can be updated before because of a fast Calculation and a slow recognition * of the check elements. An until method is used for it to exit the wait, * but since that causes an exception I setted an empty catch.*/ } }
public void HHPFDisplayed() { Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ExactPageTitle(ONSITEHHPF); Report.LogPassedTest("Health History Parent screen is displayed"); Report.TakeScreenshot(); }
public void FillForm(Dictionary <string, string> values) { IWebElement buttonSubmit = DriverInstance.Current.FindElement(By.XPath("//button[@class='button']")); Waits.WaitForLoad(); foreach (var pair in values) { IWebElement element = DriverInstance.Current.FindElement(By.XPath("//*[contains(@aria-label, '" + pair.Key + "')or (following-sibling::span//p[contains(text(), '" + pair.Key + "')])]")); if (element.TagName == "textarea") { element.SendKeys(pair.Value); } else if (element.TagName == "input") { if (element.GetAttribute("type") == "text") { element.SendKeys(pair.Value); } else if (element.GetAttribute("type") == "checkbox") { if (pair.Value == "Yes" && !element.Selected) { element.Click(); } else if (pair.Value == "No" && element.Selected) { element.Click(); } } } } buttonSubmit.Click(); }
public void OpenHealthHistorySupervisormode() { Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(lnkhealthhistory); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); CommonActions.SetText(txtsuperusername, WebEnvironment.AppSettings["AppUserName"]); CommonActions.SetText(txtpassword, WebEnvironment.AppSettings["AppPassword"]); Report.LogPassedTest("Login as super user"); Report.TakeScreenshot(); Actions.Click(btnsubmit); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ElementIsPresent(txtusername); OnsiteHelper.Loginpopup(); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ExactTextInElementIs(alertmsg, "For your information: Entry to this window require Signoff after completion"); Report.TakeScreenshot(); Actions.Click(btnverifyok); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ExactTextInElementIs(alertmsg, "There are no Exceptions to review."); Report.TakeScreenshot(); Actions.Click(btnallquestions); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ExactPageTitle(HEALTHHISTORY); Report.LogPassedTest("Health History Screen is displayed"); Report.TakeScreenshot(); }
/// <summary> /// Enter folder name /// </summary> /// <param name="FolderName"></param> public void EnterFolderName(string FolderName) { Waits.Wait(driver, 3000); JavaScriptExecutor.JavaScriptScrollToElement(driver, txtFolderName); Waits.WaitTillElementIsClickable(driver, txtFolderName); txtFolderName.SendKeys(FolderName); }
//Methods #region /// <summary> /// Create new user /// </summary> /// <param name="userName"></param> /// <param name="Password"></param> /// <param name="ConformPassword"></param> /// <param name="question"></param> /// <param name="ans"></param> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="Email"></param> public void CreateNewUser(string userName, string Password, string ConformPassword, string question, string ans, string firstName, string lastName, string Email) { if (IsUserExist(firstName, lastName, userName)) { DeleteIfExist(userName, firstName, lastName); Waits.Wait(driver, 2000); } Waits.Wait(driver, 2000); EnterUserName(userName); Waits.Wait(driver, 2000); EnterPassword(Password); Waits.Wait(driver, 2000); EnterConformPassword(ConformPassword); Waits.Wait(driver, 2000); txtMemorableQuestion.SendKeys(question); Waits.Wait(driver, 1000); txtMemorableAnswer.SendKeys(ans); Waits.Wait(driver, 1000); EnterFirstName(firstName); Waits.Wait(driver, 2000); EnterLastName(lastName); Waits.Wait(driver, 2000); EnterEmail(Email); Waits.Wait(driver, 1000); btnCreateUser.Click(); Waits.Wait(driver, 1000); }
public void GridsListTest() { _avatarButton.Click(); var designButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div/a[contains(text(),'Design')]/..")); if (designButton == null) { Assert.Fail("Could not load the 'Design' button in under 5 seconds!"); } designButton.Click(); var gridsButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//div/a[contains(text(),'Grids')]/..")); if (gridsButton == null) { Assert.Fail("Could not load the 'Grids' button in under 5 seconds!"); } gridsButton.Click(); var newGridButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'New Grid')]")); if (newGridButton == null) { Assert.Fail("Could not load the 'New Grid' button in under 5 seconds!"); } Console.WriteLine("List of Grids loaded successfully!"); Assert.Pass("List of Grids loaded successfully!"); }
public void UnlinkUnit() { Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(scanunitid); if (gblunitdeferralid.Length == 13) { CommonActions.SetText(scanunitid, "=" + gblunitdeferralid + "00"); } else { CommonActions.SetText(scanunitid, "c" + gblunitdeferralid + "c"); } Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Actions.Click(btnunlink); Verify.ElementContainsText(txtmessage, "Do you want to continue?"); Report.LogPassedTest("Unlinking Unit ID"); Report.TakeScreenshot(); Actions.Click(btnyes); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); OnsiteHelper.Loginpopup(); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); Verify.ElementContainsText(txtmessage, "Msg: 21023: Unit Unlinked Successfully"); Report.LogPassedTest("Unit ID is unlinked"); Report.TakeScreenshot(); Actions.Click(btnok); Waits.WaitForElementToBeInvisible(By.Id("loading-dialog"), Core.WaitType.Small); }