コード例 #1
0
        public void ShouldTellUsIfTheGridViewIsEmpty()
        {
            // Given the petshop window
            _window = LaunchPetShopWindow();

            // Then the history should not be empty
            _window.Find <Tab>(FindBy.WpfTitle("History")).Select();
            var gridView = _window.Find <GridView>("lastPetsOutput");

            Assert.IsFalse(gridView.IsEmpty());

            // But the basket should
            _window.Find <Tab>(FindBy.WpfTitle("Basket")).Select();
            gridView = _window.Find <GridView>("basketOutput");
            Assert.IsTrue(gridView.IsEmpty());
        }
コード例 #2
0
        public void ShouldBeAbleToWaitForAChildElementToAppear()
        {
            var window = LaunchPetShopWindow();

            new Thread(() =>
            {
                Thread.Sleep(100);
                window.Find <Tab>(FindBy.WpfTitle("Accessories")).Select();
            }).Start();

            var scrollViewer = window.WaitForElement <ScrollViewer>(new AndCondition(
                                                                        new PropertyCondition(AutomationElement.IsScrollPatternAvailableProperty, true),
                                                                        new PropertyCondition(ScrollPatternIdentifiers.VerticallyScrollableProperty, true)),
                                                                    e => Assert.Fail("Could not find the scroll viewer"));
            bool scrolledABit = false;

            scrollViewer.ScrollDown(s => scrolledABit, s => { scrolledABit = true; });
        }