public void AcrylicRendering()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            if (PlatformConfiguration.IsDevice(DeviceType.Phone))
            {
                Log.Warning("Test is disabled on phone due to Bug 10952754: [Watson Failure] caused by NULL_CLASS_PTR_READ_c0000005_Windows.UI.Xaml.dll!RenderTargetBitmapImplUsingSpriteVisuals::PostDraw.");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Acrylic Tests", "navigateToRenderingAcrylic" }))
            {
                var result = new Edit(FindElement.ById("TestResult"));
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Button runTestButton = new Button(FindElement.ById("RunTestButton"));
                    runTestButton.Invoke();

                    waiter.Wait();
                }

                Verify.AreEqual(result.Value, "AcrylicRendering: Passed");
            }
        }
        public void AcrylicAlwaysUseFallback()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"),
                   page2 = new TestSetupHelper("navigateToBasicAcrylic"))
            {
                {
                    ChooseFromComboBox("TestNameComboBox", "AcrylicAlwaysUseFallback");

                    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();
                    }

                    if (result.Value.Equals("AcrylicAlwaysUseFallback: Skipped"))
                    {
                        Log.Error("Error: FallbackBrush in use - expecting effect brush");
                        return;
                    }

                    Verify.AreEqual(result.Value, "AcrylicAlwaysUseFallback: Passed");
                }
            }
        }
        public void AcrylicCreatedInFallbackMode()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"),
                   page2 = new TestSetupHelper("navigateToBasicAcrylic"))
            {
                {
                    ChooseFromComboBox("TestNameComboBox", "AcrylicCreatedInFallbackMode");

                    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, "AcrylicCreatedInFallbackMode: Passed");
                }
            }
        }
Ejemplo n.º 4
0
        public void RevealButtonStates_SlowRelease_Values()
        {
            if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone2))
            {
                Log.Comment("RevealButtonStates_SlowRelease_Values needs to be running on RS3+");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
            {
                var result = new Edit(FindElement.ById("TestResult"));
                var target = FindElement.ById("LargeButton2");

                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Log.Comment("Tap and hold button (which will attach RevealHoverLight).");
                    InputHelper.TapAndHold(target, 3000);
                    Wait.ForIdle();

                    ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateSlowRelease_Values");
                    FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait();

                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    Log.Comment("Tap and hold button. Wait for light to first reach Pressed, then SlowRelease values.");
                    InputHelper.TapAndHold(target, 5000);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "SlowRelease_Values");
            }
        }
Ejemplo n.º 5
0
        public void RevealHoverLightPositionTests()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("This test relies on touch input, the injection of which is only supported in RS5 and up. Test is disabled.");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
            {
                var result = new Edit(FindElement.ById("TestResult"));

                Log.Comment("Tap and hold Button at an offset. Verfiy RevealHoverLight uses pointer expression to position itself at the pointer.");
                var target = FindElement.ById("NarrowButton");
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    // Move mouse pointer away so it does not create HoverLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    InputHelper.TapAndHold(target, 10, 35, 1000);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "HoverLightExpression_Button_Touch");

                Log.Comment("Activate Button with Keyboard. Validate RevealHoverLight uses keyboard expression to position itself at center of the control.");
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    // Move mouse pointer away so it does not create BorderLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    // Tab to next button and activate it with keyboard
                    KeyboardHelper.PressKey(Key.Tab);
                    KeyboardHelper.PressKey(Key.Space);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "HoverLightExpression_Button_Keyboard");

                Log.Comment("Tap and hold ListViewItem at an offset. Verfiy RevealHoverLight uses pointer expression to position itself at the pointer.");
                target = FindElement.ById("OneMoreListViewItem");
                ChooseFromComboBox("TargetComboBox", "OneMoreListViewItem");
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    // Move mouse pointer away so it does not create HoverLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    InputHelper.TapAndHold(target, 150, 35, 1000);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "HoverLightExpression_ListViewItem_Touch");
            }
        }
Ejemplo n.º 6
0
        public void VerifyNoCrashWhenSelectedItemIsInvalidItem()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                Button setInvalidSelectedItemButton = new Button(FindElement.ById("SetInvalidSelectedItem"));
                var    apps = new Button(FindElement.ById("AppsItem"));

                var invokeResult = new Edit(FindElement.ById("ItemInvokedResult"));
                var selectResult = new Edit(FindElement.ById("SelectionChangedResult"));

                // Select apps
                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    apps.Click();
                    waiter.Wait();
                }

                Verify.AreEqual(selectResult.Value, "Apps");

                setInvalidSelectedItemButton.Click();
                Wait.ForIdle();

                Verify.AreEqual(selectResult.Value, "Null");
            }
        }
        public void AcrylicPropertyChanges()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

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

                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();
                }

                if (PlatformConfiguration.IsDevice(DeviceType.Phone))
                {
                    // On Phone, HostBackdrop validation will fail since Comp will just render black
                    Verify.AreEqual(result.Value, "AcrylicPropertyChanges: Failed (True,False,True,True,False,True,True)");
                }
                else
                {
                    Verify.AreEqual(result.Value, "AcrylicPropertyChanges: Passed");
                }
            }
        }
        public void VerifyDisconnectedState()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

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

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

                    if (result.Value.Equals("VerifyDisconnectedState: Skipped"))
                    {
                        Log.Error("Error: FallbackBrush in use - expecting effect brush");
                        return;
                    }

                    waiter.Wait();
                }

                Verify.AreEqual(result.Value, "VerifyDisconnectedState: Passed");
            }
        }
Ejemplo n.º 9
0
        // Tests that moving the mouse over the AnimatedVisualPlayer causes the
        // PointerMoved event to be fired.
        private void HittestingTest()
        {
            const string testName = nameof(HittestingTest);

            if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
            {
                var textBox = Edit("HittestingTextBox");

                // Move the mouse away from the AnimatedVisualPlayer.
                InputHelper.MoveMouse(textBox, 0, 0);

                // Clear the value of the Edit.
                textBox.SetValueAndWait(string.Empty);

                using (var waiter = new ValueChangedEventWaiter(textBox))
                {
                    // Move the mouse over the AnimatedVisualPlayer.
                    var player = FindElement.ByName("Player");
                    InputHelper.MoveMouse(player, 20, 20);

                    Log.Comment($"{testName}: Waiting until OnPointerMoved handler in UI test returns.");
                    waiter.Wait();
                }

                Log.Comment($"{testName}: Value of textBox: \"{textBox.Value}\".");
                Verify.AreEqual(Constants.PointerMovedText, textBox.Value);
            }
        }
Ejemplo n.º 10
0
        // Clicks the clickTarget, waits for the edit's text to change its value,
        // and returns the value of the edit.
        void ClickWaitAndVerifyText(
            UIObject clickTarget,
            Edit edit,
            string expectedValue,
            [global::System.Runtime.CompilerServices.CallerMemberName] string testName = "")
        {
            if (clickTarget is null)
            {
                Verify.Fail($"{testName}: {nameof(clickTarget)} UIElement not found.");
                return;
            }

            if (edit is null)
            {
                Verify.Fail($"{testName}: {nameof(edit)} UIElement not found.");
                return;
            }

            // Clear out the text box so it starts in a known state.
            edit.SetValueAndWait(string.Empty);

            using (var waiter = new ValueChangedEventWaiter(edit))
            {
                clickTarget.Click();
                Log.Comment($"{testName}: Waiting for text to change.");
                waiter.Wait();
            }

            Log.Comment($"{testName}: Value of text: \"{edit.Value}\".");
            Verify.AreEqual(expectedValue, edit.Value);
        }
Ejemplo n.º 11
0
        public void TopNavigationOverflowButtonTest()
        {
            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("Get and Check that active visualstate contains OverflowButtonWithLabel");
                var getActiveVisualStateButton = new Button(FindElement.ByName("GetActiveVisualState"));
                var invokeResult = new Edit(FindElement.ById("TestResult"));
                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    getActiveVisualStateButton.Click();
                    waiter.Wait();
                }

                Verify.IsTrue(invokeResult.Value.Contains("OverflowButtonWithLabel"));

                Log.Comment("Hide the overflow button label");
                var changeOverflowLabelVisibility = new CheckBox(FindElement.ByName("ChangeOverflowLabelVisibility"));
                changeOverflowLabelVisibility.Uncheck();
                Wait.ForIdle();

                Log.Comment("Get and Check that active visualstate contains OverflowButtonNoLabel");
                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    getActiveVisualStateButton.Click();
                    waiter.Wait();
                }

                Verify.IsTrue(invokeResult.Value.Contains("OverflowButtonNoLabel"));
            }
        }
Ejemplo n.º 12
0
        [TestMethod] //bug 18033309
        public void TopNavigationSecondClickOnSuppressSelectionItemTest()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                Button   resetResultButton = new Button(FindElement.ById("ResetResult"));
                UIObject suppressSelection = FindElement.ByName("SuppressSelection");

                var invokeResult = new Edit(FindElement.ById("ItemInvokedResult"));
                var selectResult = new Edit(FindElement.ById("SelectionChangedResult"));
                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    suppressSelection.Click();
                    waiter.Wait();
                }

                // First time selection only raise ItemInvoke
                Verify.AreEqual(invokeResult.Value, "SuppressSelection");
                Verify.AreEqual(selectResult.Value, "");

                resetResultButton.Click();
                Wait.ForIdle();

                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    suppressSelection.Click();
                    waiter.Wait();
                }

                // Click it again, only raise ItemInvoke event
                Verify.AreEqual(invokeResult.Value, "SuppressSelection");
                Verify.AreEqual(selectResult.Value, "");
            }
        }
Ejemplo n.º 13
0
        public void CoreWindowEventsTests()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2))
            {
                Log.Comment("CoreWindowEventsTests needs to be running on RS2 or greater");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToCoreWindowEventsTests" }))
            {
                var addReveal = FindElement.ById("AddReveal");
                var result    = new Edit(FindElement.ById("TestResult"));

                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Log.Comment("Click Add Reveal Button to enterin RevealBorderLights");
                    addReveal.Click();
                    Wait.ForIdle();

                    Log.Comment("Move Mouse to (-1,-1) to cause PointerExited event, the app's handler will remove Reveal. Ensure there is no crash.");
                    TestEnvironment.Application.CoreWindow.MovePointer(-1, -1);
                    Wait.ForIdle();

                    Log.Comment("Add back Reveal, make sure things are still good");
                    addReveal.Click();
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "CoreWindowEventsTests");
            }
        }
Ejemplo n.º 14
0
        private bool WaitForManipulationEnd(string elementName, string stateTextBoxName, bool throwOnError = true)
        {
            UIObject elementStateUIObject = FindElement.ById(stateTextBoxName);
            Edit     elementStateTextBox  = new Edit(elementStateUIObject);

            Log.Comment("Current State: " + elementStateTextBox.Value);
            if (elementStateTextBox.Value != elementName + ".PART_Root.PART_Scroller Idle")
            {
                using (var waiter = new ValueChangedEventWaiter(elementStateTextBox, elementName + ".PART_Root.PART_Scroller Idle"))
                {
                    int loops = 0;

                    Log.Comment("Waiting for " + elementName + "'s manipulation end.");
                    while (true)
                    {
                        bool success = waiter.TryWait(TimeSpan.FromMilliseconds(250));

                        Log.Comment("Current State: " + elementStateTextBox.Value);

                        if (success)
                        {
                            Log.Comment("Wait succeeded");
                            break;
                        }
                        else
                        {
                            if (elementStateTextBox.Value == elementName + ".PART_Root.PART_Scroller Idle")
                            {
                                Log.Warning("Wait failed but TextBox contains expected text");
                                LogAndClearTraces();
                                break;
                            }
                            else if (loops < 20)
                            {
                                loops++;
                                waiter.Reset();
                            }
                            else
                            {
                                if (throwOnError)
                                {
                                    Log.Error("Wait for manipulation end failed");
                                    LogAndClearTraces();
                                    throw new WaiterException();
                                }
                                else
                                {
                                    Log.Warning("Wait for manipulation end failed");
                                    LogAndClearTraces();
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 15
0
        public void TopNavigationSetSelectedItemToNullInItemInvoke()
        {
            using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
            {
                if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2))
                {
                    Log.Warning("Skipping: only works in RS2 and above");
                    return;
                }


                Button   resetResultButton = new Button(FindElement.ById("ResetResult"));
                UIObject home = FindElement.ByName("Home");
                UIObject apps = FindElement.ById("AppsItem");

                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))
                {
                    apps.Click();
                    waiter.Wait();
                }

                // First time selection raise ItemInvoke and SelectionChange events
                Verify.AreEqual(invokeResult.Value, "Apps");
                Verify.AreEqual(selectResult.Value, "Apps");
                Verify.AreEqual(invokeRecommendedTransition.Value, "Default");
                Verify.AreEqual(selectionChangeRecommendedTransition.Value, "Default");

                resetResultButton.Click();
                Wait.ForIdle();

                Button expectNullSelectedItemInItemInvoke = new Button(FindElement.ById("ExpectNullSelectedItemInItemInvoke"));
                expectNullSelectedItemInItemInvoke.Click();
                Wait.ForIdle();

                using (var waiter = new ValueChangedEventWaiter(invokeResult))
                {
                    home.Click();
                    waiter.Wait();
                }

                // Click home, expect Null in select change event
                Verify.AreEqual(invokeResult.Value, "Home");
                Verify.AreEqual(selectResult.Value, "Null");

                // Only RS5 or above supports SlideNavigationTransitionInfo
                if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
                {
                    Verify.AreEqual(invokeRecommendedTransition.Value, "FromLeft");
                    Verify.AreEqual(selectionChangeRecommendedTransition.Value, "Default");
                }
            }
        }
Ejemplo n.º 16
0
        public void RevealCreateThenEnableEffects()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2))
            {
                Log.Comment("RevealCreateThenEnableEffects needs to be running on RS2 or greater");
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Reveal Tests"),
                   page2 = new TestSetupHelper("navigateToRevealRegressionTests"))
            {
                ToggleButton simulateDisabledByPolicyToggleButton = new ToggleButton(FindElement.ById("SimluateDisabledByPolicyToggleButton"));
                var          addRevealButton     = FindElement.ById("AddRevealButton");
                var          removeRevealButton  = FindElement.ById("RemoveRevealButton");
                var          addBackRevealButton = FindElement.ById("AddBackRevealButton");

                var result = new Edit(FindElement.ById("TestResult"));

                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Log.Comment("Disable Composition Effects.");
                    simulateDisabledByPolicyToggleButton.Toggle();      // Default is false, so this will disable effect

                    Log.Comment("Click Add Reveal Button, to add button while effects disabled");
                    addRevealButton.Click();
                    Wait.ForIdle();

                    var revealButton = FindElement.ById("Test1_RevealButton");

                    Log.Comment("Tap and hold button (which would attach reveal backgorund lights).");
                    InputHelper.TapAndHold(revealButton, 1000);
                    Wait.ForIdle();

                    Log.Comment("Click Remove Reveal Button.");
                    removeRevealButton.Click();
                    Wait.ForIdle();

                    Log.Comment("Enable Composition Effects.");
                    simulateDisabledByPolicyToggleButton.Toggle();
                    Wait.ForIdle();

                    Log.Comment("Add Back Reveal Button, which should now have reveal. Make sure there is no crash. ");
                    addBackRevealButton.Click();
                    Wait.ForIdle();

                    Log.Comment("Tap and hold button. Make sure there is no crash and 2 hover lights are present.");
                    revealButton.Click();
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "RevealCreateThenEnableEffects");
            }
        }
Ejemplo n.º 17
0
        private void CanUndoAndRedoIn(string textControlName)
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("Test is disabled pre-RS5 because programmatically undoing and redoing in text controls is not supported pre-RS5");
                return;
            }

            using (var setup = new TextCommandBarFlyoutTestSetupHelper())
            {
                UIObject            textControl        = FindElement.ById(textControlName);
                ValueImplementation textControlAsValue = new ValueImplementation(textControl);

                string initialString = textControl.GetText();
                Log.Comment("Initial contents of {0} are '{1}'", textControlName, initialString);

                Log.Comment("Selecting all text in the {0}.", textControlName);
                FindElement.ById <Button>(string.Format("{0}SelectAllButton", textControlName)).InvokeAndWait();

                Log.Comment("Giving the {0} focus.", textControlName);
                FocusHelper.SetFocus(textControl);

                Log.Comment("Typing 'hello' into the {0}.", textControlName);
                TextInput.SendText("hello");
                Wait.ForIdle();

                string finalString = textControl.GetText();
                Log.Comment("Contents of {0} are now '{1}'", textControlName, finalString);

                Log.Comment("Opening TextCommandBarFlyout.");
                OpenFlyoutOn(textControlName, asTransient: false);

                using (ValueChangedEventWaiter waiter = textControlAsValue.IsAvailable ? new ValueChangedEventWaiter(new Edit(textControl), initialString) : null)
                {
                    Log.Comment("Undoing text entry.");
                    FindElement.ByName <Button>("Undo").InvokeAndWait();
                }

                Log.Comment("Contents of {0} are now '{1}'", textControlName, textControl.GetText());
                Verify.AreEqual(initialString, textControl.GetText());

                Log.Comment("Reopening TextCommandBarFlyout.");
                OpenFlyoutOn(textControlName, asTransient: false);

                using (ValueChangedEventWaiter waiter = textControlAsValue.IsAvailable ? new ValueChangedEventWaiter(new Edit(textControl), finalString) : null)
                {
                    Log.Comment("Redoing text entry.");
                    FindElement.ByName <Button>("Redo").InvokeAndWait();
                }

                Log.Comment("Contents of {0} are now '{1}'", textControlName, textControl.GetText());
                Verify.AreEqual(finalString, textControl.GetText());
            }
        }
Ejemplo n.º 18
0
        private void RevealStatesHelper(UIObject target)
        {
            var result = new Edit(FindElement.ById("TestResult"));

            Log.Comment("Move Mouse to (0,0). Validate target is initially in Normal state.");
            using (var waiter = new ValueChangedEventWaiter(result))
            {
                TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                Wait.ForIdle();
                ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateNormalState");
                waiter.Wait();
            }
            LogResult(result, "Normal");

            Log.Comment("Move mouse over the target (which will attach RevealHoverLight). Validate PointerOver light state.");
            using (var waiter = new ValueChangedEventWaiter(result))
            {
                target.MovePointer(30, 30);
                Wait.ForIdle();
                ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePointerOverState");
                waiter.Wait();
            }
            LogResult(result, "PointerOver");

            Log.Comment("Click the Target. Verify Pressed light state.");
            using (var waiter = new ValueChangedEventWaiter(result))
            {
                target.MovePointer(30, 30);
                Wait.ForIdle();

                if (target is ListViewItem)
                {
                    ListView testListView = new ListView(FindElement.ById("TestListView"));
                    testListView.Click();
                }
                else
                {
                    target.Click();
                }
                waiter.Wait();
            }
            LogResult(result, "Pressed");

            Log.Comment("Move Mouse to (0, 0). Validate target button is again in Normal state.");
            using (var waiter = new ValueChangedEventWaiter(result))
            {
                TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                Wait.ForIdle();
                ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateNormalState");
                waiter.Wait();
            }
            LogResult(result, "Normal");
        }
Ejemplo n.º 19
0
        public void RevealBorderLightTouchTests()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("This test relies on touch input, the injection of which is only supported in RS5 and up. Test is disabled.");
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Reveal Tests"),
                   page2 = new TestSetupHelper("navigateToRevealStates"))
            {
                Log.Comment("Testing RevealBorderLight for ListViewItem... ");

                var target = FindElement.ById("AnotherListViewItem");

                var result = new Edit(FindElement.ById("TestResult"));

                // Regression coverage for Bug 11713432: [Neon][Reveal] Reveal borders remain after swiping in Groove and Movies & TV left-nav pane on mobile and desktop
                Log.Comment("Tap ListViewItem, then pan away from it. After panning, validate RevealBorderLight is off.");
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    // Move mouse pointer away so it does not create BorderLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    InputHelper.Pan(target, 300, Direction.North);
                    Wait.ForIdle();

                    ChooseFromComboBox("ValidationActionsComboBox", "BorderLight_ValidateBorderLightPanAway");
                    Wait.ForIdle();
                    waiter.Wait();
                }
                LogResult(result, "BorderLight_PanAway");

                Log.Comment("Tap and hold ListViewItem. While holding, validate RevealBorderLight is on.");
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    // Move mouse pointer away so it does not create BorderLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    // Validation will be triggered on ListViewItem's Holding event (this way we are still in the holding state while validating).
                    InputHelper.TapAndHold(target, 1000);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "BorderLight_TapAndHold");
            }
        }
Ejemplo n.º 20
0
        public void RevealButtonStates_Values()
        {
            if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone2))
            {
                Log.Comment("RevealButtonStates_Values needs to be running on RS3+");
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Reveal Tests"),
                   page2 = new TestSetupHelper("navigateToRevealStates"))
            {
                var result = new Edit(FindElement.ById("TestResult"));
                var target = FindElement.ById("LargeButton2");

                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Log.Comment("Tap and hold button (which will attach reveal backgorund lights).");
                    InputHelper.TapAndHold(target, 3000);
                    Wait.ForIdle();

                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePointerOverState_Values");
                    FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait();

                    Log.Comment("Move mouse over the target. Wait for light to reach Default state values.");
                    target.MovePointer(30, 30);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "PointerOver_Values");

                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePressedState_Values");
                    FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait();

                    Log.Comment("Click button. Wait for light to reach Pressed state values.");
                    target.Click();
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "Pressed_Values");
            }
        }
        private void WaitForEditValue(string editName, string editValue, bool logInteractionRatios = false)
        {
            Wait.ForIdle();
            Edit edit = new Edit(FindElement.ById(editName));

            Verify.IsNotNull(edit);
            Log.Comment("Current value for " + editName + ": " + edit.Value);
            if (edit.Value != editValue)
            {
                using (var waiter = new ValueChangedEventWaiter(edit, editValue))
                {
                    Log.Comment("Waiting for " + editName + " to be set to " + editValue);

                    bool success = waiter.TryWait(TimeSpan.FromSeconds(3));
                    Log.Comment("Current value for " + editName + ": " + edit.Value);

                    if (success)
                    {
                        Log.Comment("Wait succeeded");
                    }
                    else
                    {
                        if (edit.Value == editValue)
                        {
                            Log.Warning("Wait failed but TextBox contains expected Text");
                        }
                        else
                        {
                            Log.Error("Wait for edit value failed");
                            LogRefreshVisualizerStates();
                            if (logInteractionRatios)
                            {
                                LogInteractionRatios();
                            }
                            throw new WaiterException();
                        }
                    }
                }
            }

            LogRefreshVisualizerStates();
            if (logInteractionRatios)
            {
                LogInteractionRatios();
            }
        }
Ejemplo n.º 22
0
        protected bool WaitForEditValue(string editName, string editValue, double secondsTimeout = 2.0, bool throwOnError = true)
        {
            Edit edit = new Edit(FindElement.ById(editName));

            Verify.IsNotNull(edit);
            Log.Comment("Current value for " + editName + ": " + edit.Value);
            if (edit.Value != editValue)
            {
                using (var waiter = new ValueChangedEventWaiter(edit, editValue))
                {
                    Log.Comment("Waiting for " + editName + " to be set to " + editValue);

                    bool success = waiter.TryWait(TimeSpan.FromSeconds(secondsTimeout));
                    Log.Comment("Current value for " + editName + ": " + edit.Value);

                    if (success)
                    {
                        Log.Comment("Wait succeeded");
                    }
                    else
                    {
                        if (edit.Value == editValue)
                        {
                            Log.Warning("Wait failed but TextBox contains expected Text");
                            LogAndClearTraces();
                        }
                        else
                        {
                            if (throwOnError)
                            {
                                Log.Error("Wait for edit value failed");
                                LogAndClearTraces();
                                throw new WaiterException();
                            }
                            else
                            {
                                Log.Warning("Wait for edit value failed");
                                LogAndClearTraces();
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 23
0
        public void CanSelectSuggestion()
        {
            using (var setup = new TestSetupHelper("AutoSuggestBox Tests"))
            {
                Edit autoSuggestBoxTextBox = new Edit(FindElement.ByNameAndClassName("AutoSuggestBox with suggestions", "TextBox"));
                FocusHelper.SetFocus(autoSuggestBoxTextBox);
                KeyboardHelper.EnterText(autoSuggestBoxTextBox, "test");
                KeyboardHelper.PressKey(Key.Enter);
                InvokeImplementation dolorItem = new InvokeImplementation(FindElement.ByNameAndClassName("dolor", "ListViewItem"));

                using (ValueChangedEventWaiter waiter = new ValueChangedEventWaiter(autoSuggestBoxTextBox, "dolor"))
                {
                    dolorItem.Invoke();
                }

                Verify.AreEqual("dolor", autoSuggestBoxTextBox.Value);
            }
        }
Ejemplo n.º 24
0
        public void GradientRenderingTest()
        {
            using (var setup = new TestSetupHelper("RadialGradientBrush Tests"))
            {
                Log.Comment("Testing gradient rendering");

                var resultTextBox = new Edit(FindElement.ByName("ColorMatchTestResult"));

                using (var waiter = new ValueChangedEventWaiter(resultTextBox))
                {
                    Button generateRenderTargetBitmapButton = FindElement.ByName <Button>("GenerateRenderTargetBitmapButton");
                    generateRenderTargetBitmapButton.Invoke();

                    waiter.Wait();
                }

                Verify.AreEqual("Passed", resultTextBox.Value);
            }
        }
Ejemplo n.º 25
0
        public void RevealBrushFromMarkup()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Comment("RevealBrushFromMarkup needs to be running on RS5 or greater (due to WUX bug 18005612");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealMarkup" }))
            {
                var result = new Edit(FindElement.ById("TestResult"));
                using (var waiter = new ValueChangedEventWaiter(result))
                {
                    Button runTestButton = new Button(FindElement.ById("RunTestButton"));
                    runTestButton.Invoke();
                    waiter.Wait();
                }

                LogResult(result, "RevealBrushFromMarkup");
            }
        }
Ejemplo n.º 26
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");
                }
            }
        }
        public void VerifyOpaqueTintOptimization()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            // Opaque Tint Optimization removed with Luminosity-based Acrylic recipe added in 19H1
            if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.NineteenH1))
            {
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"),
                   page2 = new TestSetupHelper("navigateToBasicAcrylic"))
            {
                {
                    ChooseFromComboBox("TestNameComboBox", "VerifyOpaqueTintOptimization");

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

                        if (result.Value.Equals("VerifyOpaqueTintOptimization: Skipped"))
                        {
                            Log.Error("Error: FallbackBrush in use - expecting effect brush");
                            return;
                        }

                        waiter.Wait();
                    }

                    Verify.AreEqual(result.Value, "VerifyOpaqueTintOptimization: Passed");
                }
            }
        }
        public void AcrylicRendering_LuminosityBlend()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            if (PlatformConfiguration.IsDevice(DeviceType.Phone))
            {
                Log.Warning("Test is disabled on phone due to Bug 10952754: [Watson Failure] caused by NULL_CLASS_PTR_READ_c0000005_Windows.UI.Xaml.dll!RenderTargetBitmapImplUsingSpriteVisuals::PostDraw.");
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"),
                   page2 = new TestSetupHelper("navigateToRenderingAcrylic"))
            {
                {
                    var result = new Edit(FindElement.ById("TestResult"));

                    using (var waiter = new ValueChangedEventWaiter(result))
                    {
                        Button setLuminosityBlendButton = new Button(FindElement.ById("SetLuminosityButton"));
                        setLuminosityBlendButton.Invoke();

                        waiter.Wait();
                    }
                    LogResult(result, "SetLuminosityBlend");

                    using (var waiter = new ValueChangedEventWaiter(result))
                    {
                        Button unsetLuminosityBlendButton = new Button(FindElement.ById("UnsetLuminosityButton"));
                        unsetLuminosityBlendButton.Invoke();

                        waiter.Wait();
                    }
                    LogResult(result, "ClearLuminosityBlend");
                }
            }
        }
        public void AcrylicFromMarkup()
        {
            if (!OnRS2OrGreater())
            {
                return;
            }

            using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"),
                   page2 = new TestSetupHelper("navigateToMarkupAcrylic"))
            {
                {
                    var result = new Edit(FindElement.ById("TestResult"));
                    using (var waiter = new ValueChangedEventWaiter(result))
                    {
                        Button runTestButton = new Button(FindElement.ById("RunTestButton"));
                        runTestButton.Invoke();
                        LogBrushSate();

                        if (result.Value.Equals("AcrylicFromMarkup: Skipped"))
                        {
                            Log.Error("Error: FallbackBrush in use - expecting effect brush");
                            return;
                        }

                        waiter.Wait();
                    }

                    if (PlatformConfiguration.IsDevice(DeviceType.Phone))
                    {
                        // On Phone, HostBackdrop validation will fail since Comp will just render black
                        Verify.AreEqual(result.Value, "AcrylicFromMarkup: Failed (True,False,True)");
                    }
                    else
                    {
                        Verify.AreEqual(result.Value, "AcrylicFromMarkup: Passed");
                    }
                }
            }
        }
        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");
            }
        }