Exemplo n.º 1
0
        private static void CheckUrlGenerationMethod(IBrowserWrapperFluentApi browser, bool isSpaLink = false)
        {
            void checkNavigatedUrl(string selector, string relativeUrl)
            {
                var href = browser.Single(selector).GetAttribute("href");

                Assert.AreEqual(relativeUrl, new Uri(href).AbsolutePath);
            }

            checkNavigatedUrl("a[data-ui='optional-parameter-client']", "/ControlSamples/Repeater/RouteLink");
            checkNavigatedUrl("a[data-ui='optional-parameter-server']", "/ControlSamples/Repeater/RouteLink");

            checkNavigatedUrl("a[data-ui='0-parameters-client']", "/");
            checkNavigatedUrl("a[data-ui='0-parameters-server']", "/");

            checkNavigatedUrl("a[data-ui='optional-parameter-prefixed-client']", "/ControlSamples/Repeater/RouteLink");
            checkNavigatedUrl("a[data-ui='optional-parameter-prefixed-server']", "/ControlSamples/Repeater/RouteLink");

            checkNavigatedUrl("a[data-ui='parameter-prefixed-client']", "/ControlSamples/Repeater/RouteLink/id-1");
            checkNavigatedUrl("a[data-ui='parameter-prefixed-server']", "/ControlSamples/Repeater/RouteLink/id-1");

            checkNavigatedUrl("a[data-ui='optional-parameter-at-start-client']", "/ControlSamples/Repeater/RouteLink");
            checkNavigatedUrl("a[data-ui='optional-parameter-at-start-server']", "/ControlSamples/Repeater/RouteLink");

            checkNavigatedUrl("a[data-ui='optional-prefixed-parameter-at-start-client']", "/id-1/ControlSamples/Repeater/RouteLink");
            checkNavigatedUrl("a[data-ui='optional-prefixed-parameter-at-start-client']", "/id-1/ControlSamples/Repeater/RouteLink");
        }
Exemplo n.º 2
0
        private void CheckRadioButtonsState(IBrowserWrapperFluentApi browser, RadioButtonValues selectedColor)
        {
            var radios = new List <IElementWrapperFluentApi>();

            radios.Add(browser.Single("radio-red", this.SelectByDataUi));
            radios.Add(browser.Single("radio-green", this.SelectByDataUi));
            radios.Add(browser.Single("radio-blue", this.SelectByDataUi));
            var selectedColorElement = browser.Single("selected-color", this.SelectByDataUi);

            int checkedRadioIndex = (int)selectedColor;

            radios[checkedRadioIndex].CheckIfIsChecked();
            radios.RemoveAt(checkedRadioIndex);
            radios.ForEach(r => r.CheckIfIsNotChecked());

            selectedColorElement.CheckIfTextEquals(selectedColor.ToString().ToLower());
        }
Exemplo n.º 3
0
        private void CheckTableRow(IBrowserWrapperFluentApi browser, int row)
        {
            var table = browser.Single("table");

            // get expected value - last column
            var value = table.ElementAt("tr", row).ElementAt("td", 3).GetInnerText();

            // check other columns to contain same value
            table.ElementAt("tr", row).ElementAt("td", 1).CheckIfInnerTextEquals(value, false);
            table.ElementAt("tr", row).ElementAt("td", 2).CheckIfInnerTextEquals(value, false);

            // server binding renders True with capital T, knockout binding renders true with lower case t -> comparison is case insensitive
        }
Exemplo n.º 4
0
        private void CheckSeparators(IBrowserWrapperFluentApi browser, string repeaterDataUi)
        {
            var repeater = browser.Single(repeaterDataUi, this.SelectByDataUi);

            for (int i = 0; i < repeater.Children.Count; i++)
            {
                if (i % 2 == 0)
                {
                    repeater.Children[i].CheckAttribute("data-ui", s => s == "item");
                }
                else
                {
                    repeater.Children[i].CheckAttribute("data-ui", s => s == "separator");
                }
            }
        }
Exemplo n.º 5
0
        private void ShowHideControl(IBrowserWrapperFluentApi browser)
        {
            // verify the second pager is hidden
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsNotDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(2);
            // verify the second pager appears
            browser.Single("populate-button", this.SelectByDataUi).Click();

            // verify the second pager appears
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(3);

            // switch to another page
            browser.First(".pagination").ElementAt("li a", 4).Click();

            // verify the second pager is still visible
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(3);
        }