Inheritance: MonoBehaviour
 public static void RunAndWait(Action a)
 {
     var wait = new Wait { Original = a };
     Run(wait.Run);
     while (!wait.Finished)
     {
         Thread.Sleep(5);
     }
 }
        public override string ToString()
        {
            w = (Wait)base.Tag;

            Binding myBinding = new Binding("seconds");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.Source = w;
            txtsec.SetBinding(TextBox.TextProperty, myBinding);


            Binding descbinding = new Binding("Description");
            descbinding.Mode = BindingMode.TwoWay;
            descbinding.Source = w;
            txtdesc.SetBinding(TextBox.TextProperty, descbinding);

            return base.ToString();
        }
        public void KeyboardTest()
        {
            using (var setup = new TestSetupHelper("TabView Tests"))
            {
                Log.Comment("Set focus inside the TabView");
                UIObject tabContent = FindElement.ByName("FirstTabContent");
                tabContent.SetFocus();

                TabItem firstTab  = FindElement.ByName <TabItem>("FirstTab");
                TabItem secondTab = FindElement.ByName <TabItem>("SecondTab");
                TabItem lastTab   = FindElement.ByName <TabItem>("LastTab");

                Button addButton = FindElement.ById <Button>("AddButton");

                Verify.IsTrue(firstTab.IsSelected, "First Tab should be selected initially");
                Button firstTabButton = FindElement.ByName <Button>("FirstTabButton");
                Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should start in the First Tab");

                // Ctrl+Tab to the second tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
                Verify.IsTrue(secondTab.IsSelected, "Ctrl+Tab should move selection to Second Tab");
                Button secondTabButton = FindElement.ByName <Button>("SecondTabButton");
                Verify.IsTrue(secondTabButton.HasKeyboardFocus, "Focus should move to the content of the Second Tab");

                // Ctrl+Shift+Tab to the first tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
                Verify.IsTrue(firstTab.IsSelected, "Ctrl+Shift+Tab should move selection to First Tab");
                Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should move to the content of the First Tab");

                // Ctrl+Shift+Tab to the last tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
                Verify.IsTrue(lastTab.IsSelected, "Ctrl+Shift+Tab should move selection to Last Tab");
                Verify.IsTrue(lastTab.HasKeyboardFocus, "Focus should move to the last tab (since it has no focusable content)");

                // Ctrl+Tab to the first tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
                Verify.IsTrue(firstTab.IsSelected, "Ctrl+Tab should move selection to First Tab");
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Focus should move to the first tab");

                KeyboardHelper.PressKey(Key.Up);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Up key should not move focus");

                KeyboardHelper.PressKey(Key.Down);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Down key should not move focus");

                KeyboardHelper.PressKey(Key.Right);
                Verify.IsTrue(secondTab.HasKeyboardFocus, "Right Key should move focus to the second tab");

                KeyboardHelper.PressKey(Key.Left);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Left Key should move focus to the first tab");

                addButton.SetFocus();
                Verify.IsTrue(addButton.HasKeyboardFocus, "AddButton should have keyboard focus");

                KeyboardHelper.PressKey(Key.Left);
                Verify.IsTrue(lastTab.HasKeyboardFocus, "Left Key from AddButton should move focus to last tab");

                KeyboardHelper.PressKey(Key.Right);
                Verify.IsTrue(addButton.HasKeyboardFocus, "Right Key from Last Tab should move focus to Add Button");

                firstTab.SetFocus();

                // Ctrl+f4 to close the tab:
                Log.Comment("Verify that pressing ctrl-f4 closes the tab");
                KeyboardHelper.PressKey(Key.F4, ModifierKey.Control);
                Wait.ForIdle();

                VerifyElement.NotFound("FirstTab", FindBy.Name);

                // Move focus to the second tab content
                secondTabButton.SetFocus();
                Wait.ForIdle();
            }
        }
Exemple #4
0
 public void ClickChangeBranchDialogButton()
 {
     ChangeBranchDialogButton.Click();
     Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("waitbar")));
 }
        private void RunHandlerOnMultipleThreads(int noOfThreads, int msgs)
        {
            var timesCalled = 0;
            var mqHost = CreateMqServer();

            sqsQueueManager.PurgeQueues(QueueNames<Wait>.AllQueueNames);

            mqHost.RegisterHandler<Wait>(m =>
            {
                Interlocked.Increment(ref timesCalled);
                Thread.Sleep(m.GetBody().ForMs);
                return null;
            }, noOfThreads);

            mqHost.Start();

            var mqClient = mqHost.MessageFactory.CreateMessageQueueClient();

            var dto = new Wait
            {
                ForMs = 100
            };
            msgs.Times(i => mqClient.Publish(dto));

            SqsTestAssert.WaitUntilTrueOrTimeout(() => timesCalled >= msgs, timeoutSeconds: 12);

            mqHost.Dispose();

            Assert.That(timesCalled, Is.EqualTo(msgs));
        }
Exemple #6
0
 public string GetValidationMessage()
 {
     Wait.WaitForElementVisible(driver, validationMessage);
     log.Info($"Verify validation message on Checkout Step 2");
     return(validationMessage.Text.ToString());
 }
Exemple #7
0
 public static IWebDriver SwitchToFrame(IWebElement element)
 {
     Wait.Until(ExpectedConditions.ElementToBeClickable(element));
     return(webDriver.SwitchTo().Frame(element));
 }
Exemple #8
0
        // [TestMethod]
        public void VerifyRatingItemFallback()
        {
            // This test is actually performed in the test app itself, so go look at RatingControlPage.xaml.cs for the meat of it.

            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone1))
                {
                    Log.Warning("Test is disabled on RS1 due to scrolling unreliability");
                    return;
                }

                Log.Comment("Retrieve PointerOverPlaceholderFallbackRating rating control as generic UIElement");
                UIObject popRating = FindElement.ById("PointerOverPlaceholderFallbackRating");
                Verify.IsNotNull(popRating, "Verifying that we found a UIElement called PointerOverPlaceholderFallbackRating");

                InputHelper.ScrollToElement(popRating);

                popRating.Tap(); // Since on phone it's touch, I do a tap to trigger that.
                popRating.Click();
                Wait.ForIdle();

                Log.Comment("Retrieve PointerOverFallbackRating rating control as generic UIElement");
                UIObject pointerOver = FindElement.ById("PointerOverFallbackRating");
                Verify.IsNotNull(pointerOver, "Verifying that we found a UIElement called PointerOverFallbackRating");
                InputHelper.ScrollToElement(pointerOver);
                pointerOver.Click();
                pointerOver.Tap();
                Wait.ForIdle();

                TextBlock textBlock = new TextBlock(FindElement.ById("UnsetFallbackTextBlock"));
                Verify.AreEqual("+", textBlock.DocumentText, "Verify Unset glyph falls back onto Glyph");
                TextBlock textBlock2 = new TextBlock(FindElement.ById("PlaceholderFallbackTextBlock"));
                Verify.AreEqual("+", textBlock2.DocumentText, "Verify Placeholder glyph falls back onto Glyph");
                TextBlock textBlock3 = new TextBlock(FindElement.ById("DisabledFallbackTextBlock"));
                Verify.AreEqual("+", textBlock3.DocumentText, "Verify Disabled glyph falls back onto Glyph");

                ElementCache.Clear();

                TextBlock textBlock4 = new TextBlock(FindElement.ById("PointerOverPlaceholderFallbackTextBlock"));
                Verify.AreEqual("+", textBlock4.DocumentText, "Verify PointerOverPlaceholder glyph falls back onto Placeholder");
                TextBlock textBlock5 = new TextBlock(FindElement.ById("PointerOverFallbackTextBlock"));
                Verify.AreEqual("+", textBlock5.DocumentText, "Verify PointerOver glyph falls back onto Glyph");
                TextBlock textBlock6 = new TextBlock(FindElement.ById("NoFallbackTextBlock"));
                Verify.AreEqual("+", textBlock6.DocumentText, "Verify a glyph didn't fall back if it wasn't meant to");

                // Image:
                Log.Comment("Retrieve PointerOverPlaceholderImageFallbackRating rating control as generic UIElement");
                popRating = FindElement.ById("PointerOverPlaceholderImageFallbackRating");
                Verify.IsNotNull(popRating, "Verifying that we found a UIElement called PointerOverPlaceholderImageFallbackRating");

                InputHelper.ScrollToElement(popRating);
                Wait.ForIdle();

                popRating.Tap(); // Since on phone it's touch, I do a tap to trigger that.
                popRating.Click();
                Wait.ForIdle();

                Log.Comment("Retrieve PointerOverImageFallbackRating rating control as generic UIElement");
                pointerOver = FindElement.ById("PointerOverImageFallbackRating");
                Verify.IsNotNull(pointerOver, "Verifying that we found a UIElement called PointerOverImageFallbackRating");
                pointerOver.Tap();
                pointerOver.Click();
                Wait.ForIdle();

                textBlock = new TextBlock(FindElement.ById("UnsetImageFallbackTextBlock"));
                Verify.AreEqual("+", textBlock.DocumentText, "Verify Unset image falls back onto Image");
                textBlock2 = new TextBlock(FindElement.ById("PlaceholderImageFallbackTextBlock"));
                Verify.AreEqual("+", textBlock2.DocumentText, "Verify Placeholder image falls back onto Image");
                textBlock3 = new TextBlock(FindElement.ById("DisabledImageFallbackTextBlock"));
                Verify.AreEqual("+", textBlock3.DocumentText, "Verify Disabled image falls back onto Image");

                ElementCache.Clear();
                textBlock4 = new TextBlock(FindElement.ById("PointerOverPlaceholderImageFallbackTextBlock"));
                Verify.AreEqual("+", textBlock4.DocumentText, "Verify PointerOverPlaceholder image falls back onto PlaceholderImage");
                textBlock5 = new TextBlock(FindElement.ById("PointerOverImageFallbackTextBlock"));
                Verify.AreEqual("+", textBlock5.DocumentText, "Verify PointerOver image falls back onto Image");
            }
        }
        private static void RunHandlerOnMultipleThreads(int noOfThreads, int msgs)
        {
            var timesCalled = 0;
            var mqHost = CreateMqServer();
            mqHost.RegisterHandler<Wait>(m => {
                Interlocked.Increment(ref timesCalled);
                Thread.Sleep(m.GetBody().ForMs);
                return null;
            }, noOfThreads);

            mqHost.Start();

            var mqClient = mqHost.CreateMessageQueueClient();

            var dto = new Wait { ForMs = 100 };
            msgs.Times(i => mqClient.Publish(dto));

            const double buffer = 1.1;

            var sleepForMs = (int)((msgs * 100 / (double)noOfThreads) * buffer);
            "Sleeping for {0}ms...".Print(sleepForMs);
            Thread.Sleep(sleepForMs);

            mqHost.Dispose();

            Assert.That(timesCalled, Is.EqualTo(msgs));
        }
        public void RevealHoverLightPosition_Values()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2))
            {
                Log.Comment("RevealHoverLightPosition_Values needs to be running on RS2 or greater");
                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))
                {
                    // Note for this test case we specifically attach the hover light via hover, not press.
                    // This provides regression coverage for Bug 14079741: Reveal hover light doesn't follow pointer until first interaction/click
                    Log.Comment("Move pointer over LargeButton2 (which will attach RevealHoverLight).");
                    target.MovePointer(50, 50);
                    Wait.ForIdle();

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

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

                    Log.Comment("Move pointer to Offset1 [10, 90] on LargeButton2. Wait for light to position to reach expected values.");
                    target.MovePointer(10, 90);
                    Wait.ForIdle();

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

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

                    // Move mouse pointer away so it does not create BorderLight on the item
                    TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
                    Wait.ForIdle();

                    Log.Comment("Move pointer to Offset2 [50, 50]. Wait for light to position to reach expected values.");
                    target.MovePointer(50, 50);
                    Wait.ForIdle();

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

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

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

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

                    Log.Comment("Tap on NarrowButton2 at [10, 40]. Wait for light position to reach expected values.");
                    InputHelper.Tap(target, 10, 40);
                    Wait.ForIdle();

                    waiter.Wait();
                }
                LogResult(result, "Offset3_Values");
            }
        }
Exemple #11
0
        /// <summary>
        /// Worker thread that creates and reads a message queue for power notifications
        /// </summary>
        private void PowerNotifyThread()
        {
            powerThreadRunning = true;

            // Keep going util we are asked to quit
            while (!abortPowerThread)
            {
                IntPtr[] Handles = new IntPtr[2];

                Handles[0] = hMsgQ;
                Handles[1] = powerThreadAbortEvent;

                // Wait on two handles because the message queue will never
                // return from a read unless messages are posted.
                Wait res = (Wait)CEWaitForMultipleObjects(
                    (uint)Handles.Length,
                    Handles,
                    false,
                    INFINITE);


                switch (res)
                {
                // This must be an error - Exit loop and thread
                case Wait.Abandoned:
                    abortPowerThread = true;
                    break;

                // Timeout - Continue after a brief sleep
                case Wait.Failed:
                    Thread.Sleep(500);
                    break;

                // Read the message from the queue
                case Wait.Object0:
                {
                    // Create a new structure to read into
                    PowerInfo Power = new PowerInfo();

                    uint PowerSize = (uint)Marshal.SizeOf(Power);
                    uint BytesRead = 0;
                    uint Flags     = 0;

                    // Read the message
                    if (CEReadMsgQueue(hMsgQ, ref Power, PowerSize,
                                       ref BytesRead, 0, ref Flags))
                    {
                        // Set value to zero if percentage is not known
                        if ((Power.BatteryLifePercent < 0) || (Power.BatteryLifePercent > 100))
                        {
                            Power.BatteryLifePercent = 0;
                        }

                        if ((Power.BackupBatteryLifePercent < 0) || (Power.BackupBatteryLifePercent > 100))
                        {
                            Power.BackupBatteryLifePercent = 0;
                        }

                        // Add the power structure to the queue so that the
                        // UI thread can get it
                        lock (powerQueue.SyncRoot)
                            powerQueue.Enqueue(Power);

                        // Fire an event to notify the UI
                        if (PowerNotify != null)
                        {
                            PowerNotify(this, null);
                        }
                    }

                    break;
                }

                // Process the thread aboart event (fired from DisableNotifications method)
                case Wait.Object1:
                    EventModify(powerThreadAbortEvent, EventAction.EVENT_RESET);
                    abortPowerThread = true;
                    break;
                }
            }

            // Stop receiving power notifications
            if (hReq != IntPtr.Zero)
            {
                CEStopPowerNotifications(hReq);
            }

            // Close the message queue
            if (hMsgQ != IntPtr.Zero)
            {
                CECloseMsgQueue(hMsgQ);
            }

            powerThreadRunning = false;
        }
Exemple #12
0
        protected void OnChangedPackage(SimPe.Interfaces.Files.IPackageFile oldpkg, SimPe.Interfaces.Files.IPackageFile newpkg, bool lettreeviewselect)
        {
            lock (maps)
            {
                if (lv != null)
                {
                    lv.BeginUpdate();
                }
                if (oldpkg != null)
                {
                    oldpkg.SavedIndex      -= new EventHandler(newpkg_SavedIndex);
                    oldpkg.RemovedResource -= new EventHandler(newpkg_RemovedResource);
                    oldpkg.AddedResource   -= new EventHandler(newpkg_AddedResource);
                }
                maps.Clear();



                if (newpkg != null)
                {
                    if (Helper.WindowsRegistry.ShowProgressWhenPackageLoads || !Helper.WindowsRegistry.AsynchronSort)
                    {
                        Wait.Start(newpkg.Index.Length);
                    }
                    else
                    {
                        Wait.Start();
                    }
                    Wait.Message = SimPe.Localization.GetString("Loading package...");
                    int ct = 0;
                    foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in newpkg.Index)
                    {
                        NamedPackedFileDescriptor npfd = new NamedPackedFileDescriptor(pfd, newpkg);
                        if (!Helper.WindowsRegistry.AsynchronSort)
                        {
                            npfd.GetRealName();
                        }

                        maps.Everything.Add(npfd);
                        AddResourceToMaps(npfd);
                        if (Helper.WindowsRegistry.ShowProgressWhenPackageLoads || !Helper.WindowsRegistry.AsynchronSort)
                        {
                            Wait.Progress = ct++;
                        }
                    }
                    Wait.Stop();
                }

                UpdateContent(lettreeviewselect);

                if (newpkg != null)
                {
                    newpkg.AddedResource   += new EventHandler(newpkg_AddedResource);
                    newpkg.RemovedResource += new EventHandler(newpkg_RemovedResource);
                    newpkg.SavedIndex      += new EventHandler(newpkg_SavedIndex);
                }

                if (lv != null)
                {
                    lv.EndUpdate();
                }
            }
        }
Exemple #13
0
 public bool IsSuccessMessageIsDisplayed()
 {
     Wait.WaitForControl(SimsBy.CssSelector("[data-automation-id='status_success']"));
     return(SeleniumHelper.DoesWebElementExist(_statusSuccess));
 }
Exemple #14
0
 /// <summary>
 /// Waits for millis milliseconds
 /// </summary>
 /// <param name="millis"></param>
 public void wait(int millis)
 {
     Wait wait = new Wait();
     WaitDelegate wDel = new WaitDelegate(wait.waitFor);
     System.Console.WriteLine("CALLING WAIT " + millis);
     isSleep = true;
     wDel.BeginInvoke(millis, new AsyncCallback(CallBackMethod), wDel);
 }
Exemple #15
0
        internal bool TryDequeueOneWait (TrackedLock lck, out Wait wait) {
            wait = null;

            OrderedDictionary<Wait, bool> waits;
            if (!Waits.TryGet(lck, out waits))
                return false;

            bool temp;
            lock (waits)
                return waits.TryDequeueFirst(out wait, out temp);
        }
Exemple #16
0
        internal bool TryCreateWait (WeakTrackedLockReference weakLock, out DeadlockInfo deadlock, out Wait wait) {
            var lck = (TrackedLock)weakLock.Target;
            if (lck == null) {
                wait = default(Wait);
                deadlock = default(DeadlockInfo);
                return false;
            }

            var currentThread = Thread.CurrentThread;
            var waits = Waits.GetOrCreate(lck, MakeWaitList);
            wait = new Wait(this, lck, currentThread);

            lock (waits)
                waits.Enqueue(wait, false);

            deadlock = DetectDeadlock(wait);
            if (deadlock != null) {
                lock (waits)
                    waits.Remove(wait);

                var wasSignaled = wait.IsSignaled;

                wait.Dispose();
                wait = null;

                // It's possible, albeit incredibly unlikely, for someone to call Wake on our wait
                //  before we do the deadlock check.
                // If this happens, try to dequeue another wait from the queue and wake it up in our stead.
                // This can probably still break, though...
                if (wasSignaled) {
                    if (TryDequeueOneWait(lck, out wait))
                        wait.Wake();
                }

                return false;
            }

            return true;
        }
Exemple #17
0
        public void CanClearEveryValueTest()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2))
                {
                    // For some reason this test sometimes fails on RS1 when the "bounding box" of the
                    // RatingControl has negative values, but it's not worth the investigation to fix:
                    Log.Comment("Test is disabled on RS1 due to reliability issues");
                    return;
                }

                TextBlock tb = new TextBlock(FindElement.ById("FrameDetails"));
                Log.Comment("FrameDetails: " + tb.DocumentText);

                Log.Comment("Retrieve rating control as generic UIElement");
                UIObject ratingUIObject = FindElement.ByName("TestRatingControl");
                Verify.IsNotNull(ratingUIObject, "Verifying that we found a UIElement called TestRatingControl");

                Log.Comment("Retrieve the text block as a TextBlock");
                TextBlock textBlock = new TextBlock(FindElement.ByName("TestTextBlockControl"));

                Wait.ForIdle();

                Log.Comment("Verify a tap on the first star sets Rating to 1");
                InputHelper.Tap(ratingUIObject, (0 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("1", textBlock.DocumentText);

                Log.Comment("Verify a tap on the first star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, (0 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);

                Log.Comment("Verify a tap on the second star sets Rating to 2");
                InputHelper.Tap(ratingUIObject, (1 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("2", textBlock.DocumentText);

                Log.Comment("Verify a tap on the second star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, (1 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);

                Log.Comment("Verify a tap on the third star sets Rating to 3");
                InputHelper.Tap(ratingUIObject, (2 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("3", textBlock.DocumentText);

                Log.Comment("Verify a tap on the third star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, (2 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);

                Log.Comment("Verify a tap on the fourth star sets Rating to 4");
                InputHelper.Tap(ratingUIObject, (3 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("4", textBlock.DocumentText);

                Log.Comment("Verify a tap on the fourth star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, (3 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);

                Log.Comment("Verify a tap on the fifth star sets Rating to 5");
                InputHelper.Tap(ratingUIObject, (4 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("5", textBlock.DocumentText);

                Log.Comment("Verify a tap on the second star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, (4 * RATING_ITEM_WIDTH) + (RATING_ITEM_WIDTH / 2), RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);
            }
        }
Exemple #18
0
 public void OpenCases()
 {
     Wait.Until(d => this.opencasesButton.AttemptClick());
 }
Exemple #19
0
        public void UIAValuePatternTest()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                Log.Comment("Retrieve rating control as generic UIElement");
                UIObject ratingUIObject = FindElement.ByName("TestRatingControl");

                TextBlock textBlock = new TextBlock(FindElement.ByName("TestTextBlockControl"));
                Verify.IsNotNull(ratingUIObject, "Verifying that we found a UIElement called TestRatingControl");

                Log.Comment("Verify the UIA Value before user clicks the control.");
                ratingUIObject.SetFocus(); // Setting focus just so we can use AE.FE below
                Wait.ForIdle();
                AutomationElement ratingPeer = AutomationElement.FocusedElement;

                VerifyValue_ValueEqualsOnAutomationElement(ratingPeer, "Community Rating, 2.5 of 5");

                if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone2)) // engagement doesn't work pre RS3
                {
                    Log.Comment("Verify moving right 2 times with the gamepad sets the control to 3");
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                    Wait.ForIdle();
                    Verify.AreEqual("3", textBlock.DocumentText);

                    Log.Comment("Verify rating of 3 sets UIA text to 3");

                    VerifyValue_ValueEqualsOnAutomationElement(ratingPeer, "Rating, 3 of 5");

                    // revert:
                    Log.Comment("Resetting control to community rating");
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadLeft);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadLeft);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadLeft);
                    GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);

                    VerifyValue_ValueEqualsOnAutomationElement(ratingPeer, "Community Rating, 2.5 of 5");
                }

                Log.Comment("Verify more complex navigation");
                KeyboardHelper.PressKey(ratingUIObject, Key.Right);
                KeyboardHelper.PressKey(ratingUIObject, Key.Right);
                KeyboardHelper.PressKey(ratingUIObject, Key.Right);
                KeyboardHelper.PressKey(ratingUIObject, Key.Left);
                VerifyValue_ValueEqualsOnAutomationElement(ratingPeer, "Rating, 2 of 5");

                // Verify read an unset rating
                ratingUIObject = FindElement.ByName("RatingBindingSample");
                Log.Comment("Verify the UIA Value of an unset Rating without a placeholder value");
                ratingUIObject.SetFocus();
                InputHelper.ScrollToElement(ratingUIObject);
                ratingPeer = AutomationElement.FocusedElement;

                VerifyValue_ValueEqualsOnAutomationElement(ratingPeer, "Rating Unset");

                // Verify rounding:
                Log.Comment("Verifying Value_Value rounding");
                UIObject round1 = FindElement.ById("ValuePatternRoundTest1");
                round1.SetFocus();
                AutomationElement roundAE1 = AutomationElement.FocusedElement;
                UIObject          round2   = FindElement.ById("ValuePatternRoundTest2");
                round2.SetFocus();
                AutomationElement roundAE2 = AutomationElement.FocusedElement;
                UIObject          round3   = FindElement.ById("ValuePatternRoundTest3");
                round3.SetFocus();
                AutomationElement roundAE3 = AutomationElement.FocusedElement;

                VerifyValue_ValueEqualsOnAutomationElement(roundAE1, "Rating, 1.5 of 5");
                VerifyValue_ValueEqualsOnAutomationElement(roundAE2, "Rating, 1.55 of 5");
                VerifyValue_ValueEqualsOnAutomationElement(roundAE3, "Rating, 1.5 of 5");
            }
        }
        private static void RunHandlerOnMultipleThreads(int noOfThreads, int msgs)
        {
            var timesCalled = 0;
            var mqHost = CreateMqServer();

            using (var conn = mqHost.ConnectionFactory.CreateConnection())
            using (var channel = conn.CreateModel())
            {
                channel.PurgeQueue<Wait>();
            }

            mqHost.RegisterHandler<Wait>(m => {
                timesCalled++;
                Thread.Sleep(m.GetBody().ForMs);
                return null;
            }, noOfThreads);

            mqHost.Start();

            var mqClient = mqHost.CreateMessageQueueClient();

            var dto = new Wait { ForMs = 100 };
            msgs.Times(i => mqClient.Publish(dto));

            const double buffer = 2.2;

            var sleepForMs = (int)((msgs * 1000 / (double)noOfThreads) * buffer);
            "Sleeping for {0}ms...".Print(sleepForMs);
            Thread.Sleep(sleepForMs);

            mqHost.Dispose();

            Assert.That(timesCalled, Is.EqualTo(msgs));
        }
Exemple #21
0
 public override void OnEnable()
 {
     base.OnEnable();
     wait = task as Wait;
 }
Exemple #22
0
 //--------------------------------------------------------
 public void Wait(float waitTime, Wait waitNode)
 {
     StartCoroutine("WaitRoutine", new object[] {waitTime, waitNode});
 }
Exemple #23
0
        public DeadlockInfo DetectDeadlock (Wait wait) {
            var seenLocks = new HashSet<TrackedLock>(new Internal.ReferenceComparer<TrackedLock>());
            var waitToExamine = wait;

            while (waitToExamine != null) {
                seenLocks.Add(waitToExamine.Lock);

                var ownerThread = waitToExamine.Lock.HeldBy;
                if (ownerThread == null)
                    break;

                Wait nextWaitToExamine;
                if (!WaitsByThread.TryGetValue(ownerThread, out nextWaitToExamine))
                    break;

                if (seenLocks.Contains(nextWaitToExamine.Lock))
                    return new DeadlockInfo(waitToExamine.Lock, nextWaitToExamine.Lock);
                waitToExamine = nextWaitToExamine;
            }

            return null;
        }
Exemple #24
0
 public DepartureChoicePage(Session session) : base(session)
 {
     Wait.Until(d => ExpectedConditions.ElementExists(By.ClassName("aa-summary")));
     Tag = Wait.Until(driver => driver.GetElement(By.TagName("body")));
 }
Exemple #25
0
 public string GetAlertMessage()
 {
     Wait.WaitForElementVisible(driver, warningMessage);
     log.Info($"Verify alert message on Checkout Step 2");
     return(warningMessage.Text.ToString());
 }
 public void PageDisplayed()
 {
     Wait.Until(s => s.FindElements(Objects.Pages.Dashboard.Sections).Count > 0);
 }
Exemple #27
0
 public string GetCurrentBranchName()
 {
     Wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("TextBranch")));
     return(CurrentBranchName.Text.Replace("Филиал: ", string.Empty).Replace(" (A+) [ Сменить ]", string.Empty));
 }
Exemple #28
0
 public void OpenSection()
 {
     SeleniumHelper.WaitForElementClickableThenClick(SeleniumHelper.SelectByDataAutomationID(SectionID));
     Wait.WaitForElement(SeleniumHelper.SelectByDataAutomationID(ChildLinkID));
 }
Exemple #29
0
 //Взаимодействие с каталогом
 public void ClickCategoryButton(Category category)
 {
     WaitTillPageStatusBeComlete();
     Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.CssSelector("div[class=\"blockUI blockMsg blockPage\"]")));
     GetCategoryElement(category).Click();
 }
Exemple #30
0
 public void ClickChildLink()
 {
     Wait.WaitUntilDisplayed(SeleniumHelper.SelectByDataAutomationID(ChildLinkID));
     SeleniumHelper.WaitForElementClickableThenClick(SeleniumHelper.SelectByDataAutomationID(ChildLinkID));
 }
        public void TabSizeAndScrollButtonsTest()
        {
            using (var setup = new TestSetupHelper("TabView Tests"))
            {
                UIObject smallerTab = FindElement.ByName("FirstTab");
                UIObject largerTab  = FindElement.ByName("LongHeaderTab");

                FindElement.ByName <Button>("SetTabViewWidth").InvokeAndWait();

                Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");

                Log.Comment("Equal size tabs should all be the same size.");
                int diff = Math.Abs(largerTab.BoundingRectangle.Width - smallerTab.BoundingRectangle.Width);
                Verify.IsLessThanOrEqual(diff, 1);

                Log.Comment("Changing tab width mode to SizeToContent.");
                ComboBox tabWidthComboBox = FindElement.ByName <ComboBox>("TabWidthComboBox");
                tabWidthComboBox.SelectItemByName("SizeToContent");
                Wait.ForIdle();

                Log.Comment("Tab with larger content should be wider.");
                Verify.IsGreaterThan(largerTab.BoundingRectangle.Width, smallerTab.BoundingRectangle.Width);

                // With largerTab now rendering wider, the scroll buttons should appear:
                Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear");

                // Scroll all the way to the left and verify decrease/increase button visual state
                FindElement.ByName <Button>("ScrollTabViewToTheLeft").InvokeAndWait();
                Wait.ForIdle();
                Verify.IsFalse(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be disabled");
                Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled");

                // Scroll to the middle position and verify decrease/increase button visual state
                FindElement.ByName <Button>("ScrollTabViewToTheMiddle").InvokeAndWait();
                Wait.ForIdle();
                Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled");
                Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled");

                // Scroll all the way to the right and verify decrease/increase button visual state
                FindElement.ByName <Button>("ScrollTabViewToTheRight").InvokeAndWait();
                Wait.ForIdle();
                Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled");
                Verify.IsFalse(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be disabled");

                // Close a tab to make room. The scroll buttons should disappear:
                Log.Comment("Closing a tab:");
                Button closeButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
                closeButton.InvokeAndWait();
                VerifyElement.NotFound("LongHeaderTab", FindBy.Name);

                Log.Comment("Scroll buttons should disappear");
                Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should disappear");

                // Make sure the scroll buttons can show up in 'Equal' sizing mode.
                Log.Comment("Changing tab width mode to Equal");
                tabWidthComboBox.SelectItemByName("Equal");
                Wait.ForIdle();
                Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");

                var addButton = FindElement.ByName <Button>("Add New Tab");
                Verify.IsNotNull(addButton, "addButton should be available");
                Log.Comment("Adding a tab");
                addButton.InvokeAndWait();
                Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");
                Log.Comment("Adding another tab");
                addButton.InvokeAndWait();

                Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear");
            }
        }
 public bool IsErrorLabelShown()
 {
     Wait.ForElementIsShown(_errorWebElement);
     return(_errorWebElement.Displayed);
 }
Exemple #33
0
 public void ClickSave()
 {
     _saveButton.ClickByJS();
     Wait.WaitForAjaxReady(SimsBy.CssSelector(".locking-mask"));
     Refresh();
 }
        public void ScrollWhileUsingExpressionAnimationSources()
        {
            Log.Comment("Selecting Scroller tests");

            using (var setup = new TestSetupHelper("Scroller Tests"))
            {
                SetOutputDebugStringLevel("Verbose");

                Log.Comment("Navigating to ScrollerExpressionAnimationSourcesPage");
                UIObject navigateToExpressionAnimationSourcesUIObject = FindElement.ByName("navigateToExpressionAnimationSources");
                Verify.IsNotNull(navigateToExpressionAnimationSourcesUIObject, "Verifying that navigateToExpressionAnimationSources Button was found");

                Button navigateToExpressionAnimationSourcesButton = new Button(navigateToExpressionAnimationSourcesUIObject);
                navigateToExpressionAnimationSourcesButton.Invoke();
                Wait.ForIdle();

                SetLoggingLevel(isPrivateLoggingEnabled: true);

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

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

                Log.Comment("Waiting for final layout");
                WaitForEditValue(editName: "txtLayoutCompleted", editValue: "Yes");

                Edit textBox = new Edit(FindElement.ById("txtViewport"));
                Log.Comment("Viewport: " + textBox.Value);
                textBox = new Edit(FindElement.ById("txtExtent"));
                Log.Comment("Extent: " + textBox.Value);
                textBox = new Edit(FindElement.ById("txtBarVisualWidth"));

                Log.Comment("Scrolling Scroller horizontally and vertically");
                scrollerUIObject.SetScrollPercent(10.0, 20.0);

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

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

                if (Math.Abs(scrollerUIObject.HorizontalScrollPercent - 10.0) >= 0.0001 ||
                    Math.Abs(scrollerUIObject.VerticalScrollPercent - 20.0) >= 0.0001)
                {
                    LogAndClearTraces();
                }

                SetLoggingLevel(isPrivateLoggingEnabled: false);

                Verify.IsTrue(scrollerUIObject.HorizontallyScrollable, "Verifying HorizontallyScrollable is true");
                Verify.IsTrue(scrollerUIObject.HorizontalViewSize > 0.0, "Verifying HorizontalViewSize is positive");
                Verify.IsLessThan(Math.Abs(scrollerUIObject.HorizontalScrollPercent - 10.0), 0.0001, "Verifying HorizontalScrollPercent is close to 10.0");

                Verify.IsTrue(scrollerUIObject.VerticallyScrollable, "Verifying VerticallyScrollable is true");
                Verify.IsTrue(scrollerUIObject.VerticalViewSize > 0.0, "Verifying VerticalViewSize is positive");
                Verify.IsLessThan(Math.Abs(scrollerUIObject.VerticalScrollPercent - 20.0), 0.0001, "Verifying VerticalScrollPercent is close to 20.0");

                Log.Comment("Returning to the main Scroller test page");
                TestSetupHelper.GoBack();
                // Output-debug-string-level "None" is automatically restored when landing back on the Scroller test page.
            }
        }
Exemple #35
0
        //RatingControlTests.GamepadTest unreliable test #155
        //[TestMethod]
        public void GamepadTest()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone2))
                {
                    Log.Warning("Test is disabled on RS2 or older because Rating's engagement model relies on OnPreviewKey* virtuals");
                    return;
                }

                UIObject ratingUIObject = FindElement.ByName("TestRatingControl");
                Verify.IsNotNull(ratingUIObject, "Verifying that we found a UIElement called TestRatingControl");
                TextBlock textBlock = new TextBlock(FindElement.ByName("TestTextBlockControl"));

                Log.Comment("Verify gamepad engagement");
                ratingUIObject.SetFocus();
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("1", textBlock.DocumentText);

                Log.Comment("Verify gamepad one change and cancel");
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.B);
                Wait.ForIdle();
                Verify.AreEqual("1", textBlock.DocumentText);

                Log.Comment("Verify gamepad one change and accept");
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("2", textBlock.DocumentText);

                Log.Comment("Verify gamepad multiple changes");
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadLeft);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("3", textBlock.DocumentText);

                Log.Comment("Verify gamepad left stick and dpad work");
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadLeft);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.LeftThumbstickRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.LeftThumbstickRight);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("4", textBlock.DocumentText);

                Log.Comment("Verify gamepad dpad up down do nothing");
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadUp);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("4", textBlock.DocumentText);

                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.DPadDown);
                GamepadHelper.PressButton(ratingUIObject, GamepadButton.A);
                Wait.ForIdle();
                Verify.AreEqual("4", textBlock.DocumentText);
            }
        }
        public void ValidateKeyboarding()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                Log.Warning("Test is disabled pre-RS5 because the keyboarding fixes needed to support this were not available pre-RS5.");
                return;
            }

            using (var setup = new TextCommandBarFlyoutTestSetupHelper())
            {
                Log.Comment("Give focus to the TextBox.");
                FocusHelper.SetFocus(FindElement.ById("TextBox"));

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromName("Select All")))
                {
                    Log.Comment("Use Shift+F10 to bring up the context menu. The Select All button should get focus.");
                    KeyboardHelper.PressKey(Key.F10, ModifierKey.Shift);
                    waiter.Wait();
                }

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromId("TextBox")))
                {
                    Log.Comment("Use Escape to close the context menu. The TextBox should now have focus.");
                    KeyboardHelper.PressKey(Key.Escape);
                    waiter.Wait();
                }

                Log.Comment("Give focus to the RichEditBox.");
                FocusHelper.SetFocus(FindElement.ById("RichEditBox"));

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromName("Bold")))
                {
                    Log.Comment("Use Shift+F10 to bring up the context menu. The Bold button should get focus.");
                    KeyboardHelper.PressKey(Key.F10, ModifierKey.Shift);
                    waiter.Wait();
                }

                Log.Comment("Press the spacebar to invoke the bold button. Focus should stay in the flyout.");
                KeyboardHelper.PressKey(Key.Space);
                Wait.ForIdle();

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromName("More app bar")))
                {
                    Log.Comment("Press the right arrow key three times.  The '...' button should get focus.");
                    KeyboardHelper.PressKey(Key.Right, ModifierKey.None, numPresses: 3);
                    waiter.Wait();
                }

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromName("Select All")))
                {
                    Log.Comment("Press the down arrow key twice.  The Select All button should get focus.");
                    KeyboardHelper.PressKey(Key.Down, ModifierKey.None, numPresses: 2);
                    waiter.Wait();
                }

                using (var waiter = new FocusAcquiredWaiter(UICondition.CreateFromId("RichEditBox")))
                {
                    Log.Comment("Use Escape to close the context menu. The RichEditBox should now have focus.");
                    KeyboardHelper.PressKey(Key.Escape);
                    waiter.Wait();
                }
            }
        }
Exemple #37
0
        public void BasicInteractionTest()
        {
            using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page.
            {
                Log.Comment("Retrieve rating control as generic UIElement");
                UIObject ratingUIObject = FindElement.ByName("TestRatingControl");
                Verify.IsNotNull(ratingUIObject, "Verifying that we found a UIElement called TestRatingControl");

                Log.Comment("Retrieve the text block as a TextBlock");
                TextBlock textBlock = new TextBlock(FindElement.ByName("TestTextBlockControl"));

                Log.Comment("Verify a tap on the third star sets Rating to 3");
                InputHelper.Tap(ratingUIObject, 60, RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("3", textBlock.DocumentText);

                Log.Comment("Verify a tap on the third star sets Rating to 2.5 (placeholder value)");
                InputHelper.Tap(ratingUIObject, 60, RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("!2.5", textBlock.DocumentText);

                Button phButton = new Button(FindElement.ByName("PHButton"));
                InputHelper.Tap(phButton);

                Log.Comment("Verify a tap on the first star sets Rating to 1");
                InputHelper.Tap(ratingUIObject, 12, RATING_ITEM_HEIGHT / 2);
                Verify.AreEqual("1", textBlock.DocumentText);

                Log.Comment("Verify a swipe off the left sets Rating to NOTHING");
                InputHelper.Pan(ratingUIObject, 200, Direction.West);
                Verify.AreEqual("!", textBlock.DocumentText);

                Log.Comment("Verify a right key on an unset Rating, sets rating to 1");
                KeyboardHelper.PressKey(ratingUIObject, Key.Right);

                Verify.AreEqual("1", textBlock.DocumentText);

                Log.Comment("Verify a left key on an RTL rating increases the rating.");
                Button rtlbutton = new Button(FindElement.ByName("RTLButton"));
                rtlbutton.Invoke();
                Wait.ForIdle();

                KeyboardHelper.PressKey(ratingUIObject, Key.Left);
                Verify.AreEqual("2", textBlock.DocumentText);

                Log.Comment("Verify home/end keys in RTL");
                KeyboardHelper.PressKey(ratingUIObject, Key.Home);
                Verify.AreEqual("!", textBlock.DocumentText);

                KeyboardHelper.PressKey(ratingUIObject, Key.End);
                Verify.AreEqual("5", textBlock.DocumentText);

                Log.Comment("Verify up down keys in RTL");
                KeyboardHelper.PressKey(ratingUIObject, Key.Down);
                Verify.AreEqual("4", textBlock.DocumentText);

                KeyboardHelper.PressKey(ratingUIObject, Key.Up);
                Verify.AreEqual("5", textBlock.DocumentText);

                rtlbutton.Invoke();
                Wait.ForIdle();

                Log.Comment("Verify home/end keys in LTR");
                KeyboardHelper.PressKey(ratingUIObject, Key.Home);
                Verify.AreEqual("!", textBlock.DocumentText);

                KeyboardHelper.PressKey(ratingUIObject, Key.End);
                Verify.AreEqual("5", textBlock.DocumentText);

                Log.Comment("Verify up down keys in LTR");
                KeyboardHelper.PressKey(ratingUIObject, Key.Down);
                Verify.AreEqual("4", textBlock.DocumentText);

                KeyboardHelper.PressKey(ratingUIObject, Key.Up);
                Verify.AreEqual("5", textBlock.DocumentText);
            }
        }
Exemple #38
0
 public static AchievementEventRecordPage Create()
 {
     Wait.WaitUntilDisplayed(SimsBy.AutomationId("add_button"));
     return(new AchievementEventRecordPage());
 }
Exemple #39
0
        public void ToStringTest()
        {
            var wait = new Wait(365);

            Assert.AreEqual("Wait 365", wait.ToString());
        }
Exemple #40
0
 public bool initiateWait()
 {
     if (!this.IsHandleCreated)
     {
         this.CreateHandle();
     }
     Wait w = new Wait(Waiting);
     return (bool)this.Invoke(w);
 }
 public BGMPlayer(AudioClipInfo info)
 {
     AudioSource.clip = info.Clip;
     State = new Wait(this);
     Info = info;
 }
Exemple #42
0
 public CheckoutStep2Page(IWebDriver driver)
 {
     this.driver = driver;
     PageFactory.InitElements(driver, this);
     Wait.WaitForElementVisible(driver, step2Content);
 }
Exemple #43
0
 public void ClickAdd()
 {
     _addButton.ClickByJS();
     Wait.WaitUntilDisplayed(SimsBy.AutomationId("well_know_action_save"));
     Refresh();
 }
        protected void NextStep()
        {
            prevStepNodes.Sort(
                ( t1, t2 ) => nodes[t1].pathLen.CompareTo( nodes[t2].pathLen ) );

            foreach( GridTile prevTile in prevStepNodes.Where( prevTile => prevTile.traversable || prevTile == startTile ) ) {

                foreach( GridTile neighbour in prevTile.relations.neighbours ) {

                    if( nodes.ContainsKey( neighbour ) && nodes[neighbour].prevTile != null ) {
                        if( nodes[nodes[neighbour].prevTile].pathLen > nodes[prevTile].pathLen ) {
                            nodes[neighbour].prevTile = prevTile;
                            nodes[neighbour].pathLen = nodes[prevTile].pathLen + prevTile.relations.GetDistance( neighbour );
                        }
                    } else {

                        if( nodes.ContainsKey( neighbour ) )
                            continue;

                        if( neighbour.traversable ) {

                            tempPathLen = nodes[prevTile].pathLen;
                            if( neighbour.obstructed ) {
                                tempPathLen += prevTile.relations.GetDistance( neighbour ) + neighbour.coverValue * 2;
                            } else {
                                tempPathLen += prevTile.relations.GetDistance( neighbour );
                            }

                            if( tempPathLen < range ) {

                                if( neighbour.walkable ) {
                                    neighbour.MakeSelectable();
                                }

                                nextStepNodes.Add( neighbour );
                                nodes.Add( neighbour, new PathNode( prevTile, tempPathLen ) );

                            }

                        }

                    }

                }

            }

            prevStepNodes.Clear();
            prevStepNodes.AddRange( nextStepNodes );
            nextStepNodes.Clear();

            if( prevStepNodes.Count > 0 ) {
                Process p = new Wait( 0 );
                processManager.AddImmediately( p );
                p.eventEnded += NextStep;
            } else {
                End();
            }
        }