示例#1
0
        private static void CheckUrlGenerationMethod(IBrowserWrapper 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");
        }
示例#2
0
        private void CheckRadioButtonsState(IBrowserWrapper browser, RadioButtonValues selectedColor)
        {
            var radios = new List <IElementWrapper>();

            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;

            AssertUI.IsChecked(radios[checkedRadioIndex]);
            radios.RemoveAt(checkedRadioIndex);
            radios.ForEach(AssertUI.IsNotChecked);

            AssertUI.TextEquals(selectedColorElement, selectedColor.ToString().ToLower());
        }
示例#3
0
        private void CheckSelectAllOnFocus(IBrowserWrapper browser, string textBoxDataUi, bool isSelectAllOnFocusTrue = true)
        {
            var textBox = browser.Single(textBoxDataUi, SelectByDataUi);

            textBox.Click();
            var selectedText = (string)browser.GetJavaScriptExecutor().ExecuteScript($"return window.getSelectionText('{textBoxDataUi}');");
            var expectedText = isSelectAllOnFocusTrue ? "Testing text" : "";

            Assert.AreEqual(expectedText, selectedText);
        }
示例#4
0
        private void CheckTableRow(IBrowserWrapper 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
            AssertUI.InnerTextEquals(table.ElementAt("tr", row).ElementAt("td", 1), value);
            AssertUI.InnerTextEquals(table.ElementAt("tr", row).ElementAt("td", 2), value, false);

            // server binding renders True with capital T, knockout binding renders true with lower case t -> comparison is case insensitive
        }
示例#5
0
        private void CheckSeparators(IBrowserWrapper browser, string repeaterDataUi)
        {
            var repeater = browser.Single(repeaterDataUi, this.SelectByDataUi);

            for (int i = 0; i < repeater.Children.Count; i++)
            {
                if (i % 2 == 0)
                {
                    AssertUI.Attribute(repeater.Children[i], "data-ui", s => s == "item");
                }
                else
                {
                    AssertUI.Attribute(repeater.Children[i], "data-ui", s => s == "separator");
                }
            }
        }
示例#6
0
 protected IElementWrapper GetControlByUiId(string uiid)
 {
     return(browser.Single(uiid, UITestBase.SelectByDataUiId));
 }