public void ClickSelectAllItemsButton() { const string entityXPath = "//section[@class='collection__select-options' and @aria-label='select options']"; WaitUtils.elementState(_driverWait, By.XPath(entityXPath), ElementState.VISIBLE); SelectAllItemsButton.Click(); }
public void IInsertValidBaseChoiceIntoElement(BaseChoiceType baseChoiceType, SelectorPathType selector, string path) { By elementBy = WebElementUtils.GetElementAsBy(selector, path); WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS); switch (baseChoiceType) { case BaseChoiceType.INT: TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandInt().ToString()); break; case BaseChoiceType.DOUBLE: TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandDouble().ToString()); break; case BaseChoiceType.BOOL: TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandBool().ToString()); break; case BaseChoiceType.EMAIL: TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandEmail()); break; } }
public DateTimePickerComponent(ContextConfiguration contextConfiguration, string className) { WaitUtils.elementState(contextConfiguration.WebDriverWait, By.CssSelector($".{className}"), ElementState.EXISTS); DateTimePickerElement = contextConfiguration.WebDriver.FindElement(By.CssSelector($".{className}")); datePickerComponent = new DatePickerComponent(contextConfiguration, className); timePickerComponent = new TimePickerComponent(contextConfiguration, className); }
public string GetToasterAlertMessage() { // Wait for the toaster body to display bool isDisplayedToasterBody = WaitUtils.elementState(_wait, By.XPath("//div[@role='alert' and @class='Toastify__toast-body']"), ElementState.VISIBLE); if (isDisplayedToasterBody) { return(ToasterBody.Text); } return(string.Empty); }
public void IInsertValidStringBaseChoiceIntoElement(string baseChoiceType, int min, int max, SelectorPathType selector, string path) { var elementBy = WebElementUtils.GetElementAsBy(selector, path); WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS); switch (baseChoiceType) { case "wordystring": TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandString(min, max)); break; case "string": TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandString(min, max)); break; } }
public void EachRowHasBeenWithinTheLastDays(string filterInputType, int days) { // wait for the collection to exist on the page WaitUtils.elementState(_driverWait, By.XPath("//tr[contains(@class,'collection__item')]"), ElementState.EXISTS); // Replace with clientside and serverside test Thread.Sleep(500); // get the rows and attributes into the correct format var rows = _genericEntityPage.CollectionTable.FindElements(By.CssSelector("tbody > tr")); var dateAttributeRows = rows.Select(x => DateTime.Parse(x.GetAttribute($"data-{filterInputType}"))); // set how far back we will be looking var historicDate = DateTime.Now.Date.AddDays(-days - 1); dateAttributeRows.Should().NotBeEmpty(); // all the dates present should be after the specified date foreach (var date in dateAttributeRows) { date.Should().BeAfter(historicDate); } ; }
public void NoRowIsWithinTheDataRangeFilters() { var isEmpty = WaitUtils.elementState(_driverWait, By.XPath("//tr[contains(@class,'collection__item')]"), ElementState.NOT_EXIST); Assert.True(isEmpty); }
public void TheBulkOptionsBarShowsUpWIthCorrectInformation() { WaitUtils.elementState(_driverWait, _genericEntityPage.GetWebElementBy("BulkDeleteButton"), ElementState.EXISTS); WaitUtils.elementState(_driverWait, _genericEntityPage.GetWebElementBy("BulkExportButton"), ElementState.EXISTS); Assert.Equal(_genericEntityPage.NumEntitiesOnPage(), _genericEntityPage.NumberOfItemsSelected()); }
public bool QuestionExists(string question) { return(WaitUtils.elementState(driverWait, By.XPath($"//div[@data-name='{question}']"), ElementState.EXISTS)); }
public bool SlideExists(string slide) { return(WaitUtils.elementState(driverWait, By.XPath($"//h3[contains(text(),'{slide}')]"), ElementState.EXISTS)); }
public void WaitForAnElementToNotBeVisibleBy(SelectorPathType selector, string path) { var elementBy = WebElementUtils.GetElementAsBy(selector, path); WaitUtils.elementState(_driverWait, elementBy, ElementState.NOT_VISIBLE); }
public void WaitForAnElementToBePresentBy(SelectorPathType selector, string path) { var elementBy = WebElementUtils.GetElementAsBy(selector, path); WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS); }
public void CloseToasterAlert() { WaitUtils.elementState(_wait, ToasterCloseButtonBy, ElementState.VISIBLE); ToasterCloseButton.Click(); }