Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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);
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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;
            }
        }
Esempio n. 6
0
        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);
            }
            ;
        }
Esempio n. 7
0
        public void NoRowIsWithinTheDataRangeFilters()
        {
            var isEmpty = WaitUtils.elementState(_driverWait, By.XPath("//tr[contains(@class,'collection__item')]"), ElementState.NOT_EXIST);

            Assert.True(isEmpty);
        }
Esempio n. 8
0
 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());
 }
Esempio n. 9
0
 public bool QuestionExists(string question)
 {
     return(WaitUtils.elementState(driverWait, By.XPath($"//div[@data-name='{question}']"), ElementState.EXISTS));
 }
Esempio n. 10
0
 public bool SlideExists(string slide)
 {
     return(WaitUtils.elementState(driverWait, By.XPath($"//h3[contains(text(),'{slide}')]"), ElementState.EXISTS));
 }
Esempio n. 11
0
        public void WaitForAnElementToNotBeVisibleBy(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.NOT_VISIBLE);
        }
Esempio n. 12
0
        public void WaitForAnElementToBePresentBy(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS);
        }
Esempio n. 13
0
 public void CloseToasterAlert()
 {
     WaitUtils.elementState(_wait, ToasterCloseButtonBy, ElementState.VISIBLE);
     ToasterCloseButton.Click();
 }