예제 #1
0
        public void Creates_page()
        {
            var normalElement = new NullElement();

            WebDriver.Expect(".something", new NullElement());
            WebDriver.Expect("#id", normalElement);

            var simple = new NullElement();

            normalElement.Expect(".simplePart", simple);
            normalElement.Expect(".normal", new NullElement());

            simple.Expect(".byClass", new NullElement());
            simple.Expect("a", new NullElement(), new NullElement(), new NullElement());

            var page = GetPage <NormalPage>();

            Assert.IsNotNull(page.GetElement());

            var normal = page.Normal;

            Assert.IsNotNull(normal, "normal");
            Assert.IsNotNull(normal.GetElement());

            HasPartPageTests.VerifySimple(normal.Simple);
        }
예제 #2
0
        public void Creates_page()
        {
            var simple = new NullElement();

            WebDriver.Expect(".simplePart", simple);

            simple.Expect(".byClass", new NullElement());
            simple.Expect("a", new NullElement());

            var page = GetPage <HasPartPage>();

            VerifySimple(page.Simple);
        }
예제 #3
0
        public void Creates_page()
        {
            var widgets = new NullElement();

            WebDriver.Expect("#widgets", widgets);

            var items = new[] {
                new NullElement(),
                new NullElement(),
                new NullElement()
            };

            widgets.Expect(".widget", items);

            foreach (var item in items)
            {
                item.Expect("h3", new NullElement());
                item.Expect("p", new NullElement());
                item.Expect("div.image", new NullElement());
            }

            var page = GetPage <NormalListPage>();

            Assert.IsNotNull(page);
            Assert.IsNotNull(page.Container);
            Assert.IsNotNull(page.Container.Items);

            foreach (var item in page.Container.Items)
            {
                Assert.IsNotNull(item.GetTitle());
                Assert.IsNotNull(item.GetDescription());
                Assert.IsNotNull(item.GetImage());
            }
        }
예제 #4
0
        public void Waits_for_element_on_part()
        {
            WebDriver
            .Expect("#wait-for", new NullElement())
            .ReturnAfter(5.Attempt());

            var part = new NullElement();

            WebDriver.Expect("#waitable", part);

            part.Expect(".cool", new NullElement());
            part.Expect("#something", new NullElement())
            .ReturnAfter(3.Attempt());

            var page = GetPage <WaitPage>();

            Assert.IsNotNull(page);
            Assert.IsNotNull(page.Waitable);

            var expectation = part.Verify("#something");

            Assert.IsTrue(expectation.WasReturned(), $"Attemps: {expectation.Requests}.");
        }