Example #1
0
        public void PreviousPageButtonChangingPageTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();
                VerifyPageChanged(0);
                InputHelper.LeftClick(elements.GetNextPageButton());

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(0);

                InputHelper.LeftClick(elements.GetLastPageButton());

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(3);

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(2);

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(1);

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(0);
            }
        }
Example #2
0
        public void NumberBoxDisplayChangingPageTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();
                VerifyPageChanged(0);

                SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
                VerifyPageChanged(2);

                SendValueToNumberBox("1");
                VerifyPageChanged(0);

                SendValueToNumberBox("5");
                VerifyPageChanged(4);

                SendValueToNumberBox("2");
                VerifyPageChanged(1);

                SendValueToNumberBox("100");
                Verify.AreEqual("5", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If over max, value should be clamped down to the max.
                VerifyPageChanged(4);

                SendValueToNumberBox("-100");
                Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If under min, value should be clamped up to the min.
                VerifyPageChanged(0);
            }
        }
Example #3
0
        public void NumberPanelInfiniteItemsTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                VerifyPageChanged(0);

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                elements.GetEnterInfinityModeButton().Click();

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(1);
                VerifyNumberPanelContent("12345");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(2);
                VerifyNumberPanelContent("12345");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(3);
                VerifyNumberPanelContent("1More345");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(4);
                VerifyNumberPanelContent("1More456");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(5);
                VerifyNumberPanelContent("1More567");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(6);
                VerifyNumberPanelContent("1More678");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(7);
                VerifyNumberPanelContent("1More789");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(8);
                VerifyNumberPanelContent("1More8910");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(9);
                VerifyNumberPanelContent("1More91011");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(10);
                VerifyNumberPanelContent("1More101112");
            }
        }
Example #4
0
        public void VerifyButtonVisibilitySetInXAMLApplied()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                // Invoke button
                elements.GetCheckIfButtonsHiddenButton().Click();

                Wait.ForIdle();

                // Check result
                Verify.AreEqual("Passed", elements.GetCheckIfButtonsHiddenLabel().GetText(), "Not all buttons where hidden and as such, the test result was not 'Passed'");
            }
        }
Example #5
0
        public void AutoDisplayChangingPageTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();
                VerifyPageChanged(0);

                SetAutoDisplayMode();
                VerifyAutoDisplayMode();

                SelectValueInPagerComboBox(2);
                VerifyPageChanged(2);

                SelectValueInPagerComboBox(4);
                VerifyPageChanged(4);

                SelectValueInPagerComboBox(0);
                VerifyPageChanged(0);
            }
        }
Example #6
0
        public void NumberBoxInfinityModeTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();
                VerifyPageChanged(0);
                elements.GetEnterInfinityModeButton().Click();

                SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
                VerifyPageChanged(2);

                SendValueToNumberBox("1");
                VerifyPageChanged(0);

                SendValueToNumberBox("5");
                VerifyPageChanged(4);

                SendValueToNumberBox("2");
                VerifyPageChanged(1);

                SendValueToNumberBox("100");
                Verify.AreEqual("100", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(99);

                SendValueToNumberBox("10000");
                Verify.AreEqual("10000", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(9999);

                SendValueToNumberBox("-100");
                Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(0);
            }
        }
Example #7
0
        public void ChangingDisplayModeTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();
                SetAutoDisplayMode();
                VerifyAutoDisplayMode();

                SetComboBoxDisplayMode();
                VerifyComboBoxDisplayMode();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                SetAutoDisplayMode();
                VerifyAutoDisplayMode();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                SetComboBoxDisplayMode();
                VerifyComboBoxDisplayMode();

                SetAutoDisplayMode();
                VerifyAutoDisplayMode();

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                ChangeNumberOfPages();
                VerifyNumberOfPages("100");

                SetAutoDisplayMode();
                VerifyAutoDisplayMode();

                ChangeNumberOfPages();
                VerifyNumberOfPages("5");

                VerifyAutoDisplayMode();

                IncrementNumberOfPages(4);
                VerifyNumberOfPages("9");

                VerifyAutoDisplayMode();

                IncrementNumberOfPages(1);
                VerifyNumberOfPages("10");

                VerifyAutoDisplayMode();

                IncrementNumberOfPages(1);
                VerifyNumberOfPages("11");

                VerifyAutoDisplayMode();
            }
        }
Example #8
0
        public void NumberPanelChangingPageTest2()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                VerifyPageChanged(0);

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(1);
                VerifyNumberPanelContent("12345");

                InputHelper.LeftClick(elements.GetLastPageButton());
                VerifyPageChanged(4);
                VerifyNumberPanelContent("12345");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(3);
                VerifyNumberPanelContent("12345");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(2);
                VerifyNumberPanelContent("12345");

                ChangeNumberOfPages();
                VerifyNumberOfPages("100");

                InputHelper.LeftClick(elements.GetFirstPageButton());
                VerifyPageChanged(0);
                VerifyNumberPanelContent("12345More100");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(1);
                VerifyNumberPanelContent("12345More100");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(2);
                VerifyNumberPanelContent("12345More100");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(3);
                VerifyNumberPanelContent("12345More100");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(4);
                VerifyNumberPanelContent("1More456More100");

                InputHelper.LeftClick(elements.GetNextPageButton());
                VerifyPageChanged(5);
                VerifyNumberPanelContent("1More567More100");

                InputHelper.LeftClick(elements.GetLastPageButton());
                VerifyPageChanged(99);

                VerifyNumberPanelContent("1More96979899100");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(98);
                VerifyNumberPanelContent("1More96979899100");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(97);
                VerifyNumberPanelContent("1More96979899100");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(96);
                VerifyNumberPanelContent("1More96979899100");

                InputHelper.LeftClick(elements.GetPreviousPageButton());
                VerifyPageChanged(95);
                VerifyNumberPanelContent("1More959697More100");
            }
        }
Example #9
0
        public void NumberPanelChangingPageTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                VerifyPageChanged(0);

                SetNumberPanelDisplayMode();
                VerifyNumberPanelDisplayMode();

                SelectPageInNumberPanel(2);
                VerifyPageChanged(1);
                VerifyNumberPanelContent("12345");

                SelectPageInNumberPanel(5);
                VerifyPageChanged(4);
                VerifyNumberPanelContent("12345");

                SelectPageInNumberPanel(4);
                VerifyPageChanged(3);
                VerifyNumberPanelContent("12345");

                SelectPageInNumberPanel(3);
                VerifyPageChanged(2);
                VerifyNumberPanelContent("12345");

                ChangeNumberOfPages();
                VerifyNumberOfPages("100");


                SelectPageInNumberPanel(1);
                VerifyPageChanged(0);
                VerifyNumberPanelContent("12345More100");

                SelectPageInNumberPanel(2);
                VerifyPageChanged(1);
                VerifyNumberPanelContent("12345More100");

                SelectPageInNumberPanel(3);
                VerifyPageChanged(2);
                VerifyNumberPanelContent("12345More100");

                SelectPageInNumberPanel(4);
                VerifyPageChanged(3);
                VerifyNumberPanelContent("12345More100");

                SelectPageInNumberPanel(5);
                VerifyPageChanged(4);
                VerifyNumberPanelContent("1More456More100");

                SelectPageInNumberPanel(6);
                VerifyPageChanged(5);
                VerifyNumberPanelContent("1More567More100");

                SelectPageInNumberPanel(100);
                VerifyPageChanged(99);

                VerifyNumberPanelContent("1More96979899100");

                SelectPageInNumberPanel(99);
                VerifyPageChanged(98);
                VerifyNumberPanelContent("1More96979899100");

                SelectPageInNumberPanel(98);
                VerifyPageChanged(97);
                VerifyNumberPanelContent("1More96979899100");

                SelectPageInNumberPanel(97);
                VerifyPageChanged(96);
                VerifyNumberPanelContent("1More96979899100");

                SelectPageInNumberPanel(96);
                VerifyPageChanged(95);
                VerifyNumberPanelContent("1More959697More100");
            }
        }
        protected void ButtonVisibilityOptionsTest(string buttonNamePrefix)
        {
            SetButtonVisibilityModeFunction SetButtonVisibilityMode;
            UIObject buttonBeingTested;

            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();
                switch (buttonNamePrefix)
                {
                case "First":
                    SetButtonVisibilityMode = SetFirstPageButtonVisibilityMode;
                    buttonBeingTested       = elements.GetFirstPageButton();
                    break;

                case "Previous":
                    SetButtonVisibilityMode = SetPreviousPageButtonVisibilityMode;
                    buttonBeingTested       = elements.GetPreviousPageButton();
                    break;

                case "Next":
                    SetButtonVisibilityMode = SetNextPageButtonVisibilityMode;
                    buttonBeingTested       = elements.GetNextPageButton();
                    break;

                case "Last":
                    SetButtonVisibilityMode = SetLastPageButtonVisibilityMode;
                    buttonBeingTested       = elements.GetLastPageButton();
                    break;

                default:
                    Log.Warning("This test is being skipped because the button string was not one of these four strings: [First, Previous, Next, Last]");
                    return;
                }

                VerifyPageChanged(0);

                foreach (ButtonVisibilityModes visMode in Enum.GetValues(typeof(ButtonVisibilityModes)))
                {
                    SetButtonVisibilityMode(visMode);
                    GetLastPage();
                    // If we're not on the first page then navigate to the first page.
                    if (GetCurrentPageAsInt() != 0)
                    {
                        SelectValueInPagerComboBox(0);
                        VerifyPageChanged(0);
                    }

                    var expectedVisibility = ((visMode == ButtonVisibilityModes.None) ||
                                              (visMode == ButtonVisibilityModes.HiddenOnEdge &&
                                               (buttonNamePrefix == "First" || buttonNamePrefix == "Previous"))) ? Visibility.Collapsed : Visibility.Visible;

                    var expectedIsEnableValue = (buttonNamePrefix == "First" || buttonNamePrefix == "Previous") ? false : true;

                    VerifyButton(buttonBeingTested, expectedVisibility, expectedIsEnableValue);

                    SelectValueInPagerComboBox(1);
                    VerifyPageChanged(1);

                    expectedVisibility    = (visMode == ButtonVisibilityModes.None) ? Visibility.Collapsed : Visibility.Visible;
                    expectedIsEnableValue = true;

                    VerifyButton(buttonBeingTested, expectedVisibility, expectedIsEnableValue);

                    SelectValueInPagerComboBox(GetLastPageAsInt() - 1);
                    VerifyPageChanged(GetLastPageAsInt() - 1);

                    expectedVisibility = ((visMode == ButtonVisibilityModes.None) ||
                                          (visMode == ButtonVisibilityModes.HiddenOnEdge &&
                                           (buttonNamePrefix == "Next" || buttonNamePrefix == "Last"))) ? Visibility.Collapsed : Visibility.Visible;

                    expectedIsEnableValue = (buttonNamePrefix == "Next" || buttonNamePrefix == "Last") ? false : true;

                    VerifyButton(buttonBeingTested, expectedVisibility, expectedIsEnableValue);
                }
            }
        }