Exemple #1
0
        private static void PerformSelect2Test(BrowserWrapper browser, ElementWrapper fieldset)
        {
            var select2               = fieldset.Single(".select2");
            var input                 = select2.First("input");
            var result                = fieldset.Single(".result");
            var addItemsButton        = fieldset.ElementAt("button", 0);
            var changeSelectionButton = fieldset.ElementAt("button", 1);
            var submitButton          = fieldset.ElementAt("button", 2);

            // verify the selection at the beginning
            select2.FindElements("li").ThrowIfDifferentCountThan(2);
            result.CheckIfTextEquals("Prague");

            // append tag
            input.SendKeys("Ne");
            input.SendKeys(Keys.Return);
            select2.FindElements("li").ThrowIfDifferentCountThan(3);

            // submit and check the selection on the server
            submitButton.Click().Wait();

            // verify the new tag appeared in the result
            result.CheckIfTextEquals("Prague,New York");

            // check the items offered in the list
            input.Click().Wait();
            browser.FindElements(".select2-container--open li.select2-results__option").ThrowIfDifferentCountThan(4);
            fieldset.Click();

            // add new items to the collection
            addItemsButton.Click().Wait();

            // check the items offered in the list were updated
            input.Click().Wait();
            browser.FindElements(".select2-container--open li.select2-results__option").ThrowIfDifferentCountThan(5);

            // select last item from the list
            browser.Last(".select2-container--open li.select2-results__option").Click();

            // submit and check the selection on the server
            submitButton.Click().Wait();
            result.CheckIfTextEquals("Prague,New York,Berlin");

            // replace the selection on server
            changeSelectionButton.Click().Wait();
            submitButton.Click().Wait();
            result.CheckIfTextEquals("New York,Paris");
        }
 private static void CheckIfInnerTextEqualsToOne(BrowserWrapper browser, string dataUi)
 {
     browser.FindElements($"[data-ui='{dataUi}']").First().CheckIfInnerTextEquals(1.ToString());
 }
Exemple #3
0
 private void Control_GridViewShowHeaderWhenNoData(BrowserWrapper browser)
 {
     browser.FindElements("[data-ui='ShowHeaderWhenNoDataGrid']").FindElements("th").First().IsDisplayed();
 }
 private void CheckTreeItems(BrowserWrapper browser, int level, int count)
 {
     browser.FindElements($"[data-ui='offset_{level}']").ThrowIfDifferentCountThan(count);
 }