コード例 #1
0
ファイル: ListBoxTests.cs プロジェクト: vstribrny/dotvvm
        public void Control_ListBox_ListBox()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_ListBox_ListBox);

                var result = browser.Single("[data-ui=result]");
                AssertUI.InnerTextEquals(result, "0");

                AssertUI.Attribute(browser.Single("select"), "size", "3");

                var firstOption = browser.ElementAt("select option", 0);

                AssertUI.InnerTextEquals(firstOption, "Too long text");
                AssertUI.Attribute(firstOption, "title", "Nice title");

                firstOption.Click();
                AssertUI.InnerTextEquals(result, "1");

                var secondOption = browser.ElementAt("select option", 1);

                AssertUI.InnerTextEquals(secondOption, "Text1");
                AssertUI.Attribute(secondOption, "title", "Even nicer title");

                secondOption.Click();
                AssertUI.InnerTextEquals(result, "2");
            });
        }
コード例 #2
0
ファイル: RepeaterTests.cs プロジェクト: vstribrny/dotvvm
        public void Control_Repeater_RouteLinkQuery()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_Repeater_RouteLinkQuery);

                // verify link urls
                var url = browser.CurrentUrl;
                AssertUI.Attribute(browser.ElementAt("a", 0), "href", url + "?Static=query&Id=1");
                AssertUI.Attribute(browser.ElementAt("a", 1), "href", url + "?Static=query&Id=2");
                AssertUI.Attribute(browser.ElementAt("a", 2), "href", url + "?Static=query&Id=3");
                AssertUI.Attribute(browser.ElementAt("a", 3), "href", url + "?Static=query&Id=1");
                AssertUI.Attribute(browser.ElementAt("a", 4), "href", url + "?Static=query&Id=2");
                AssertUI.Attribute(browser.ElementAt("a", 5), "href", url + "?Static=query&Id=3");
                AssertUI.Attribute(browser.ElementAt("a", 6), "href", url + "?first=param&Static=query&Id=1#test");
                AssertUI.Attribute(browser.ElementAt("a", 7), "href", url + "?first=param&Static=query&Id=2#test");
                AssertUI.Attribute(browser.ElementAt("a", 8), "href", url + "?first=param&Static=query&Id=3#test");
                AssertUI.Attribute(browser.ElementAt("a", 9), "href", url + "?first=param&Static=query&Id=1#test");
                AssertUI.Attribute(browser.ElementAt("a", 10), "href", url + "?first=param&Static=query&Id=2#test");
                AssertUI.Attribute(browser.ElementAt("a", 11), "href", url + "?first=param&Static=query&Id=3#test");

                for (int i = 0; i < 12; i++)
                {
                    AssertUI.InnerText(browser.ElementAt("a", i), s => !string.IsNullOrWhiteSpace(s), "Not rendered Name");
                }
            });
        }
コード例 #3
0
 public void Feature_ServerSideStyles_DotvvmControlProperties()
 {
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_ServerSideStyles_DotvvmProperties);
         AssertUI.Attribute(browser.First("input[id=dotvvmControlWithAttr]"), "customAttr", "Default value");
         AssertUI.Attribute(browser.First("input[id=dotvvmControlNoAttr]"), "customAttr", "Custom property changed");
     });
 }
コード例 #4
0
 public void HeadDoesHaveMetaViewport()
 {
     RunInAllBrowsers(SampleUrl, wrapper =>
     {
         var metaViewport = wrapper.Single("head > meta[name='viewport']", By.CssSelector);
         AssertUI.Attribute(metaViewport, "content", "width=device-width,minimum-scale=1");
     });
 }
コード例 #5
0
 public void HtmlTagLangAttribute()
 {
     RunInAllBrowsers(SampleUrl, wrapper =>
     {
         var html = wrapper.Single("html", By.TagName);
         AssertUI.Attribute(html, "lang", "en");
     });
 }
コード例 #6
0
ファイル: ButtonTests.cs プロジェクト: Mrazator/dotvvm
        public void Control_Button_InputTypeButton_TextContentInside()
        {
            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_Button_InputTypeButton_TextContentInside);

                AssertUI.Attribute(browser.First("input[type=button]"), "value", s => s.Equals("This is text"));
            });
        }
コード例 #7
0
 public void Feature_ServerSideStyles_HtmlControlWithAttributes()
 {
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_ServerSideStyles);
         AssertUI.Attribute(browser.First("customTagName[id=htmlControlWithAttr]"), "ignore", "Default attribute");
         AssertUI.Attribute(browser.First("customTagName[id=htmlControlWithAttr]"), "append", "Default attribute;Attribute appended");
         AssertUI.Attribute(browser.First("customTagName[id=htmlControlWithAttr]"), "overwrite", "Attribute changed");
         AssertUI.Attribute(browser.First("customTagName[id=htmlControlWithAttr]"), "class", "default-class new-class");
     });
 }
コード例 #8
0
 public void Complex_ServerRendering_ControlUsageSample()
 {
     //As I am writing this, test should fail because on postback there will be two <!-- ko with: EditedArticle --/> elements inside each other instead of one.
     //Caused by DataContext, Visible, RenderSettings.Mode, PostBack.Update being all on the same div
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.ComplexSamples_ServerRendering_ControlUsageSample);
         browser.First("a[data-ui=show-link]").Click();
         browser.Wait(500);
         AssertUI.Attribute(browser.First("input[data-ui=textbox]"), "value", v => v.Contains("a"));
     });
 }
コード例 #9
0
 public void Feature_ServerSideStyles_Directory()
 {
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_DirectoryStyle_ServerSideStyles);
         AssertUI.Attribute(browser.First("input[id=dotvvmControl]"), "directory", "matching");
         AssertUI.Attribute(browser.First("customtagname[id=htmlControl]"), "directory", "matching");
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_NoDirectoryStyle_ServerSideStyles);
         AssertUI.HasNotAttribute(browser.First("input[id=dotvvmControl]"), "directory");
         AssertUI.HasNotAttribute(browser.First("customtagname[id=htmlControl]"), "directory");
     });
 }
コード例 #10
0
        public void Control_GridView_GridViewInlineEditingValidation()
        {
            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_GridView_GridViewInlineEditingValidation);
                browser.Driver.Manage().Window.Maximize();

                //Get rows
                var rows     = browser.First("table tbody");
                var firstRow = rows.ElementAt("tr", 0);

                //Edit
                firstRow.ElementAt("td", 5).First("button").Click();

                rows     = browser.First("table tbody");
                firstRow = rows.ElementAt("tr", 0);

                //Check type
                AssertUI.Attribute(firstRow.ElementAt("td", 1).First("input"), "type", "text");
                AssertUI.Attribute(firstRow.ElementAt("td", 2).First("input"), "type", "text");
                AssertUI.Attribute(firstRow.ElementAt("td", 3).First("input"), "type", "text");
                AssertUI.Attribute(firstRow.ElementAt("td", 4).First("input"), "type", "text");

                //clear name
                firstRow.ElementAt("td", 1).First("input").Clear();

                //update buttons
                firstRow.ElementAt("td", 5).FindElements("button").ThrowIfDifferentCountThan(2);

                //update
                firstRow.ElementAt("td", 5).First("button").Click();

                //getting rid iof "postback interupted message"
                browser.FindElements("div#debugNotification").First().Click();
                browser.Wait(1000);

                var validationResult = browser.ElementAt(".validation", 0);

                AssertUI.InnerTextEquals(validationResult, "The Name field is required.");

                //change name
                firstRow.ElementAt("td", 1).First("input").SendKeys("Test");

                //clear email
                firstRow.ElementAt("td", 3).First("input").Clear();

                //update
                firstRow.ElementAt("td", 5).First("button").Click();

                //check validation
                AssertUI.InnerTextEquals(validationResult, "The Email field is not a valid e-mail address.");
            });
        }
コード例 #11
0
        public void Feature_EmbeddedResourceControls_EmbeddedResourceControls()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_EmbeddedResourceControls_EmbeddedResourceControls);

                AssertUI.Attribute(browser.First("input[type=button]"), "value", "Nothing");

                browser.First("input[type=button]").Click();

                AssertUI.Attribute(browser.First("input[type=button]"), "value", "This is text");
            });
        }
コード例 #12
0
ファイル: ComboBoxTests.cs プロジェクト: wushian/dotvvm
        public void Control_ComboBox_ComboBoxTitle()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_ComboBox_ComboBoxTitle);

                AssertUI.InnerTextEquals(browser.ElementAt("select option", 0), "Too lo...");
                AssertUI.InnerTextEquals(browser.ElementAt("select option", 1), "Text");

                AssertUI.Attribute(browser.ElementAt("select option", 0), "title", "Nice title");
                AssertUI.Attribute(browser.ElementAt("select option", 1), "title", "Even nicer title");
            });
        }
コード例 #13
0
ファイル: IdGenerationTests.cs プロジェクト: wushian/dotvvm
        public void Feature_IdGeneration_IdGeneration()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_IdGeneration_IdGeneration);
                browser.Wait();

                AssertUI.Attribute(browser.Single("*[data-id=test1_marker]"), "id", s => s.Equals("test1"),
                                   "Wrong ID");
                AssertUI.Attribute(browser.Single("*[data-id=test2_marker]"), "id", s => s.Equals("test2"),
                                   "Wrong ID");

                AssertUI.Attribute(browser.Single("*[data-id=test1a_marker]"), "id", s => s.Equals("test1a"),
                                   "Wrong ID");
                AssertUI.Attribute(browser.Single("*[data-id=test2a_marker]"), "id", s => s.Equals("test2a"),
                                   "Wrong ID");

                var control1 = browser.Single("#ctl1");
                AssertUI.Attribute(control1.Single("*[data-id=control1_marker]"), "id", s => s.Equals("ctl1_control1"),
                                   "Wrong ID");
                AssertUI.Attribute(control1.Single("*[data-id=control2_marker]"), "id", s => s.Equals("ctl1_control2"),
                                   "Wrong ID");

                var control2 = browser.Single("#ctl2");
                AssertUI.Attribute(control2.Single("*[data-id=control1_marker]"), "id", s => s.Equals("control1"),
                                   "Wrong ID");
                AssertUI.Attribute(control2.Single("*[data-id=control2_marker]"), "id", s => s.Equals("control2"),
                                   "Wrong ID");

                var repeater1 = browser.Single("*[data-id=repeater1]");
                for (int i = 0; i < 4; i++)
                {
                    AssertUI.Attribute(repeater1.ElementAt("*[data-id=repeater1_marker]", i), "id",
                                       s => s.Equals(repeater1.GetAttribute("id") + "_" + i + "_repeater1"), "Wrong ID");
                    AssertUI.Attribute(repeater1.ElementAt("*[data-id=repeater2_marker]", i), "id",
                                       s => s.Equals(repeater1.GetAttribute("id") + "_" + i + "_repeater2"), "Wrong ID");
                }

                var repeater2 = browser.Single("*[data-id=repeater2]");
                for (int i = 0; i < 4; i++)
                {
                    AssertUI.Attribute(repeater2.ElementAt("*[data-id=repeater1server_marker]", i), "id",
                                       s => s.Equals(repeater2.GetAttribute("id") + "_" + i + "_repeater1server"), "Wrong ID");
                    AssertUI.Attribute(repeater2.ElementAt("*[data-id=repeater2server_marker]", i), "id",
                                       s => s.Equals(repeater2.GetAttribute("id") + "_" + i + "_repeater2server"), "Wrong ID");
                }

                foreach (var span in browser.Single("*[data-ui=repeater3]").Children)
                {
                    AssertUI.Attribute(span, "id", s => s.Equals(span.GetAttribute("data-ui")), "Wrong ID");
                }
            });
        }
コード例 #14
0
 public void Complex_ServerRendering_ControlUsageSampleRewriting()
 {
     //As I am writing this, test should work because RenderSettings.Mode, PostBack.Update are on div that is inside div with DataContext.
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.ComplexSamples_ServerRendering_ControlUsageSampleRewriting);
         browser.First("a[data-ui=show-link]").Click();
         browser.Wait(500);
         AssertUI.Attribute(browser.First("div[data-ui='context-1']").First("input[data-ui=textbox]"), "value", v => v.Contains("a"));
         browser.First("a[data-ui=rewrite-link]").Click();
         browser.Wait(500);
         AssertUI.Attribute(browser.First("div[data-ui='context-2']").First("input[data-ui=textbox]"), "value", v => v.Contains("b"));
     });
 }
コード例 #15
0
 public void Feature_ServerSideStyles_DataContexts()
 {
     RunInAllBrowsers(browser => {
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_ServerSideStyles_MatchingViewModel);
         AssertUI.Attribute(browser.First("customDataContextTag[id=matchingDataContextAndRoot]"), "dataContextCheck", "matching");
         AssertUI.Attribute(browser.First("customDataContextTag[id=matchingDataContextAndRoot]"), "rootDataContextCheck", "matching");
         AssertUI.Attribute(browser.First("customDataContextTag[id=matchingRoot]"), "rootDataContextCheck", "matching");
         AssertUI.HasNotAttribute(browser.First("customDataContextTag[id=matchingRoot]"), "dataContextCheck");
         browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ServerSideStyles_ServerSideStyles);
         AssertUI.HasNotAttribute(browser.First("customDataContextTag[id=nonMatchingDataContextAndRoot]"), "rootDataContextCheck");
         AssertUI.HasNotAttribute(browser.First("customDataContextTag[id=nonMatchingDataContextAndRoot]"), "dataContextCheck");
     });
 }
コード例 #16
0
        private void Control_TextBox_StringFormat_ChangedCommandBinding(string cultureName, string url, string linkSelector)
        {
            RunInAllBrowsers(browser => {
                void ClearInput(IElementWrapper element)
                {
                    // There is special threatment for TextBox with Changed Command
                    // When Clear() method is used, changed command is invoked and default value '0.00' appear
                    while (element.GetText() != "")
                    {
                        element.WebElement.SendKeys(Keys.Backspace);
                    }
                }

                // Set focus to different element to drop focus on input and invoke onchange element (for IE)
                void LoseFocus() => browser.Single("body").SetFocus();;

                var culture = new CultureInfo(cultureName);
                browser.NavigateToUrl(url);
                browser.First(linkSelector).Click();

                var numberTextbox = browser.First("#bindingNumberFormatTextbox");
                AssertUI.Attribute(numberTextbox, "value", 0.ToString("N", culture));

                var numberValueText = browser.First("#resultNumberValueText");
                AssertUI.InnerTextEquals(numberValueText, 0.ToString(culture));

                // send new values
                ClearInput(numberTextbox);
                numberTextbox.SendKeys("42")
                .SendEnterKey()
                .Wait();
                LoseFocus();

                // check new values
                AssertUI.InnerTextEquals(numberValueText, 42.ToString(culture));
                AssertUI.Attribute(numberTextbox, "value", 42.ToString("N", culture));

                // send new values
                ClearInput(numberTextbox);
                numberTextbox.SendKeys(123.456789.ToString(culture))
                .SendEnterKey()
                .Wait();
                LoseFocus();

                // check new values
                AssertUI.InnerTextEquals(numberValueText, 123.456789.ToString(culture));
                AssertUI.Attribute(numberTextbox, "value", 123.456789.ToString("N", culture));
            });
        }
コード例 #17
0
        public void Feature_DateTimeSerialization_DateTimeSerialization()
        {
            var culture = new CultureInfo("cs-CZ");

            CultureInfo.CurrentCulture = new CultureInfo("en");

            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_DateTimeSerialization_DateTimeSerialization);
                browser.WaitFor(() => browser.FindElements("input[type=text]").ThrowIfSequenceEmpty(), 5000);

                // verify the first date
                browser.ElementAt("input[type=text]", 0).Clear().SendKeys("18.2.1988");
                browser.ElementAt("input[type=button]", 1).Click();

                AssertUI.InnerText(browser.ElementAt("span", 0), s => DateTime.Parse(s).Equals(new DateTime(1988, 2, 18)));
                browser.ElementAt("input[type=text]", 0).Clear().SendKeys("test");
                browser.ElementAt("input[type=button]", 1).Click();

                AssertUI.InnerText(browser.ElementAt("span", 0),
                                   s => DateTime.Parse(s).Equals(DateTime.MinValue));

                // verify the second date
                browser.ElementAt("input[type=text]", 1).Clear().SendKeys("2011-03-19 16:48:17");
                browser.ElementAt("input[type=button]", 3).Click();

                AssertUI.InnerText(browser.ElementAt("span", 1),
                                   s => DateTime.Parse(s).Equals(new DateTime(2011, 3, 19, 16, 48, 0)));

                browser.ElementAt("input[type=text]", 1).Clear().SendKeys("test");
                browser.ElementAt("input[type=button]", 3).Click();

                AssertUI.InnerTextEquals(browser.ElementAt("span", 1), "null");

                // try to set dates from server
                browser.ElementAt("input[type=button]", 0).Click();
                browser.ElementAt("input[type=button]", 2).Click();

                browser.Wait(500);

                // there is no time in the field
                AssertUI.Attribute(browser.ElementAt("input[type=text]", 0), "value",
                                   s => (DateTime.Now - DateTime.Parse(s, culture)).TotalHours < 24);

                // the minutes can differ slightly
                AssertUI.Attribute(browser.ElementAt("input[type=text]", 1), "value",
                                   s => (DateTime.Now - DateTime.Parse(s, culture)).TotalMinutes < 1);
            });
        }
コード例 #18
0
        public void Feature_AttachedProperties_AttachedProperties()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_AttachedProperties_AttachedProperties);

                var div = browser.Single(".div");
                AssertUI.Attribute(div, "bind:value", a => a == "test");
                AssertUI.Attribute(div, "bind:value2", a => a == "aaa");

                var txb = browser.Single("input[type=text]");
                txb.Clear().SendKeys("bbb").SendKeys(Keys.Tab);

                AssertUI.Attribute(div, "bind:value2", a => a == "bbb");
            });
        }
コード例 #19
0
ファイル: RepeaterTests.cs プロジェクト: vstribrny/dotvvm
        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");
                }
            }
        }
コード例 #20
0
        public void Feature_Serialization_Serialization()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_Serialization_Serialization);

                // fill the values
                browser.ElementAt("input[type=text]", 0).SendKeys("1");
                browser.ElementAt("input[type=text]", 1).SendKeys("2");
                browser.Click("input[type=button]");

                // verify the results
                AssertUI.Attribute(browser.ElementAt("input[type=text]", 0), "value", s => s.Equals(""));
                AssertUI.Attribute(browser.ElementAt("input[type=text]", 1), "value", s => s.Equals("2"));
                AssertUI.InnerTextEquals(browser.Last("span"), ",2");
            });
        }
コード例 #21
0
        public void Feature_DateTimeSerialization_StaticDateTime()
        {
            var culture = new CultureInfo("cs-CZ");

            CultureInfo.CurrentCulture = new CultureInfo("en");

            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_DateTimeSerialization_DateTimeSerialization);

                AssertUI.Attribute(browser.Single("input[data-ui='static-date']"), "value", s => string.IsNullOrEmpty(s));

                browser.Single("input[data-ui='set-static-date-button']").Click();

                AssertUI.Attribute(browser.Single("input[data-ui='static-date']"), "value",
                                   s => DateTime.Parse(s, culture) == new DateTime(2000, 1, 1));
            });
        }
コード例 #22
0
ファイル: TextBoxTests.cs プロジェクト: Mrazator/dotvvm
        private void Control_TextBox_StringFormat_ChangedCommandBinding(string cultureName, string url, string linkSelector)
        {
            RunInAllBrowsers(browser => {
                void ClearInput(IElementWrapper element)
                {
                    // There is special threatment for TextBox with Changed Command
                    // When Clear() method is used, changed command is invoked and default value '0.00' appear
                    new Actions(browser.Driver)
                    .DoubleClick(element.WebElement)
                    .SendKeys(Keys.Delete)
                    .Build()
                    .Perform();
                }

                var culture = new CultureInfo(cultureName);
                browser.NavigateToUrl(url);
                browser.First(linkSelector).Click();

                var numberTextbox = browser.First("#bindingNumberFormatTextbox");
                AssertUI.Attribute(numberTextbox, "value", 0.ToString("N", culture));

                var numberValueText = browser.First("#resultNumberValueText");
                AssertUI.InnerTextEquals(numberValueText, 0.ToString(culture));

                // send new values
                ClearInput(numberTextbox);
                numberTextbox.SendKeys("42")
                .SendEnterKey()
                .Wait();

                // check new values
                AssertUI.InnerTextEquals(numberValueText, 42.ToString(culture));
                AssertUI.Attribute(numberTextbox, "value", 42.ToString("N", culture));

                // send new values
                ClearInput(numberTextbox);
                numberTextbox.SendKeys(123.456789.ToString(culture))
                .SendEnterKey()
                .Wait();

                // check new values
                AssertUI.InnerTextEquals(numberValueText, 123.456789.ToString(culture));
                AssertUI.Attribute(numberTextbox, "value", 123.456789.ToString("N", culture));
            });
        }
コード例 #23
0
        public void Control_GridView_GridViewInlineEditingPrimaryKeyString()
        {
            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_GridView_GridViewInlineEditingPrimaryKeyString);
                //Get rows
                var rows = browser.First("table tbody");
                rows.FindElements("tr").ThrowIfDifferentCountThan(3);

                var firstRow = rows.ElementAt("tr", 0);
                AssertUI.InnerTextEquals(firstRow.ElementAt("td", 0).First("span"), "A");
                //Edit
                firstRow.ElementAt("td", 4).First("button").Click();
                browser.Wait(500);

                //init again
                rows     = browser.First("table tbody");
                firstRow = rows.ElementAt("tr", 0);

                //Check type
                AssertUI.Attribute(firstRow.ElementAt("td", 1).First("input"), "type", "text");
                AssertUI.Attribute(firstRow.ElementAt("td", 2).First("input"), "type", "text");
                AssertUI.Attribute(firstRow.ElementAt("td", 3).First("input"), "type", "text");

                //change name
                firstRow.ElementAt("td", 1).First("input").Clear();
                firstRow.ElementAt("td", 1).First("input").SendKeys("Test");

                //update buttons
                firstRow.ElementAt("td", 4).FindElements("button").ThrowIfDifferentCountThan(2);

                //update
                firstRow.ElementAt("td", 4).First("button").Click();
                browser.Wait(500);

                //init again
                rows     = browser.First("table tbody");
                firstRow = rows.ElementAt("tr", 0);

                //check changed name and Id
                AssertUI.InnerTextEquals(firstRow.ElementAt("td", 0).First("span"), "A");
                AssertUI.InnerTextEquals(firstRow.ElementAt("td", 1).First("span"), "Test");
            });
        }
コード例 #24
0
        public void AddressMarker()
        {
            string sampleUrl = "/Address";

            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(sampleUrl);
                browser.Wait(1000);
                var map       = browser.Single("addressHardcoded", By.Id);
                var markerMap = map.Single("gmimap0", By.Id);
                var markerImg = markerMap.ParentElement.Single("img", By.TagName);
                AssertUI.Attribute(markerImg, "usemap", "#gmimap0");
                AssertUI.Attribute(markerMap, "name", "gmimap0");

                map       = browser.Single("addressBindable", By.Id);
                markerMap = map.Single("gmimap1", By.Id);
                markerImg = markerMap.ParentElement.Single("img", By.TagName);
                AssertUI.Attribute(markerImg, "usemap", "#gmimap1");
                AssertUI.Attribute(markerMap, "name", "gmimap1");
            });
        }
コード例 #25
0
        public void LocationMarker()
        {
            string sampleUrl = "/Location";

            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(sampleUrl);
                browser.Wait(1000);
                var map       = browser.Single("locationHardcoded", By.Id);
                var markerMap = map.Single("gmimap0", By.Id);
                var markerImg = markerMap.ParentElement.Single("img", By.TagName);
                AssertUI.Attribute(markerImg, "usemap", "#gmimap0");
                AssertUI.Attribute(markerMap, "name", "gmimap0");

                map       = browser.Single("locationBindable", By.Id);
                markerMap = map.Single("gmimap2", By.Id);
                markerImg = markerMap.ParentElement.Single("img", By.TagName);
                AssertUI.Attribute(markerImg, "usemap", "#gmimap2");
                AssertUI.Attribute(markerMap, "name", "gmimap2");

                browser.Driver.Quit();
            });
        }
コード例 #26
0
ファイル: SPARedirectTests.cs プロジェクト: wushian/dotvvm
        public void Complex_SPARedirect_RedirectToLoginPage()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl("ComplexSamples/SPARedirect");
                browser.Wait(1000);

                //check url
                AssertUI.Url(browser, s => s.Contains("/ComplexSamples/SPARedirect/login?ReturnUrl=%2FComplexSamples%2FSPARedirect"));

                // login to the app
                IElementWrapper getLoginElement() => browser.First("input[type=button]");
                AssertUI.Attribute(getLoginElement(), "value", "Login");
                getLoginElement().Click().Wait(1000);

                //check url
                AssertUI.Url(browser, s => s.Contains("ComplexSamples/SPARedirect"));

                // sign out
                AssertUI.Attribute(getLoginElement(), "value", "Sign Out");
                getLoginElement().Click().Wait(1000);

                //check url
                AssertUI.Url(browser, s => s.Contains("/ComplexSamples/SPARedirect/login?ReturnUrl=%2FComplexSamples%2FSPARedirect"));

                // login to the app
                AssertUI.Attribute(getLoginElement(), "value", "Login");
                getLoginElement().Click().Wait(1000);

                //check url
                AssertUI.Url(browser, s => s.Contains("ComplexSamples/SPARedirect"));

                // sign out
                AssertUI.Attribute(getLoginElement(), "value", "Sign Out");
                getLoginElement().Click().Wait(1000);
            });
        }
コード例 #27
0
        public void Feature_Serialization_ObservableCollectionShouldContainObservables()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_Serialization_ObservableCollectionShouldContainObservables);
                browser.Wait();

                // verify that the values are selected
                browser.ElementAt("select", 0).Select(0);
                browser.ElementAt("select", 1).Select(1);
                browser.ElementAt("select", 2).Select(2);

                // click the button
                browser.Click("input[type=button]");

                // verify that the values are correct
                AssertUI.InnerTextEquals(browser.First("p.result"), "1,2,3");
                AssertUI.Attribute(browser.ElementAt("select", 0), "value", "1");
                AssertUI.Attribute(browser.ElementAt("select", 1), "value", "2");
                AssertUI.Attribute(browser.ElementAt("select", 2), "value", "3");
                browser.Wait();

                // change the values
                browser.ElementAt("select", 0).Select(1);
                browser.ElementAt("select", 1).Select(2);
                browser.ElementAt("select", 2).Select(1);

                // click the button
                browser.Click("input[type=button]");

                // verify that the values are correct
                AssertUI.InnerTextEquals(browser.First("p.result"), "2,3,2");
                AssertUI.Attribute(browser.ElementAt("select", 0), "value", "2");
                AssertUI.Attribute(browser.ElementAt("select", 1), "value", "3");
                AssertUI.Attribute(browser.ElementAt("select", 2), "value", "2");
            });
        }
コード例 #28
0
        private void Control_TextBox_StringFormat_core(string url)
        {
            RunInAllBrowsers(browser =>
            {
                void checkForLanguage(string language)
                {
                    var culture     = new CultureInfo(language);
                    var dateResult1 = browser.First("#date-result1").GetText();
                    var dateResult2 = browser.First("#date-result2").GetText();
                    var dateResult3 = browser.First("#date-result3").GetText();

                    var dateTextBox = browser.First("#dateTextbox");
                    AssertUI.Attribute(dateTextBox, "value", dateResult1);

                    var dateText = browser.First("#DateValueText");
                    AssertUI.InnerTextEquals(dateText, new DateTime(2015, 12, 27).ToString("G", culture));

                    var numberTextbox = browser.First("#numberTextbox");
                    AssertUI.Attribute(numberTextbox, "value", 123.1235.ToString(culture));

                    var numberValueText = browser.First("#numberValueText");
                    AssertUI.InnerTextEquals(numberValueText, 123.123456789.ToString(culture));

                    //write new valid values
                    dateTextBox.Clear().SendKeys(dateResult2);
                    numberTextbox.Clear().SendKeys(2000.ToString("n0", culture));
                    dateTextBox.Click().Wait();

                    //check new values
                    AssertUI.InnerTextEquals(dateText, new DateTime(2018, 12, 27).ToString("G", culture));
                    AssertUI.InnerTextEquals(numberValueText, 2000.ToString(culture));

                    AssertUI.Attribute(numberTextbox, "value", 2000.ToString("n4", culture));
                    AssertUI.Attribute(dateTextBox, "value", dateResult2);

                    //write invalid values
                    dateTextBox.Clear().SendKeys("dsasdasd");
                    numberTextbox.Clear().SendKeys("000//*a");
                    dateTextBox.Click();

                    //check invalid values
                    AssertUI.InnerTextEquals(dateText, "");
                    AssertUI.InnerTextEquals(numberValueText, "");

                    AssertUI.Attribute(numberTextbox, "value", "000//*a");
                    AssertUI.Attribute(dateTextBox, "value", "dsasdasd");

                    //write new valid values
                    dateTextBox.Clear().SendKeys(new DateTime(2018, 1, 1).ToString("d", culture));
                    numberTextbox.Clear().SendKeys(1000.550277.ToString(culture));
                    dateTextBox.Click().Wait();

                    //check new values
                    AssertUI.InnerTextEquals(dateText, new DateTime(2018, 1, 1).ToString("G", culture));
                    AssertUI.InnerTextEquals(numberValueText, 1000.550277.ToString(culture));

                    AssertUI.Attribute(numberTextbox, "value", 1000.550277.ToString("n4", culture));
                    AssertUI.Attribute(dateTextBox, "value", dateResult3);
                };

                //en-US
                browser.NavigateToUrl(url);
                checkForLanguage("en-US");

                //cs-CZ | reload
                browser.First("#czech").Click();
                checkForLanguage("cs-CZ");
            });
        }
コード例 #29
0
        public void Control_TextBox_StringFormat(string cultureName, string url, string linkSelector)
        {
            RunInAllBrowsers(browser => {
                var culture = new CultureInfo(cultureName);
                browser.NavigateToUrl(url);
                browser.First(linkSelector).Click();

                var dateResult1 = browser.First("#date-result1").GetText();
                var dateResult2 = browser.First("#date-result2").GetText();
                var dateResult3 = browser.First("#date-result3").GetText();

                var dateTextBox = browser.First("#dateTextbox");
                AssertUI.Attribute(dateTextBox, "value", dateResult1);

                var dateText = browser.First("#DateValueText");
                AssertUI.InnerTextEquals(dateText, new DateTime(2015, 12, 27).ToString("G", culture));

                var nullableDateTextBox = browser.First("#nullableDateTextbox");
                AssertUI.Attribute(nullableDateTextBox, "value", new DateTime(2015, 12, 27).ToString("G", culture));

                var nullableDateText = browser.First("#nullableDateValueText");
                AssertUI.InnerTextEquals(nullableDateText, new DateTime(2015, 12, 27).ToString("G", culture));

                var numberTextbox = browser.First("#numberTextbox");
                AssertUI.Attribute(numberTextbox, "value", 123.1235.ToString(culture));

                var numberValueText = browser.First("#numberValueText");
                AssertUI.InnerTextEquals(numberValueText, 123.123456789.ToString(culture));

                var nullableNumberTextbox = browser.First("#nullableNumberTextbox");
                AssertUI.Attribute(nullableNumberTextbox, "value", 123.123456789.ToString(culture));

                var nullableNumberValueText = browser.First("#nullableNumberValueText");
                AssertUI.InnerTextEquals(nullableNumberValueText, 123.123456789.ToString(culture));

                //write new valid values
                dateTextBox.Clear().SendKeys(dateResult2);
                numberTextbox.Clear().SendKeys(2000.ToString("n0", culture));
                dateTextBox.Click().Wait();

                //check new values
                AssertUI.InnerTextEquals(dateText, new DateTime(2018, 12, 27).ToString("G", culture));
                AssertUI.InnerTextEquals(numberValueText, 2000.ToString(culture));

                AssertUI.Attribute(numberTextbox, "value", 2000.ToString("n4", culture));
                AssertUI.Attribute(dateTextBox, "value", dateResult2);

                //write invalid values
                dateTextBox.Clear().SendKeys("dsasdasd");
                numberTextbox.Clear().SendKeys("000//a");
                dateTextBox.Click();

                //check invalid values
                AssertUI.InnerTextEquals(dateText, "");
                AssertUI.InnerTextEquals(numberValueText, "");

                AssertUI.Attribute(numberTextbox, "value", "000//a");
                AssertUI.Attribute(dateTextBox, "value", "dsasdasd");

                //write new valid values
                dateTextBox.Clear().SendKeys(new DateTime(2018, 1, 1).ToString("d", culture));
                numberTextbox.Clear().SendKeys(1000.550277.ToString(culture));
                dateTextBox.Click().Wait();

                //check new values
                AssertUI.InnerTextEquals(dateText, new DateTime(2018, 1, 1).ToString("G", culture));
                AssertUI.InnerTextEquals(numberValueText, 1000.550277.ToString(culture));

                AssertUI.Attribute(numberTextbox, "value", 1000.550277.ToString("n4", culture));
                AssertUI.Attribute(dateTextBox, "value", dateResult3);
            });
        }