public void CanSelectNavigationViewItemWithChildren() { var testScenarios = RegressionTestScenario.BuildHierarchicalNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("SelectedItemLabel")); Log.Comment("Verify that first menu item is not expanded."); var firstItem = FindElement.ByName("Menu Item 6 (Selectable)"); var childItem = FindElement.ByName("Menu Item 7 (Selectable)"); Verify.IsNull(childItem); Verify.AreEqual(displayModeTextBox.DocumentText, "uninitialized"); InputHelper.LeftClick(firstItem); Wait.ForIdle(); var getSelectItemButton = new Button(FindElement.ByName("GetSelectedItemLabelButton")); getSelectItemButton.Invoke(); Wait.ForIdle(); childItem = FindElement.ByName("Menu Item 7 (Selectable)"); Verify.IsNotNull(childItem, "Child item should be visible after expanding parent item."); Verify.AreEqual(displayModeTextBox.DocumentText, "Menu Item 6 (Selectable)"); } } }
public void HomeEndNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Skipping: Home/End behavior only works in RS2"); return; } UIObject firstItem = FindElement.ByName("Home"); UIObject appsItem = FindElement.ByName("Apps"); UIObject lastItem = FindElement.ByName("Integer"); Log.Comment("Make sure something inside the ListView other than the first item has input focus"); appsItem.SetFocus(); Wait.ForIdle(); Verify.IsFalse(firstItem.HasKeyboardFocus); Log.Comment("Verify the Home key puts focus on the first menu item"); KeyboardHelper.PressKey(Key.Home); Wait.ForIdle(); Verify.IsTrue(firstItem.HasKeyboardFocus); Log.Comment("Verify the End key puts focus on the last menu item"); KeyboardHelper.PressKey(Key.End); Wait.ForIdle(); Verify.IsTrue(lastItem.HasKeyboardFocus); } } }
public void DisplayModeChangeSelectionEventTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone3)) { Log.Warning("Test is disabled on RS2 and earlier because SplitView lacks the requisite events."); return; } Button clearSelectedItem = new Button(FindElement.ById("ClearSelectionChangeIndicatorButton")); TextBlock selectionRaisedIndicator = new TextBlock(FindElement.ById("SelectionChangedRaised")); ComboBox selectedItem = new ComboBox(FindElement.ById("SelectedItemCombobox")); selectedItem.SelectItemByName("Settings"); Verify.AreEqual("True", selectionRaisedIndicator.GetText()); ComboBox displayMode = new ComboBox(FindElement.ById("PaneDisplayModeCombobox")); clearSelectedItem.InvokeAndWait(); displayMode.SelectItemByName("Top"); Verify.AreEqual("False", selectionRaisedIndicator.GetText()); Wait.ForIdle(); displayMode.SelectItemByName("Left"); Wait.ForIdle(); Verify.AreEqual("False", selectionRaisedIndicator.GetText()); } } }
public void SettingsItemInvokeTest() { var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { UIObject settingsItem = testScenario.IsLeftNavTest ? FindElement.ByName("Settings") : FindElement.ByName("SettingsTopNavPaneItem"); settingsItem.SetFocus(); Wait.ForIdle(); AutomationElement ae = AutomationElement.FocusedElement; InvokePattern invokePattern = ae.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern; Log.Comment("Invoking settings"); invokePattern.Invoke(); Wait.ForIdle(); Log.Comment("Verify settings is selected"); TextBlock header = new TextBlock(FindElement.ByName("Settings as header")); Verify.AreEqual("Settings as header", header.DocumentText); } } }
public void PaneOpenCloseEventsTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone3)) { Log.Warning("Test is disabled on RS2 and earlier because SplitView lacks the requisite events."); return; } TextBlock lastIngEventTextblock = new TextBlock(FindElement.ByName("LastIngEventText")); TextBlock lastEdEventTextblock = new TextBlock(FindElement.ByName("LastEdEventText")); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); togglePaneButton.Invoke(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual("PaneClosed event fired", lastEdEventTextblock.DocumentText); Verify.AreEqual("PaneClosing event fired", lastIngEventTextblock.DocumentText); togglePaneButton.Invoke(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual("PaneOpened event fired", lastEdEventTextblock.DocumentText); Verify.AreEqual("PaneOpening event fired", lastIngEventTextblock.DocumentText); } } }
public void SettingsItemClickTest() { var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (testScenario.IsLeftNavTest) { Log.Comment("Bring Settings into view."); FindElement.ByName <Button>("BringSettingsIntoViewButton").Invoke(); Wait.ForIdle(); } UIObject settingsItem = FindElement.ByName("Settings"); settingsItem.SetFocus(); Wait.ForIdle(); Log.Comment("Click settings"); settingsItem.Click(); Wait.ForIdle(); Log.Comment("Verify settings is selected"); TextBlock header = new TextBlock(FindElement.ByName("Settings as header")); Verify.AreEqual("Settings as header", header.DocumentText); } } }
public void MenuItemInvokedTest() { var testScenarios = RegressionTestScenario.BuildTopNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { Log.Comment("Click games item"); UIObject menuItem = FindElement.ByName("Games"); InputHelper.LeftClick(menuItem); Wait.ForIdle(); TextBlock header = new TextBlock(FindElement.ByName("Games as header")); Verify.AreEqual("Games as header", header.DocumentText); Log.Comment("Click music item"); menuItem = FindElement.ByName("Music"); InputHelper.LeftClick(menuItem); Wait.ForIdle(); header = new TextBlock(FindElement.ByName("Music as header")); Verify.AreEqual("Music as header", header.DocumentText); Log.Comment("Click settings item"); menuItem = testScenario.IsLeftNavTest ? FindElement.ByName("Settings") : FindElement.ByName("SettingsTopNavPaneItem"); InputHelper.LeftClick(menuItem); Wait.ForIdle(); header = new TextBlock(FindElement.ByName("Settings as header")); Verify.AreEqual("Settings as header", header.DocumentText); Log.Comment("Move mouse to upper left to ensure that tooltip on settings closes."); TestEnvironment.Application.CoreWindow.MovePointer(0, 0); Wait.ForIdle(); } } }
public void LightDismissTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2)) { Log.Warning("Test is disabled on RS1 and older"); return; } CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); SetNavViewWidth(ControlWidth.Medium); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); PaneOpenCloseTestCaseRetry(3, () => { KeyboardHelper.PressKey(Key.Backspace, ModifierKey.Windows); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "Verify Windows+Back light dismisses the pane"); }); isPaneOpenCheckBox.Toggle(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); PaneOpenCloseTestCaseRetry(3, () => { KeyboardHelper.PressKey(Key.Left, ModifierKey.Alt); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "Verify Alt+Left light dismisses the pane"); }); isPaneOpenCheckBox.Toggle(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); } } }
public void MenuItemAutomationSelectionTest() { var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { UIObject firstItem = FindElement.ByName("Home"); UIObject secondItem = FindElement.ByName("Apps"); UIObject thirdItem = FindElement.ByName("Games"); Log.Comment("Verify the second item is not already selected"); Verify.IsFalse(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); firstItem.SetFocus(); AutomationElement firstItemAE = AutomationElement.FocusedElement; SelectionItemPattern firstItemSIP = firstItemAE.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern; Log.Comment("Move focus to the second item by pressing down(left nav)/right(right nav) arrow once"); var key = Key.Right; if (testScenario.IsLeftNavTest) { key = Key.Down; } KeyboardHelper.PressKey(key); Wait.ForIdle(); Verify.IsTrue(secondItem.HasKeyboardFocus); AutomationElement secondItemAE = AutomationElement.FocusedElement; SelectionItemPattern secondItemSIP = secondItemAE.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern; Log.Comment("Select the second item using SelectionItemPattern.Select and verify"); secondItemSIP.Select(); Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); Log.Comment("Deselect the second item"); firstItemSIP.Select(); Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(firstItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); Log.Comment("Select the second item using SelectionItemPattern.AddToSelection and verify"); secondItemSIP.AddToSelection(); Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); ClickClearSelectionButton(); Log.Comment("second item is unselected"); Verify.IsFalse(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); } } }
public void PaneOpenCloseTestPartTwo() // Otherwise this test will exceed the 30 second timeout in catgates chk runs { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); // On phone, the pane will initially be in the closed compact state, so open it before // proceeding with the test. if (isPaneOpenCheckBox.ToggleState == ToggleState.Off) { using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } } Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); Button navButton = new Button(FindElement.ById("TogglePaneButton")); Log.Comment("Verify that after explicitly closing the nav pane, changing display mode doesn't reopen it"); navButton.Invoke(); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after explicitly closing the nav pane & changing display mode"); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Log.Comment("Verify that selecting a menu item in minimal display mode opens the pane"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); navButton.Invoke(); Wait.ForIdle(); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True after selecting a menu item in minimal display mode"); Log.Comment("Invoke Music item to close the pane"); var music = new Button(FindElement.ByName("Music")); music.Click(); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after invoking Music item"); } } }
public void SelectionFollowFocusTest() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Test is disabled on RS1 and earlier because SingleSelectionFollowFocus on RS2."); return; } var testScenarios = RegressionTestScenario.BuildTopNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { Log.Comment("Check SelectionFollowFocus"); CheckBox selectionFollowFocusCheckbox = new CheckBox(FindElement.ById("SelectionFollowFocusCheckbox")); selectionFollowFocusCheckbox.Check(); Wait.ForIdle(); UIObject firstItem = FindElement.ByName("Apps"); UIObject secondItem = FindElement.ByName("Games"); Log.Comment("Verify the second item is not already selected"); Verify.IsFalse(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); firstItem.Click(); Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(firstItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); Log.Comment("Move focus to the second item by pressing down(left nav)/right(right nav) arrow once"); var key = Key.Right; if (testScenario.IsLeftNavTest) { key = Key.Down; } KeyboardHelper.PressKey(key); Wait.ForIdle(); Log.Comment("Verify second item is selected and has focus because of SelectionFollowFocus"); Verify.IsTrue(secondItem.HasKeyboardFocus); Verify.IsTrue(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); ClickClearSelectionButton(); Log.Comment("second item is unselected"); Verify.IsFalse(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); } } }
public void PaneOpenCloseTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); // On phone, the pane will initially be in the closed compact state, so open it before // proceeding with the test. if (isPaneOpenCheckBox.ToggleState == ToggleState.Off) { using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } } Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); Button navButton = new Button(FindElement.ById("TogglePaneButton")); Log.Comment("Verify that clicking the navigation button closes the nav pane"); navButton.Invoke(); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after clicking the navigation button"); Log.Comment("Verify that clicking the navigation button opens the nav pane"); navButton.Invoke(); Wait.ForIdle(); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True after clicking the navigation button"); Log.Comment("Verify that decreasing the width of the control from expanded to compact closes the pane"); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after decreasing the width of the control from expanded to compact"); Log.Comment("Verify that increasing the width of the control from compact to expanded opens the pane"); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True after increasing the width of the control from compact to expanded"); } } }
public void VerifyPaneTitlePresentAndUpdates() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { TextBlock paneTitleTextBlock = new TextBlock(FindElement.ByName("NavView Test")); Button changePaneTitleButton = new Button(FindElement.ByName("ChangePaneTitleButton")); changePaneTitleButton.Invoke(); Wait.ForIdle(); Verify.AreEqual("", paneTitleTextBlock.DocumentText, "Verify that the pane title is empty"); } } }
public void VerifyDeselectionDisabled() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { UIObject homeItem = FindElement.ByName("Home"); Verify.IsNotNull(homeItem); Verify.IsTrue(Convert.ToBoolean(homeItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); KeyboardHelper.PressDownModifierKey(ModifierKey.Control); homeItem.Click(); // Explicitly testing ctrl+click here Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(homeItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); KeyboardHelper.ReleaseModifierKey(ModifierKey.Control); } } }
[TestMethod] // Bug 18159731 public void PaneOpenForceCloseTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); Button navButton = new Button(FindElement.ById("TogglePaneButton")); Log.Comment("Verify that clicking the navigation button closes the nav pane"); navButton.Invoke(); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after clicking the navigation button"); TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox")); Log.Comment("Verify that decreasing the width of the control from expanded to Narrow and force closed pane"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after decreasing the width of the control from expanded to Narrow"); Verify.AreEqual(minimal, displayModeTextBox.DocumentText); Log.Comment("Verify that decreasing the width of the control from Narrow to compact and force closed pane"); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after decreasing the width of the control from Narrow to compact"); Verify.AreEqual(compact, displayModeTextBox.DocumentText); Log.Comment("Verify that increasing the width of the control from compact to expanded and force closed pane"); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after increasing the width of the control from compact to expanded"); Verify.AreEqual(expanded, displayModeTextBox.DocumentText); } } }
public void PaneClosedUponLaunch() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Navigation Minimal Test" })) { Log.Comment("Verify that NavigationView with DisplayMode set to 'Auto' and a narrow width does not display pane on load."); CheckBox isAutoPaneOpenCheckBox = new CheckBox(FindElement.ById("IsAutoPaneOpenCheckBox")); Wait.ForIdle(); Verify.IsTrue(isAutoPaneOpenCheckBox.ToggleState == ToggleState.Off); Log.Comment("Verify that NavigationView with DisplayMode set to 'LeftMinimal' does not display pane on load."); CheckBox isLeftMinimalPaneOpenCheckBox = new CheckBox(FindElement.ById("IsLeftMinimalPaneOpenCheckBox")); Verify.IsTrue(isLeftMinimalPaneOpenCheckBox.ToggleState == ToggleState.Off); Log.Comment("Verify that NavigationView with DisplayMode set to 'LeftCompact' does not display pane on load."); CheckBox isLeftCompactPaneOpenCheckBox = new CheckBox(FindElement.ById("IsLeftCompactPaneOpenCheckBox")); Verify.IsTrue(isLeftCompactPaneOpenCheckBox.ToggleState == ToggleState.Off); } } }
public void BackRequestedTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { TextBlock textBlock = new TextBlock(FindElement.ByName("BackRequestedStateTextBlock")); Button button = new Button(FindElement.ByName("NavigationViewBackButton")); CheckBox checkBox = new CheckBox(FindElement.ByName("BackButtonEnabledCheckbox")); Verify.AreEqual("Test Not Started [2]", textBlock.DocumentText); checkBox.Check(); Wait.ForIdle(); button.Invoke(); Wait.ForIdle(); Verify.AreEqual("Back was requested", textBlock.DocumentText); } } }
public void PaneNotOpeningTopMode() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone4)) { Log.Warning("Test is disabled on pre-RS4 because NavigationView Gamepad interaction is not supported pre-RS4"); return; } using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView TopNav Test" })) { CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be false"); GamepadHelper.PressButton(FindElement.ById("NavView"), GamepadButton.View); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True after increasing the width of the control from compact to expanded"); } } }
public void TabNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { // TODO: Update RS3 and below tab behavior to match RS4+ if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4)) { Log.Warning("Test is disabled because the repeater tab behavior is currently different on RS3 and below."); return; } SetNavViewWidth(ControlWidth.Wide); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); UIObject searchBox = FindElement.ByNameAndClassName("PaneAutoSuggestBox", "TextBox"); UIObject settingsItem = FindElement.ByName("Settings"); VerifyTabNavigationWithoutMenuItemSelected(); VerifyTabNavigationWithMenuItemSelected(); void VerifyTabNavigationWithoutMenuItemSelected() { Log.Comment("Verify Tab navigation without a selected menu item"); // Clear any item selection var clearSelectedItemButton = new Button(FindElement.ByName("ClearSelectedItemButton")); clearSelectedItemButton.Click(); Wait.ForIdle(); Verify.AreEqual("null", GetSelectedItem()); UIObject firstMenuItem = FindElement.ByName("Home"); UIObject lastMenuItem = FindElement.ByName("HasChildItem"); // Set focus on the pane's toggle button. togglePaneButton.SetFocus(); Wait.ForIdle(); Log.Comment("Verify that pressing tab while TogglePaneButton has focus moves to the search box"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing tab while the search box has focus moves to the first menu item"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(firstMenuItem.HasKeyboardFocus); Log.Comment("Verify that pressing tab thrice more will move focus to the settings item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 3); Wait.ForIdle(); Verify.IsTrue(settingsItem.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab thrice will move focus to the last menu item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 3); Wait.ForIdle(); Verify.IsTrue(lastMenuItem.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the search box"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the TogglePaneButton"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); } void VerifyTabNavigationWithMenuItemSelected() { Log.Comment("Verify Tab navigation with a selected menu item"); // Select a menu item (preferably not the first or last menu item) UIObject thirdMenuItem = FindElement.ByName("Games"); var selectedItemComboBox = new ComboBox(FindElement.ById("SelectedItemCombobox")); selectedItemComboBox.SelectItemByName("Games"); Wait.ForIdle(); Verify.IsTrue(Convert.ToBoolean(thirdMenuItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected")))); // Set focus on the pane's toggle button. togglePaneButton.SetFocus(); Wait.ForIdle(); Log.Comment("Verify that pressing tab while TogglePaneButton has focus moves to the search box"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing tab while the search box has focus moves to the selected menu item"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(thirdMenuItem.HasKeyboardFocus); Log.Comment("Verify that pressing tab thrice more will move focus to the settings item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 3); Wait.ForIdle(); Verify.IsTrue(settingsItem.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab thrice will move focus to the selected menu item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 3); Wait.ForIdle(); Verify.IsTrue(thirdMenuItem.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the search box"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the TogglePaneButton"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); } } string GetSelectedItem() { return(FindElement.ByName("SelectionChangedItemType").GetText()); } } }
public void VerifyLightDismissDoesntSendDuplicateEvents() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone3)) { Log.Warning("Test is disabled on RS2 and older due to lack of SplitView events"); return; } CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); SetNavViewWidth(ControlWidth.Medium); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); PaneOpenCloseTestCaseRetry(3, () => { // recover from the exception if needed if (isPaneOpenCheckBox.ToggleState != ToggleState.Off) { using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Closed); } Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Log.Comment("Reset the event count"); new Button(FindElement.ById("ClosingEventCountResetButton")).Invoke(); Wait.ForIdle(); Log.Comment("Open the pane"); using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); var closingCounts = new Edit(FindElement.ByName("ClosingEventCountTextBlock")); var expectedString = "1-1"; // trigger a light dismiss KeyboardHelper.PressKey(Key.Left, ModifierKey.Alt); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Verify.AreEqual(expectedString, closingCounts.GetText()); }); } } }
public void PaneTabNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Skipping: Correct pane tab navigation only works in RS2 and above"); return; } SetNavViewWidth(ControlWidth.Wide); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); UIObject firstItem = FindElement.ByName("Home"); UIObject settingsItem = FindElement.ByName("Settings"); UIObject nextTabTarget = FindElement.ByName("WidthComboBox"); CheckBox autoSuggestCheckBox = new CheckBox(FindElement.ByName("AutoSuggestCheckbox")); autoSuggestCheckBox.Uncheck(); Wait.ForIdle(); Log.Comment("Verify that in Expanded mode, tab navigation can leave the pane"); firstItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Wait.RetryUntilEvalFuncSuccessOrTimeout( () => { return(togglePaneButton.HasKeyboardFocus); }, retryTimoutByMilliseconds: 3000 ); Log.Comment("Verify pressing shift-tab from the first menu item goes to the toggle button"); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); settingsItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Log.Comment("Verify pressing tab from settings goes to the first tab stop in the content area"); Verify.IsTrue(nextTabTarget.HasKeyboardFocus); SetNavViewWidth(ControlWidth.Medium); CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); isPaneOpenCheckBox.Check(); Wait.ForIdle(); Log.Comment("Verify that in an overlay mode, tab navigation cannot leave the pane while the pane is open"); firstItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Log.Comment("Verify pressing shift-tab from the first menu item goes to settings"); Verify.IsTrue(settingsItem.HasKeyboardFocus); settingsItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Log.Comment("Verify pressing tab from settings goes to the first menu item"); Verify.IsTrue(firstItem.HasKeyboardFocus); } } }
public void ArrowKeyNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { //TODO: Update RS3 and below tab behavior to match RS4+ if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4)) { Log.Warning("Test is disabled because the repeater tab behavior is current different rs3 and below."); return; } SetNavViewWidth(ControlWidth.Wide); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); togglePaneButton.SetFocus(); Wait.ForIdle(); // Grab references to all the menu items in the test UI UIObject searchBox = FindElement.ByNameAndClassName("PaneAutoSuggestBox", "TextBox"); UIObject item1 = FindElement.ByName("Home"); UIObject item2 = FindElement.ByName("Apps"); UIObject item3 = FindElement.ByName("Games"); UIObject item4 = FindElement.ByName("Music"); UIObject item5 = FindElement.ByName("Movies"); UIObject item6 = FindElement.ByName("TV"); UIObject settingsItem = FindElement.ByName("Settings"); Log.Comment("Verify that tab from the TogglePaneButton goes to the search box"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that tab from search box goes to the first item"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(item1.HasKeyboardFocus); Log.Comment("Verify that down arrow can navigate through all items"); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item2.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item3.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item4.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item5.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item6.HasKeyboardFocus); Log.Comment("Verify that tab twice from the last menu item goes to the settings item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 2); Wait.ForIdle(); Verify.IsTrue(settingsItem.HasKeyboardFocus); // TODO: Re-enable test part and remove workaround once saving tab state is fixed Log.Comment("Move Focus to TV item"); item6.SetFocus(); Wait.ForIdle(); //Log.Comment("Verify that shift+tab twice from the settings item goes to the last menu item"); //KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 2); //Wait.ForIdle(); //Verify.IsTrue(item6.HasKeyboardFocus); Log.Comment("Verify that up arrow can navigate through all items"); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item5.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item4.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item3.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item2.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item1.HasKeyboardFocus); Log.Comment("Verify that shift+tab from the first menu item goes to the search box"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that shift+tab from the search box goes to the TogglePaneButton"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift); Wait.ForIdle(); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); } } }
public void TabNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { //TODO: Update RS3 and below tab behavior to match RS4+ if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4)) { Log.Warning("Test is disabled because the repeater tab behavior is current different rs3 and below."); return; } SetNavViewWidth(ControlWidth.Wide); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); UIObject searchBox = FindElement.ByNameAndClassName("PaneAutoSuggestBox", "TextBox"); UIObject firstItem = FindElement.ByName("Home"); UIObject settingsItem = FindElement.ByName("Settings"); togglePaneButton.SetFocus(); Wait.ForIdle(); Log.Comment("Verify that pressing tab while TogglePaneButton has focus moves to the search box"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing tab while the search box has focus moves to the first menu item"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(firstItem.HasKeyboardFocus); Log.Comment("Verify that pressing tab twice more will move focus to the settings item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 2); Wait.ForIdle(); Verify.IsTrue(settingsItem.HasKeyboardFocus); // TODO: Re-enable test part and remove workaround once saving tab state is fixed Log.Comment("Move Focus to first item"); firstItem.SetFocus(); Wait.ForIdle(); //Log.Comment("Verify that pressing SHIFT+tab twice will move focus to the first menu item"); //KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 2); //Wait.ForIdle(); //Verify.IsTrue(firstItem.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the search box"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that pressing SHIFT+tab will move focus to the TogglePaneButton"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); } } }
public void ArrowKeyNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { //TODO: Update RS3 and below tab behavior to match RS4+ if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4)) { Log.Warning("Test is disabled because the repeater tab behavior is current different rs3 and below."); return; } SetNavViewWidth(ControlWidth.Wide); // Clear any item selection var clearSelectedItemButton = new Button(FindElement.ByName("ClearSelectedItemButton")); clearSelectedItemButton.Click(); Wait.ForIdle(); Verify.AreEqual("null", GetSelectedItem()); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); togglePaneButton.SetFocus(); Wait.ForIdle(); // Grab references to all the menu items in the test UI UIObject searchBox = FindElement.ByNameAndClassName("PaneAutoSuggestBox", "TextBox"); UIObject item1 = FindElement.ByName("Home"); UIObject item2 = FindElement.ByName("Apps"); UIObject item3 = FindElement.ByName("Games"); UIObject item4 = FindElement.ByName("Music"); UIObject item5 = FindElement.ByName("Movies"); UIObject item6 = FindElement.ByName("TV"); UIObject item7 = FindElement.ByName("Volume"); UIObject item8 = FindElement.ByName("Integer"); UIObject item9 = FindElement.ByName("HasChildItem"); UIObject settingsItem = FindElement.ByName("Settings"); Log.Comment("Verify that tab from the TogglePaneButton goes to the search box"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that tab from search box goes to the first item"); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Verify.IsTrue(item1.HasKeyboardFocus); Log.Comment("Verify that down arrow can navigate through all items"); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item2.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item3.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item4.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item5.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item6.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item7.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item8.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Down); Wait.ForIdle(); Verify.IsTrue(item9.HasKeyboardFocus); Log.Comment("Verify that tab thrice from the last menu item goes to the settings item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 3); Wait.ForIdle(); Verify.IsTrue(settingsItem.HasKeyboardFocus); Log.Comment("Verify that shift+tab thrice from the settings item goes to the last menu item"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 3); Wait.ForIdle(); Verify.IsTrue(item9.HasKeyboardFocus); Log.Comment("Verify that up arrow can navigate through all items"); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item8.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item7.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item6.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item5.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item4.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item3.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item2.HasKeyboardFocus); KeyboardHelper.PressKey(Key.Up); Wait.ForIdle(); Verify.IsTrue(item1.HasKeyboardFocus); Log.Comment("Verify that shift+tab from the first menu item goes to the search box"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift); Wait.ForIdle(); Verify.IsTrue(searchBox.HasKeyboardFocus); Log.Comment("Verify that shift+tab from the search box goes to the TogglePaneButton"); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift); Wait.ForIdle(); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); } string GetSelectedItem() { return(FindElement.ByName("SelectionChangedItemType").GetText()); } } }