Exemple #1
0
 protected virtual IHScrollBar FindHorizontalBar(FindElement findElement) {
     AutomationElement horizontalScrollElement =
         findElement(
             AutomationSearchCondition.ByAutomationId(UIItemIdAppXmlConfiguration.Instance.HorizontalScrollBar).OfControlType(
                 ControlType.ScrollBar));
     if (horizontalScrollElement == null) {
         return new NullHScrollBar();
     }
     return new HScrollBar(horizontalScrollElement, actionListener, hScrollBarButtonAutomationIds);
 }
Exemple #2
0
 protected virtual IVScrollBar FindVerticalBar(FindElement findElement) {
     AutomationElement verticalScrollElement =
         findElement(
             AutomationSearchCondition.ByAutomationId(UIItemIdAppXmlConfiguration.Instance.VerticalScrollBar).OfControlType(
                 ControlType.ScrollBar));
     if (verticalScrollElement == null) {
         return new NullVScrollBar();
     }
     return new VScrollBar(verticalScrollElement, actionListener, vScrollBarButtonAutomationIds);
 }
        public void TabTest()
        {
            if (PlatformConfiguration.IsDevice(DeviceType.Phone))
            {
                Log.Comment("Skipping tests on phone, because menubar is not supported.");
                return;
            }
            using (var setup = new TestSetupHelper("MenuBar Tests"))
            {
                var firstButton = FindElement.ByName <Button>("FirstButton");
                var fileButton  = FindElement.ById <Button>("FileItem");

                firstButton.SetFocus();
                Wait.ForIdle();

                Log.Comment("Verify that pressing tab from previous control goes to the File item");
                KeyboardHelper.PressKey(Key.Tab);
                Wait.ForIdle();

                Verify.AreEqual(true, fileButton.HasKeyboardFocus);
            }
        }
        public void HandleItemCloseRequestedTest()
        {
            using (var setup = new TestSetupHelper("TabView Tests"))
            {
                UIObject firstTab    = FindElement.ByName("FirstTab");
                Button   closeButton = FindCloseButton(firstTab);
                Verify.IsNotNull(closeButton);

                CheckBox tabCloseRequestedCheckBox = FindElement.ByName <CheckBox>("HandleTabCloseRequestedCheckBox");
                tabCloseRequestedCheckBox.Uncheck();
                CheckBox tabItemCloseRequestedCheckBox = FindElement.ByName <CheckBox>("HandleTabItemCloseRequestedCheckBox");
                tabItemCloseRequestedCheckBox.Check();
                Wait.ForIdle();

                Log.Comment("TabViewItem.CloseRequested should be raised when the close button is pressed.");
                closeButton.InvokeAndWait();

                ElementCache.Refresh();
                firstTab = TryFindElement.ByName("FirstTab");
                Verify.IsNull(firstTab);
            }
        }
Exemple #5
0
        // Logs the InteractionRatio history stored in the ComboBox.Items collection of
        // the ComboBox named "InteractionRatios" then clears those items by invoking the
        // Button named "ResetInteractionRatios" to start a new history from scratch.
        private void LogInteractionRatios()
        {
            Log.Comment("Logging successive interaction ratios");
            UIObject interactionRatioUIObject = FindElement.ById("InteractionRatios");

            Verify.IsNotNull(interactionRatioUIObject);
            ComboBox cmbInteractionRatioUIObject = new ComboBox(interactionRatioUIObject);

            foreach (ComboBoxItem item in cmbInteractionRatioUIObject.AllItems)
            {
                Log.Comment(item.Name);
            }

            Log.Comment("Resetting interaction ratios log");
            UIObject resetInteractionRatiosUIObject = FindElement.ById("ResetInteractionRatios");

            Verify.IsNotNull(resetInteractionRatiosUIObject);
            Button resetInteractionRatiosButton = new Button(resetInteractionRatiosUIObject);

            resetInteractionRatiosButton.Invoke();
            Wait.ForIdle();
        }
Exemple #6
0
        private void LogRefreshVisualizerStates()
        {
            Log.Comment("Logging successive refresh visualizer states");
            UIObject stateUIObject = FindElement.ById("States");

            Verify.IsNotNull(stateUIObject);
            ComboBox cmbStateUIObject = new ComboBox(stateUIObject);

            foreach (ComboBoxItem item in cmbStateUIObject.AllItems)
            {
                Log.Comment(item.Name);
            }

            Log.Comment("Resetting refresh visualizer states log");
            UIObject resetStatesUIObject = FindElement.ById("ResetStates");

            Verify.IsNotNull(resetStatesUIObject);
            Button resetStatesButton = new Button(resetStatesUIObject);

            resetStatesButton.Invoke();
            Wait.ForIdle();
        }
        public void VerifyIconsRespectCompactPaneLength()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView compact pane length test" }))
            {
                var checkMenuItemsButton = FindElement.ByName("CheckMenuItemsOffset");
                var compactpaneCheckbox  = new ComboBox(FindElement.ByName("CompactPaneLengthComboBox"));
                var displayModeToggle    = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));
                var currentStatus        = new CheckBox(FindElement.ByName("MenuItemsCorrectOffset"));

                checkMenuItemsButton.Click();
                Log.Comment("Verifying compact pane length set before loading working");
                Wait.ForIdle();
                compactpaneCheckbox = new ComboBox(FindElement.ByName("CompactPaneLengthComboBox"));
                Verify.IsTrue(currentStatus.ToggleState == ToggleState.On);

                Log.Comment("Verifying changing compact pane length in left mode working");
                compactpaneCheckbox.SelectItemByName("96");
                Wait.ForIdle();

                checkMenuItemsButton.Click();
                Wait.ForIdle();
                compactpaneCheckbox = new ComboBox(FindElement.ByName("CompactPaneLengthComboBox"));
                Verify.IsTrue(currentStatus.ToggleState == ToggleState.On);

                // Check if changing displaymode to top and then changing length gets used correctly
                Log.Comment("Verifying changing compact pane length during top mode working");
                displayModeToggle.SelectItemByName("Top");
                compactpaneCheckbox.SelectItemByName("48");
                Wait.ForIdle();

                displayModeToggle.SelectItemByName("Left");
                Wait.ForIdle();

                checkMenuItemsButton.Click();
                Wait.ForIdle();
                compactpaneCheckbox = new ComboBox(FindElement.ByName("CompactPaneLengthComboBox"));
                Verify.IsTrue(currentStatus.ToggleState == ToggleState.On);
            }
        }
        public void CoersionTest()
        {
            using (var setup = new TestSetupHelper("NumberBox Tests"))
            {
                ComboBox validationComboBox = FindElement.ByName <ComboBox>("ValidationComboBox");
                validationComboBox.SelectItemByName("Disabled");
                Wait.ForIdle();

                Check("MinCheckBox");
                Check("MaxCheckBox");

                Log.Comment("Verify that numbers outside the range can be set if validation is disabled.");
                RangeValueSpinner numBox = FindElement.ByName <RangeValueSpinner>("TestNumberBox");
                numBox.SetValue(-10);
                Wait.ForIdle();
                Verify.AreEqual(-10, numBox.Value);

                numBox.SetValue(150);
                Wait.ForIdle();
                Verify.AreEqual(150, numBox.Value);
            }
        }
Exemple #9
0
        public void VerifyReadOnlyIsntInteractive()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                UIObject  ratingReadOnly = FindElement.ByName("MyRatingReadOnlyWithValue");
                TextBlock tb             = new TextBlock(FindElement.ByName("MyRatingReadOnlyTextBlock"));
                InputHelper.ScrollToElement(tb);

                Verify.AreEqual(tb.DocumentText, "2.2");

                ratingReadOnly.SetFocus();

                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);
                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);
                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);
                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);
                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);
                KeyboardHelper.PressKey(ratingReadOnly, Key.Right);

                Verify.AreEqual(tb.DocumentText, "2.2");
            }
        }
        public void TopNavigationWithAccessKeysTest()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                Log.Comment("Add ten items to make overflow happen");
                Button addTenItems = new Button(FindElement.ByName("AddTenItems"));
                addTenItems.Invoke();
                Wait.ForIdle();

                Log.Comment("Verify overflow menu is not opened");
                Verify.IsTrue(GetTopNavigationItems(TopNavPosition.Overflow).Count == 0);

                InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement("TopNavOverflowButton");

                Log.Comment("Verify overflow menu is opened");
                // Flyout doesn't seem raise any UIA WindowOpened/MenuOpened events so just check a few times for the menu to
                // have opened.
                TestEnvironment.VerifyAreEqualWithRetry(5,
                                                        () => true,
                                                        () => GetTopNavigationItems(TopNavPosition.Overflow).Count > 0);
            }
        }
        public void TopNavigationOverflowButtonClickTest()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                Log.Comment("Setting focus to Home");
                UIObject home = FindElement.ByName("Home");
                home.SetFocus();
                Wait.ForIdle();

                Log.Comment("Add ten items to make overflow happen");
                Button addTenItems = new Button(FindElement.ByName("AddTenItems"));
                addTenItems.Invoke();
                Wait.ForIdle();

                InvokeOverflowButton();

                UIObject overflowItem = FindElement.ByName("Added Item 5");
                var      invokeResult = new Edit(FindElement.ById("ItemInvokedResult"));
                var      selectResult = new Edit(FindElement.ById("SelectionChangedResult"));
                var      invokeRecommendedTransition          = new Edit(FindElement.ById("InvokeRecommendedTransition"));
                var      selectionChangeRecommendedTransition = new Edit(FindElement.ById("SelectionChangeRecommendedTransition"));
                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    overflowItem.Click();
                    waiter.Wait();
                }

                // First time selection raise ItemInvoke and SelectionChange events
                Verify.AreEqual(invokeResult.Value, "Added Item 5");
                Verify.AreEqual(selectResult.Value, "Added Item 5");

                // only RS5 or above supports SlideNavigationTransitionInfo
                if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
                {
                    Verify.AreEqual(invokeRecommendedTransition.Value, "FromRight");
                    Verify.AreEqual(selectionChangeRecommendedTransition.Value, "FromRight");
                }
            }
        }
Exemple #12
0
        public void ValidateRightClickOnEmptyTextBoxDoesNotShowFlyout()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("Test is disabled pre-RS5 because the fix needed for this functionality didn't exist until then");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "CommandBarFlyout Tests", "Extra CommandBarFlyout Tests" }))
            {
                Log.Comment("Clear the clipboard.");
                FindElement.ById <Button>("ClearClipboardContentsButton").InvokeAndWait();

                Log.Comment("Right-click on the text box.");
                InputHelper.RightClick(FindElement.ById("TextBox"));

                Log.Comment("Count the number of open popups.");
                FindElement.ById <Button>("CountPopupsButton").InvokeAndWait();

                Verify.AreEqual("0", FindElement.ById <Edit>("PopupCountTextBox").Value);
            }
        }
        public void VerifyRightClickForContextMenuDoesNotDeselectText()
        {
            using (var setup = new TestSetupHelper("NumberBox Tests"))
            {
                RangeValueSpinner numBox = FindElement.ByName <RangeValueSpinner>("TestNumberBox");
                numBox.SetValue(0);

                Log.Comment("Verify that focusing the NumberBox selects the text");
                numBox.SetFocus();
                Wait.ForIdle();
                Wait.ForSeconds(3);
                Edit edit = FindTextBox(numBox);
                Verify.AreEqual("0", edit.GetTextSelection());

                Log.Comment("Verify that right-clicking on the NumberBox's input field (to bring up the context menu) does not clear the selection");
                // (15, 15): Just some offset large enough to make sure the right-click below will actually bring up the context menu
                InputHelper.RightClick(edit, 15, 15);
                Wait.ForIdle();

                Verify.AreEqual("0", edit.GetTextSelection());
            }
        }
        public void BasicKeyboardTest()
        {
            using (var setup = new TestSetupHelper("NumberBox Tests"))
            {
                RangeValueSpinner numBox = FindElement.ByName <RangeValueSpinner>("TestNumberBox");

                Log.Comment("Verify that loss of focus validates textbox contents");
                EnterText(numBox, "8", false);
                KeyboardHelper.PressKey(Key.Tab);
                Wait.ForIdle();
                Verify.AreEqual(8, numBox.Value);

                Log.Comment("Verify that whitespace around a number still evaluates to the number");
                EnterText(numBox, "  75 ", true);
                Wait.ForIdle();
                Verify.AreEqual(75, numBox.Value);

                Log.Comment("Verify that pressing escape cancels entered text");
                EnterText(numBox, "3", false);
                KeyboardHelper.PressKey(Key.Escape);
                Wait.ForIdle();
                Verify.AreEqual(75, numBox.Value);

                Log.Comment("Verify that pressing up arrow increases the value");
                KeyboardHelper.PressKey(Key.Up);
                Wait.ForIdle();
                Verify.AreEqual(76, numBox.Value);

                Log.Comment("Verify that pressing down arrow decreases the value");
                KeyboardHelper.PressKey(Key.Down);
                Wait.ForIdle();
                Verify.AreEqual(75, numBox.Value);

                Log.Comment("Verify that pressing PageUp key increases value by 10");
                KeyboardHelper.PressKey(Key.PageUp);
                Wait.ForIdle();
                Verify.AreEqual(85, numBox.Value);
            }
        }
Exemple #15
0
        private void GetScrollerView(out double horizontalOffset, out double verticalOffset, out float zoomFactor)
        {
            horizontalOffset = 0.0;
            verticalOffset   = 0.0;
            zoomFactor       = 1.0f;

            UIObject viewUIObject = FindElement.ById("txtScrollerHorizontalOffset");
            Edit     viewTextBox  = new Edit(viewUIObject);

            Log.Comment("Current HorizontalOffset: " + viewTextBox.Value);
            horizontalOffset = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);

            viewUIObject = FindElement.ById("txtScrollerVerticalOffset");
            viewTextBox  = new Edit(viewUIObject);
            Log.Comment("Current VerticalOffset: " + viewTextBox.Value);
            verticalOffset = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);

            viewUIObject = FindElement.ById("txtScrollerZoomFactor");
            viewTextBox  = new Edit(viewUIObject);
            Log.Comment("Current ZoomFactor: " + viewTextBox.Value);
            zoomFactor = String.IsNullOrWhiteSpace(viewTextBox.Value) ? float.NaN : Convert.ToSingle(viewTextBox.Value);
        }
Exemple #16
0
        public void VerifyShoulderNavigationEnabledOnlySelectionFollowsFocusIsCorrect()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                var navView = FindElement.ByName("NavView");
                var shoulderNavigationEnabled     = new ComboBox(FindElement.ByName("ShoulderNavigationEnabledSetter"));
                var selectionFollowsFocusComboBox = new ComboBox(FindElement.ByName("SelectionFollowsFocusSetter"));

                Log.Comment("Set ShoulderNavigation to always");
                shoulderNavigationEnabled.SelectItemByName("ShoulderNavigationEnabledWhenSelectionFollowsFocus");

                Log.Comment("Set SelectionFollowsFocus to enabled");
                selectionFollowsFocusComboBox.SelectItemByName("SelectionFollowsFocusEnabled");

                Log.Comment("Select first item");
                FindElement.ByName("Home").Click();
                Wait.ForIdle();
                Verify.AreEqual("Home", GetSelectedItem());

                GamepadHelper.PressButton(navView, GamepadButton.RightShoulder);
                Wait.ForIdle();
                Verify.AreEqual("Apps", GetSelectedItem());

                Log.Comment("Set SelectionFollowsFocus to disabled");
                selectionFollowsFocusComboBox.SelectItemByName("SelectionFollowsFocusDisabled");
                Wait.ForIdle();

                GamepadHelper.PressButton(navView, GamepadButton.RightShoulder);

                Wait.ForIdle();
                Verify.AreEqual("Apps", GetSelectedItem());
            }

            string GetSelectedItem()
            {
                return(FindElement.ByName("SelectionChangedResult").GetText());
            }
        }
        public void ChangeStateTest()
        {
            using (var setup = new TestSetupHelper("ProgressRing Tests"))
            {
                Log.Comment("Verify all properties are set to false by default for testing");

                ToggleButton isIndeterminateCheckBox = FindElement.ByName <ToggleButton>("ShowIsDeterminateCheckBox");

                TextBlock isIndeterminateText = FindElement.ByName <TextBlock>("ShowIsDeterminateText");
                TextBlock isPlayingText       = FindElement.ByName <TextBlock>("IsPlayingText");
                TextBlock visualStateText     = FindElement.ByName <TextBlock>("VisualStateText");

                Verify.IsFalse(Convert.ToBoolean(isIndeterminateText.DocumentText));

                Log.Comment("All properties to false updates ProgressBar to Determinate");

                Verify.AreEqual(visualStateText.DocumentText, "Determinate");

                Log.Comment("Verify Lottie animation is inactive when in Determinate state (LottieRoot is hidden)");

                Verify.IsFalse(Convert.ToBoolean(isPlayingText.DocumentText));

                Log.Comment("IsIndeterminate = true updates ProgressBar to Indeterminate visual state");

                isIndeterminateCheckBox.ToggleAndWait();

                Verify.IsTrue(Convert.ToBoolean(isIndeterminateText.DocumentText));
                Verify.AreEqual(visualStateText.DocumentText, "Indeterminate");

                // Lottie animations only support Windows versions rs5 and above
                if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
                {
                    Log.Comment("Verify Lottie animation is active when in Indeterminate state");

                    Verify.IsTrue(Convert.ToBoolean(isPlayingText.DocumentText));
                }
            }
        }
Exemple #18
0
        public void CloseSelectionTest()
        {
            using (var setup = new TestSetupHelper("TabView Tests"))
            {
                Log.Comment("Hiding the disabled tab");
                var disabledTabCheckBox = FindElement.ByName <CheckBox>("IsDisabledTabVisibleCheckBox");
                Verify.IsNotNull(disabledTabCheckBox);
                disabledTabCheckBox.Uncheck();

                Log.Comment("Finding the first tab");
                UIObject firstTab    = FindElement.ByName("FirstTab");
                Button   closeButton = FindCloseButton(firstTab);
                Verify.IsNotNull(closeButton);

                TextBlock selectedIndexTextBlock = FindElement.ByName <TextBlock>("SelectedIndexTextBlock");
                Verify.AreEqual(selectedIndexTextBlock.DocumentText, "0");

                Log.Comment("When the selected tab is closed, selection should move to the next one.");
                // Use Tab's close button:
                closeButton.InvokeAndWait();
                VerifyElement.NotFound("FirstTab", FindBy.Name);
                Verify.AreEqual(selectedIndexTextBlock.DocumentText, "0");

                Log.Comment("Select last tab.");
                UIObject lastTab = FindElement.ByName("LastTab");
                lastTab.Click();
                Wait.ForIdle();
                Verify.AreEqual(selectedIndexTextBlock.DocumentText, "3");

                Log.Comment("When the selected tab is last and is closed, selection should move to the previous item.");

                // Use Middle Click to close the tab:
                lastTab.Click(PointerButtons.Middle);
                Wait.ForIdle();
                VerifyElement.NotFound("LastTab", FindBy.Name);
                Verify.AreEqual(selectedIndexTextBlock.DocumentText, "2");
            }
        }
        public void VerifyPaneIsClosedWhenClickingOnSelectedItem()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
            {
                var displayModeTextBox       = new TextBlock(FindElement.ByName("DisplayModeTextBox"));
                var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));

                Log.Comment("Test PaneDisplayMode=LeftMinimal");
                panelDisplayModeComboBox.SelectItemByName("LeftMinimal");
                Wait.ForIdle();

                WaitAndAssertPaneStatus(PaneOpenStatus.Closed);

                Log.Comment("Click on ToggleButton");
                Button navButton = new Button(FindElement.ById("TogglePaneButton"));
                navButton.Invoke();
                Wait.ForIdle();

                WaitAndAssertPaneStatus(PaneOpenStatus.Opened);

                Log.Comment("Select Apps");
                UIObject appsItem = FindElement.ByName("Apps");
                appsItem.Click();
                Wait.ForIdle();

                WaitAndAssertPaneStatus(PaneOpenStatus.Closed);

                Log.Comment("Click on ToggleButton");
                navButton.Invoke();
                Wait.ForIdle();

                Log.Comment("Click on SelectedItem Apps");
                appsItem.Click();
                Wait.ForIdle();

                WaitAndAssertPaneStatus(PaneOpenStatus.Closed);
            }
        }
Exemple #20
0
        public void ScrollHorizontally()
        {
            Log.Comment("Selecting Scroller tests");

            using (var setup = new TestSetupHelper("Scroller Tests"))
            {
                Log.Comment("Navigating to ScrollersWithSimpleContentsPage");
                UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
                Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");

                Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
                navigateToSimpleContentsButton.Invoke();
                Wait.ForIdle();

                Log.Comment("Retrieving Scroller");
                Scroller scroller31UIObject = new Scroller(FindElement.ByName("Scroller31"));
                Verify.IsNotNull(scroller31UIObject, "Verifying that Scroller was found");

                Verify.IsTrue(scroller31UIObject.HorizontallyScrollable, "Verifying HorizontallyScrollable is true");
                Verify.IsTrue(scroller31UIObject.HorizontalViewSize > 0.0, "Verifying HorizontalViewSize is positive");
                Verify.AreEqual(scroller31UIObject.HorizontalScrollPercent, 0.0, "Verifying HorizontalScrollPercent is zero");

                Log.Comment("Scrolling Scroller horizontally");
                scroller31UIObject.ScrollHorizontal(ScrollAmount.LargeIncrement);

                Log.Comment("Waiting for HorizontalScrollPercent={0} to change", scroller31UIObject.HorizontalScrollPercent);
                Wait.ForScrollChanged(scroller31UIObject, ScrollProperty.HorizontalScrollPercent);

                Log.Comment("Final HorizontalScrollPercent={0}", scroller31UIObject.HorizontalScrollPercent);

                Verify.IsTrue(scroller31UIObject.HorizontallyScrollable, "Verifying HorizontallyScrollable is true");
                Verify.IsTrue(scroller31UIObject.HorizontalViewSize > 0.0, "Verifying HorizontalViewSize is positive");
                Verify.IsTrue(scroller31UIObject.HorizontalScrollPercent > 0.0, "Verifying HorizontalScrollPercent is positive");

                Log.Comment("Returning to the main Scroller test page");
                TestSetupHelper.GoBack();
            }
        }
Exemple #21
0
        public void VerifySelectedItemInInvokedItem()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
            {
                var invokedItem = FindElement.ByName("Music");

                invokedItem.Click();

                Wait.ForIdle();

                var result = new TextBlock(FindElement.ByName("InvokedItemState"));
                Log.Comment("Verify item is selected when Invoked event got raised");
                Verify.AreEqual("ItemWasSelectedInItemInvoked", result.GetText());

                invokedItem.Click();

                Wait.ForIdle();

                Log.Comment("Verify item invoked was raised despite item already selected");
                result = new TextBlock(FindElement.ByName("InvokedItemState"));
                Verify.AreEqual("ItemWasInvokedSecomdTimeWithCorrectSelection", result.GetText());
            }
        }
Exemple #22
0
        public void SettingsItemClickTest()
        {
            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();

                    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);
                }
            }
        }
Exemple #23
0
        public void ChangeValueTest()
        {
            using (var setup = new TestSetupHelper("ProgressBar Tests"))
            {
                Log.Comment("Changing Value of ProgressBar");

                RangeValueSpinner progressBar = FindElement.ByName <RangeValueSpinner>("TestProgressBar");
                Verify.AreEqual(0, progressBar.Value);

                double oldValue = progressBar.Value;

                // NOTE: Interaction tests can only access what accessibility tools see. In this case, we can find the button because we
                // set AutomationProperties.Name on the button in ProgressBarPage.xaml
                Button changeValueButton = FindElement.ByName <Button>("ChangeValueButton");
                changeValueButton.InvokeAndWait();

                double newValue = progressBar.Value;
                double diff     = Math.Abs(oldValue - newValue);

                Log.Comment("ProgressBar value changed");
                Verify.IsGreaterThan(diff, 0.0);
            }
        }
Exemple #24
0
        public void InvokeEllipsisItemTest()
        {
            // In this test we add some items to the BreadcrumbBar, once all items have been added
            // the slider is clicked so nodes 'Node A_2', 'Node A' and 'Root' are crumbled.
            // Finally, we invoke the Ellipsis item to verify the crumbled nodes exist inside the flyout
            using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
            {
                var breadcrumb = SetUpCrumbledTest();

                // Click on the Ellipsis BreadcrumbBarItem
                InvokeEllipsisItem(breadcrumb);

                VerifyDropDownItemContainsText("Node A_2");
                VerifyDropDownItemContainsText("Node A");
                VerifyDropDownItemContainsText("Root");

                Log.Comment("Verify only 3 ellipsis items exist");
                var ellipsisItem4 = FindElement.ByName("EllipsisItem4");
                Verify.IsNull(ellipsisItem4, "EllipsisItem4 was found");

                Verify.AreEqual(6, breadcrumb.Children.Count, "The breadcrumb should contain 6 items: 5 items and ellipsis");
            }
        }
        public void DependencyPropertyOrdering()
        {
            using (var setup = new TestSetupHelper("PersonPicture Tests"))
            {
                TextBlock PersonPictureInitialBlock = new TextBlock(FindElement.ByName("InitialsTextBlock"));
                Button    SetContactBtn             = new Button(FindElement.ByName("ContactBtn"));
                Button    ClearContactBtn           = new Button(FindElement.ByName("ClearContactBtn"));

                // Set all properties that can generate initials.
                WriteInTextBox("InitialTextBox", "AL");
                WriteInTextBox("DisplayNameTextBox", "Some Name");
                SetContactBtn.Invoke(); // Contact.DisplayName = "Test Contact"

                // Clear them in priority order and verify displayed initials.
                Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "AL");
                WriteInTextBox("InitialTextBox", "");
                Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "SN");
                WriteInTextBox("DisplayNameTextBox", "");
                Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "TC");
                ClearContactBtn.Invoke();
                Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "\uE77B");
            }
        }
Exemple #26
0
        public void ImageInfoValidation()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                UIObject customImagesTwo = FindElement.ById("CustomImages");
                InputHelper.ScrollToElement(customImagesTwo);

                WaitForCheckbox("CustomImagesLoadedCheckBox");

                // Verify it has an <Image> child

                // Future: This RawContext doesn't seem to work to make us search the Raw UIA tree,
                // in future, if we can figure out a way to do that, we can stop
                // the "move the image into the content tree" in the test app hack
                // Context.RawContext.Activate();

                Log.Comment("Trying to find the named Image: CustomImages_FirstImageItem");
                UIObject image        = FindElement.ById("CustomImages_FirstImageItem");
                Image    imageAsImage = image as Image;

                // Can't really verify anything else
            }
        }
        public void EmptyMenuBarItemNoPopupTest()
        {
            if (PlatformConfiguration.IsDevice(DeviceType.Phone))
            {
                Log.Comment("Skipping tests on phone, because menubar is not supported.");
                return;
            }
            using (var setup = new TestSetupHelper("MenuBar Tests"))
            {
                FindElement.ByName <Button>("NoChildrenFlyout").Click();
                VerifyElement.NotFound("Popup", FindBy.Name);

                FindElement.ByName <Button>("OneChildrenFlyout").Click();
                VerifyElement.Found("Popup", FindBy.Name);

                // Click twice to close flyout
                FindElement.ByName <Button>("RemoveItemsFromOneChildrenItem").Click();
                FindElement.ByName <Button>("RemoveItemsFromOneChildrenItem").Click();

                FindElement.ByName <Button>("OneChildrenFlyout").Click();
                VerifyElement.NotFound("Popup", FindBy.Name);
            }
        }
        public void SelectionTest()
        {
            using (var setup = new TestSetupHelper("RadioButtons Tests"))
            {
                elements = new RadioButtonsTestPageElements();
                SetItemType(RadioButtonsSourceType.RadioButton);
                foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
                {
                    SetSource(location);

                    SelectByIndex(1);
                    VerifySelectedIndex(1);
                    RadioButton item1 = FindElement.ByName<RadioButton>("Radio Button 1");
                    Verify.IsTrue(item1.IsSelected);

                    SelectByItem(3);
                    VerifySelectedIndex(3);
                    RadioButton item3 = FindElement.ByName<RadioButton>("Radio Button 3");
                    Verify.IsTrue(item3.IsSelected);
                    Verify.IsFalse(item1.IsSelected);
                }
            }
        }
        public void VerifyAcrylicBrushEffect()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Acrylic Tests", "navigateToBasicAcrylic" }))
            {
                ChooseFromComboBox("TestNameComboBox", "VerifyAcrylicBrushEffect");

                var result = new Edit(FindElement.ById("TestResult"));
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Button runTestButton = new Button(FindElement.ById("RunTestButton"));
                    runTestButton.Invoke();
                    LogBrushSate();
                    waiter.Wait();
                }

                Verify.AreEqual(result.Value, "VerifyAcrylicBrushEffect: Passed");
            }
        }
        public void ChangeValueTest()
        {
            using (var setup = new TestSetupHelper("ProgressBar Tests"))
            {
                Log.Comment("Changing Value of ProgressBar");

                UIObject  testProgressBar = FindElement.ByName("TestProgressBar");
                TextBlock valueText       = FindElement.ByName <TextBlock>("ValueText");

                double oldValue = Convert.ToDouble(valueText.DocumentText);

                // NOTE: Interaction tests can only access what accessibility tools see. In this case, we can find the button because we
                // set AutomationProperties.Name on the button in ProgressBarPage.xaml
                Button changeValueButton = FindElement.ByName <Button>("ChangeValueButton");
                changeValueButton.InvokeAndWait();

                double newValue = Convert.ToDouble(valueText.DocumentText);
                double diff     = Math.Abs(oldValue - newValue);

                Log.Comment("ProgressBar value changed");
                Verify.IsGreaterThan(diff, Convert.ToDouble(0));
            }
        }
        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);
                }
            }
        }
Exemple #32
0
        public void ValidateRichTextBlockOverflowUsesSourceFlyouts()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("Test is disabled pre-RS5 because the fix needed for this functionality didn't exist until then");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "CommandBarFlyout Tests", "Extra CommandBarFlyout Tests" }))
            {
                Log.Comment("Right-click on the rich text block.");
                InputHelper.RightClick(FindElement.ById("RichTextBlock"), 10, 10);

                Log.Comment("Select all the text.");
                FindElement.ByName <Button>("Select All").InvokeAndWait();

                Log.Comment("Now right-click on the rich text block overflow.");
                InputHelper.RightClick(FindElement.ById("RichTextBlockOverflow"), 10, 10);

                Log.Comment("The copy option should be available now, because the rich text block's overflow element delegates to the rich text block.");
                FindElement.ByName <Button>("Copy").InvokeAndWait();
            }
        }