Esempio n. 1
0
        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();
                }
            }
        }
Esempio n. 2
0
        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"))));
                }
            }
        }