Пример #1
0
        public void Should_not_find_div_when_given_selector_returns_an_input()
        {
            ExecuteTest(browser =>
                            {
                                // GIVEN
                                var querySelectorConstraint = new QuerySelectorConstraint("input");

                                // WHEN
                                var div = browser.Div(querySelectorConstraint);

                                // THEN
                                Assert.That(div.Exists, Is.False);
                            });
        }
Пример #2
0
        public void Should_filter_input_elements_with_given_selector_filter()
        {
            ExecuteTest(browser =>
                            {
                                // GIVEN
                                var querySelectorConstraint = new QuerySelectorConstraint("input");

                                // WHEN
                                var elements = browser.Elements.Filter(querySelectorConstraint);

                                // THEN
                                Assert.That(elements.Count, Is.EqualTo(19));
                            });
        }
        public void Should_be_able_to_use_single_quotes_in_selector_string()
        {
            ExecuteTest(browser =>
            {
                // GIVEN
                var querySelectorConstraint = new QuerySelectorConstraint("input[name='textinput1']");

                // WHEN
                var element = browser.Element(querySelectorConstraint);

                // THEN
                Assert.That(element.Exists, Is.True);
            });
        }
Пример #4
0
        public void Should_find_element()
        {
            ExecuteTest(browser =>
                            {
                                // GIVEN
                                var querySelectorConstraint = new QuerySelectorConstraint("#popupid");

                                // WHEN
                                var element = browser.Element(querySelectorConstraint);

                                // THEN
                                Assert.That(element.Exists, Is.True);
                                Assert.That(element.Id, Is.EqualTo("popupid"));
                            });
        }
Пример #5
0
        public void Should_not_find_element_not_inside_container_element()
        {
            ExecuteTest(browser =>
            {
                // GIVEN
                var querySelectorConstraint = new QuerySelectorConstraint("#popupid");
                var containerElement = browser.Form("FormInputElement");

                // WHEN
                var element = containerElement.Element(querySelectorConstraint);

                // THEN
                Assert.That(element.Exists, Is.False);
            });
        }
Пример #6
0
        public void Should_find_element_inside_container_element()
        {
            ExecuteTest(browser =>
            {
                // GIVEN
                var querySelectorConstraint = new QuerySelectorConstraint(":first");
                var containerElement = browser.Form("Form");

                // WHEN
                var element = containerElement.Element(querySelectorConstraint);

                // THEN
                Assert.That(element.Exists, Is.True);
                Assert.That(element.Id, Is.EqualTo("name"));
            });
        }
Пример #7
0
        public void Should_return_selector_string_when_calling_WriteDescriptionTo()
        {
            // GIVEN
            var constraint = new QuerySelectorConstraint(".Return >this");
            var sb = new StringBuilder();

            // WHEN
            constraint.WriteDescriptionTo(new StringWriter(sb));

            // THEN
            Assert.That(sb.ToString(), Is.EqualTo("Selector = '.Return >this'"));
        }