public void PreviousPageButtonChangingPageTest() { using (var setup = new TestSetupHelper("Pager Tests")) { elements = new PagerTestsPageElements(); VerifyPageChangedEventOutput(0); InputHelper.LeftClick(elements.GetNextPageButton()); previousPage = 1; InputHelper.LeftClick(elements.GetPreviousPageButton()); VerifyPageChangedEventOutput(0); InputHelper.LeftClick(elements.GetLastPageButton()); previousPage = 4; InputHelper.LeftClick(elements.GetPreviousPageButton()); VerifyPageChangedEventOutput(3); InputHelper.LeftClick(elements.GetPreviousPageButton()); VerifyPageChangedEventOutput(2); InputHelper.LeftClick(elements.GetPreviousPageButton()); VerifyPageChangedEventOutput(1); InputHelper.LeftClick(elements.GetPreviousPageButton()); VerifyPageChangedEventOutput(0); } }
public void NextPageButtonChangingPageTest() { using (var setup = new TestSetupHelper("Pager Tests")) { elements = new PagerTestsPageElements(); VerifyPageChanged(0); InputHelper.LeftClick(elements.GetNextPageButton()); VerifyPageChanged(1); InputHelper.LeftClick(elements.GetNextPageButton()); VerifyPageChanged(2); InputHelper.LeftClick(elements.GetNextPageButton()); VerifyPageChanged(3); InputHelper.LeftClick(elements.GetNextPageButton()); VerifyPageChanged(4); } }
void VerifyButton(UIObject button, Visibility expectedVisibility, bool shouldBeEnabled) { if (button == elements.GetFirstPageButton()) { VerifyFirstPageButtonVisibility(expectedVisibility); VerifyFirstPageButtonIsEnabled(shouldBeEnabled); } else if (button == elements.GetPreviousPageButton()) { VerifyPreviousPageButtonVisibility(expectedVisibility); VerifyPreviousPageButtonIsEnabled(shouldBeEnabled); } else if (button == elements.GetNextPageButton()) { VerifyNextPageButtonVisibility(expectedVisibility); VerifyNextPageButtonIsEnabled(shouldBeEnabled); } else if (button == elements.GetLastPageButton()) { VerifyLastPageButtonVisibility(expectedVisibility); VerifyLastPageButtonIsEnabled(shouldBeEnabled); } }
void ButtonVisibilityOptionsTest(string buttonNamePrefix) { SetButtonVisibilityModeFunction SetButtonVisibilityMode; UIObject buttonBeingTested; using (var setup = new TestSetupHelper("Pager Tests")) { elements = new PagerTestsPageElements(); 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; } VerifyPageChangedEventOutput(0); foreach (ButtonVisibilityModes visMode in Enum.GetValues(typeof(ButtonVisibilityModes))) { SetButtonVisibilityMode(visMode); // If we're not on the first page then navigate to the first page. if (previousPage != 0) { SelectValueInPagerComboBox(0); VerifyPageChangedEventOutput(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); VerifyPageChangedEventOutput(1); expectedVisibility = (visMode == ButtonVisibilityModes.None) ? Visibility.Collapsed : Visibility.Visible; expectedIsEnableValue = true; VerifyButton(buttonBeingTested, expectedVisibility, expectedIsEnableValue); SelectValueInPagerComboBox(4); VerifyPageChangedEventOutput(4); 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); } } }
public void NumberPanelChangingPageTest2() { using (var setup = new TestSetupHelper("Pager Tests")) { elements = new PagerTestsPageElements(); 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"); } }