Esempio n. 1
0
        private void WriteInTextBox(string textBoxName, string text)
        {
            Log.Comment("Retrieve text box with name '{0}'.", textBoxName);
            Edit textBox = new Edit(FindElement.ById(textBoxName));

            KeyboardHelper.EnterText(textBox, text);
        }
Esempio n. 2
0
        public void ValidateProofingMenu()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("Test is disabled pre-RS5 because the ability to add the proofing menu did not exist pre-RS5");
                return;
            }

            using (var setup = new TestSetupHelper(new[] { "CommandBarFlyout Tests", "Extra CommandBarFlyout Tests" }))
            {
                Edit textBox = FindElement.ById <Edit>("TextBox");

                Log.Comment("Type \"asdf\" plus a space to create a misspelled word.");
                KeyboardHelper.EnterText(textBox, "asdf ", useKeyboard: true);

                // We know that the word appears at the start of the text box's content,
                // so we'll use a point 10 pixels from the text box's left edge as a point
                // known to be within the word's bounding box.
                Log.Comment("Right-click on the word's location in the text box to get the proofing menu.");
                InputHelper.RightClick(textBox, 10, textBox.BoundingRectangle.Height / 2);

                Log.Comment("Find \"ads\" in the proofing menu to fix the spelling error.");
                var proofingItem = new MenuItem(FindElement.ByNameAndClassName("ads", "MenuFlyoutItem"));
                Log.Comment($"Invoke {proofingItem}");
                proofingItem.InvokeAndWait();

                Verify.AreEqual("ads ", textBox.Value);
            }
        }
        void SendValueToNumberBox(string value)
        {
            Edit textbox = FindTextBox(elements.GetPagerNumberBox());

            Verify.IsNotNull(textbox);

            KeyboardHelper.EnterText(textbox, value);
            KeyboardHelper.PressKey(Key.Enter);
            Wait.ForIdle();
        }
        void EnterText(RangeValueSpinner numBox, string text, bool pressEnter = true)
        {
            Edit edit = FindTextBox(numBox);

            if (edit != null)
            {
                KeyboardHelper.EnterText(edit, text);
                if (pressEnter)
                {
                    KeyboardHelper.PressKey(Key.Enter);
                }
                Wait.ForIdle();
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        public void SimpleTestMethod2()
        {
            var inputStepFrequency = new Edit(FindElement.ById("inputStepFrequency"));
            var inputMinimum       = new Edit(FindElement.ById("inputMinimum"));
            var inputRangeStart    = new Edit(FindElement.ById("inputRangeStart"));
            var inputRangeEnd      = new Edit(FindElement.ById("inputRangeEnd"));
            var inputMaximum       = new Edit(FindElement.ById("inputMaximum"));

            var submitStepFrequency = new Button(FindElement.ById("submitStepFrequency"));
            var submitMinimum       = new Button(FindElement.ById("submitMinimum"));
            var submitRangeStart    = new Button(FindElement.ById("submitRangeStart"));
            var submitRangeEnd      = new Button(FindElement.ById("submitRangeEnd"));
            var submitMaximum       = new Button(FindElement.ById("submitMaximum"));
            var submitAll           = new Button(FindElement.ById("submitAll"));

            KeyboardHelper.EnterText(inputStepFrequency, "1");
            KeyboardHelper.EnterText(inputMinimum, "0");
            KeyboardHelper.EnterText(inputRangeStart, "10");
            KeyboardHelper.EnterText(inputRangeEnd, "90");
            KeyboardHelper.EnterText(inputMaximum, "100");

            submitAll.Click();
            Wait.ForIdle();

            var currentStepFrequency = new TextBlock(FindElement.ById("currentStepFrequency"));
            var currentMinimum       = new TextBlock(FindElement.ById("currentMinimum"));
            var currentRangeStart    = new TextBlock(FindElement.ById("currentRangeStart"));
            var currentRangeEnd      = new TextBlock(FindElement.ById("currentRangeEnd"));
            var currentMaximum       = new TextBlock(FindElement.ById("currentMaximum"));

            Verify.AreEqual("1", currentStepFrequency.GetText());
            Verify.AreEqual("0", currentMinimum.GetText());
            Verify.AreEqual("10", currentRangeStart.GetText());
            Verify.AreEqual("90", currentRangeEnd.GetText());
            Verify.AreEqual("100", currentMaximum.GetText());
        }
        private void WriteInTextBox(string textBoxName, string s)
        {
            Log.Comment("Retrieve text box with name '{0}'.", textBoxName);
            Edit textBox = new Edit(FindElement.ByName(textBoxName));

            if (string.IsNullOrEmpty(s))
            {
                s = "{BACKSPACE}";

                Log.Comment("Give it keyboard focus.");
                textBox.SetFocus();
                Wait.ForIdle();
                Log.Comment("Select its current text.");
                textBox.DocumentRange.Select();
                Wait.ForIdle();
                Log.Comment("Type '{0}'.", s);
                textBox.SendKeys(s);
                Wait.ForIdle();
            }
            else
            {
                KeyboardHelper.EnterText(textBox, s);
            }
        }