Exemplo n.º 1
0
        public void Issue12574Test()
        {
            RunningApp.WaitForElement("0 item");

            var rect    = RunningApp.Query(c => c.Marked(carouselAutomationId)).First().Rect;
            var centerX = rect.CenterX;
            var rightX  = rect.X - 5;

            RunningApp.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY);

            RunningApp.WaitForElement("1 item");

            RunningApp.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY);

            RunningApp.WaitForElement("2 item");

            RunningApp.Tap(btnRemoveAutomationId);

            RunningApp.WaitForElement("1 item");

            rightX = rect.X + rect.Width - 1;
            RunningApp.DragCoordinates(rect.X, rect.CenterY, rightX, rect.CenterY);

            RunningApp.WaitForElement("0 item");
        }
Exemplo n.º 2
0
        public void Bugzilla31330Test()
        {
            var screenBounds = RunningApp.Query(q => q.Raw("* index:0"))[0].Rect;

            var cell  = RunningApp.Query(c => c.Marked("Something 1")) [0];
            var cell2 = RunningApp.Query(c => c.Marked("Something 2")) [0];

#if __IOS__
            RunningApp.DragCoordinates(screenBounds.Width - 10, cell.Rect.CenterY, 0, cell.Rect.CenterY);
            RunningApp.WaitForElement(c => c.Marked("Delete"));
            RunningApp.Tap(c => c.Marked("Delete"));
            RunningApp.WaitForElement(c => c.Marked("Something 1"));
            RunningApp.Tap(c => c.Marked("Something 2"));
            RunningApp.DragCoordinates(screenBounds.Width - 10, cell2.Rect.CenterY, 0, cell2.Rect.CenterY);
            RunningApp.Tap(c => c.Marked("Delete"));
            RunningApp.WaitForNoElement(c => c.Marked("Something 2"));
#else
            RunningApp.TouchAndHoldCoordinates(cell.Rect.CenterX, cell.Rect.CenterY);
            RunningApp.WaitForElement(c => c.Marked("Delete"));
            RunningApp.Tap(c => c.Marked("Delete"));
            RunningApp.Back();
            RunningApp.WaitForElement(c => c.Marked("Something 1"));
            RunningApp.Tap(c => c.Marked("Something 2"));
            RunningApp.TouchAndHoldCoordinates(cell2.Rect.CenterX, cell2.Rect.CenterY);
            RunningApp.Tap(c => c.Marked("Delete"));
            RunningApp.WaitForNoElement(c => c.Marked("Something 2"));
#endif
        }
Exemplo n.º 3
0
        void SwipePreviousItem(UITest.Queries.AppRect rect)
        {
#if __ANDROID__
            RunningApp.DragCoordinates(rect.X + 10, rect.Y, rect.X + rect.Width - 10, rect.Y);
#else
            RunningApp.SwipeLeftToRight("carouseView");
#endif
        }
Exemplo n.º 4
0
        void ScrollNextItem()
        {
            var rect    = RunningApp.Query(c => c.Marked("carouselView")).First().Rect;
            var centerX = rect.CenterX;
            var rightX  = rect.X - 5;

            RunningApp.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY);
        }
Exemplo n.º 5
0
        public void ListViewWithoutDataDoesNotCrash()
        {
            var result       = RunningApp.WaitForElement(ListView);
            var listViewRect = result[0].Rect;

            RunningApp.DragCoordinates(listViewRect.CenterX, listViewRect.Y, listViewRect.CenterX, listViewRect.Y + 50);

            RunningApp.WaitForElement(Success);
        }
Exemplo n.º 6
0
        public void TestIsEnabledTrueContextActions()
        {
            var disable1 = RunningApp.Query(c => c.Marked("txtCellEnabledContextActions1")) [0];

            Assert.IsTrue(disable1.Enabled);

            var screenBounds = RunningApp.RootViewRect();

            RunningApp.DragCoordinates(screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);

            RunningApp.Screenshot("Showing context menu");
            RunningApp.WaitForElement(c => c.Marked("More"));
        }
Exemplo n.º 7
0
        public void TestIsEnabledFalseContextActions()
        {
            var disable1 = RunningApp.Query(c => c.Marked("txtCellDisableContextActions1")) [0];

            Assert.IsFalse(disable1.Enabled);

            var screenBounds = RunningApp.Query(q => q.Raw("* index:0")) [0].Rect;

            RunningApp.DragCoordinates(screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);

            RunningApp.Screenshot("Not showing context menu");
            RunningApp.WaitForNoElement(c => c.Marked("More"));
            RunningApp.TapCoordinates(screenBounds.CenterX, screenBounds.CenterY);
        }
Exemplo n.º 8
0
        public void TestShowContextMenuItemsInTheRightOrder()
        {
            var screenBounds = RunningApp.Query(q => q.Raw("* index:0"))[0].Rect;

            var cell = RunningApp.Query(c => c.Marked("Swipe ME")) [0];

#if __IOS__
            RunningApp.DragCoordinates(screenBounds.Width - 10, cell.Rect.CenterY, 0, cell.Rect.CenterY);
#else
            RunningApp.TouchAndHoldCoordinates(cell.Rect.CenterX, cell.Rect.CenterY);
#endif
            RunningApp.WaitForElement(c => c.Marked("Text0"));
            RunningApp.Screenshot("Are the menuitems in the right order?");
        }
Exemplo n.º 9
0
        public void Bugzilla34561Test()
        {
            RunningApp.WaitForElement(q => q.Marked("ListViewItem"));

#if __IOS__
            var listItem = RunningApp.Query(q => q.Marked("ListViewItem"))[0].Rect;
            RunningApp.DragCoordinates(listItem.CenterX, listItem.CenterY, 0, listItem.CenterY);
#else
            RunningApp.TouchAndHold(q => q.Marked("ListViewItem"));
#endif

            RunningApp.WaitForElement(q => q.Marked("Click"));
            RunningApp.Tap(q => q.Marked("Click"));
            RunningApp.WaitForElement(q => q.Marked("NextPageLabel"));
            RunningApp.Screenshot("I see the next page");
        }
Exemplo n.º 10
0
        public void ShowFlyout(string flyoutIcon = FlyoutIconAutomationId, bool usingSwipe = false, bool testForFlyoutIcon = true)
        {
            if (testForFlyoutIcon)
            {
                RunningApp.WaitForElement(flyoutIcon);
            }

            if (usingSwipe)
            {
                var rect = RunningApp.ScreenBounds();
                RunningApp.DragCoordinates(10, rect.CenterY, rect.CenterX, rect.CenterY);
            }
            else
            {
                RunningApp.Tap(flyoutIcon);
            }
        }
Exemplo n.º 11
0
        public void TestDoesntCrashShowingContextMenu()
        {
            var screenBounds = RunningApp.Query(q => q.Raw("* index:0"))[0].Rect;

            var cell = RunningApp.Query(c => c.Marked("Swipe ME")) [0];

#if __IOS__
            RunningApp.DragCoordinates(screenBounds.Width - 10, cell.Rect.CenterY, 0, cell.Rect.CenterY);
            //TODO: fix this when context menu bug is fixed
            RunningApp.WaitForElement(c => c.Marked("Text4"));
#else
            RunningApp.TouchAndHoldCoordinates(cell.Rect.CenterX, cell.Rect.CenterY);
            RunningApp.WaitForElement(c => c.Marked("Text0"));
#endif
            RunningApp.Screenshot("Didn't crash");
            RunningApp.TapCoordinates(screenBounds.CenterX, screenBounds.CenterY);
        }
Exemplo n.º 12
0
 public void Bugzilla31114Test()
 {
     for (int i = 0; i < 5; i++)
     {
         RunningApp.DragCoordinates(10, 300, 10, 10);
     }
     RunningApp.Tap(q => q.Marked("btnLoad"));
     RunningApp.DragCoordinates(10, 300, 10, 10);
     RunningApp.WaitForElement(q => q.Marked("PIPE #1007"));
     RunningApp.WaitForElement(q => q.Marked("PIPE #1008"));
     RunningApp.WaitForElement(q => q.Marked("PIPE #1009"));
     RunningApp.DragCoordinates(10, 300, 10, 10);
     RunningApp.WaitForElement(q => q.Marked("PIPE #1010"));
     RunningApp.WaitForElement(q => q.Marked("PIPE #1011"));
     RunningApp.WaitForElement(q => q.Marked("PIPE #1012"));
     RunningApp.WaitForElement(q => q.Marked("PIPE #1013"));
 }
Exemplo n.º 13
0
        public void CollectionViewInfiniteScroll()
        {
            RunningApp.WaitForElement("CollectionView5623");

            var colView = RunningApp.Query("CollectionView5623").Single();

            AppResult[] lastCellResults = null;

            RunningApp.QueryUntilPresent(() =>
            {
                RunningApp.DragCoordinates(colView.Rect.CenterX, colView.Rect.Y + colView.Rect.Height - 50, colView.Rect.CenterX, colView.Rect.Y + 5);

                lastCellResults = RunningApp.Query("99");

                return(lastCellResults);
            }, 100, 1);

            Assert.IsTrue(lastCellResults?.Any() ?? false);
        }
Exemplo n.º 14
0
        public void TopTabsDontScrollBackToStartWhenSelected()
        {
            var element1 = RunningApp.WaitForElement("Tab 1", "Shell hasn't loaded")[0].Rect;

            RunningApp.WaitForNoElement("Tab 12", "Tab shouldn't be visible");

            UITest.Queries.AppRect element2 = element1;

            for (int i = 2; i < 20; i++)
            {
                var results = RunningApp.Query($"Tab {i}");

                if (results.Length == 0)
                {
                    break;
                }

                element2 = results[0].Rect;
            }

            RunningApp.DragCoordinates(element2.CenterX, element2.CenterY, element1.CenterX, element1.CenterY);

            RunningApp.WaitForNoElement("Tab 1");
            bool testPassed = false;

            // figure out what tabs are visible
            for (int i = 20; i > 1; i--)
            {
                var results = RunningApp.Query($"Tab {i}");

                if (results.Length > 0)
                {
                    RunningApp.Tap($"Tab {i}");
                    RunningApp.WaitForElement($"Tab {i}");
                    testPassed = true;
                    break;
                }
            }

            RunningApp.WaitForNoElement("Tab 1");
            Assert.IsTrue(testPassed);
        }
Exemplo n.º 15
0
        public void DelayedIsRefreshingAndCommandTest_SwipeDown()
        {
            var collectionView = RunningApp.WaitForElement(q => q.Marked("CollectionView7803"))[0];

            RunningApp.Pan(new Drag(collectionView.Rect, Drag.Direction.TopToBottom, Drag.DragLength.Medium));

            RunningApp.WaitForElement(q => q.Marked("Count: 20"));
            RunningApp.WaitForNoElement(q => q.Marked("Count: 30"));

            AppResult[] lastCellResults = null;

            RunningApp.QueryUntilPresent(() =>
            {
                RunningApp.DragCoordinates(collectionView.Rect.CenterX, collectionView.Rect.Y + collectionView.Rect.Height - 50, collectionView.Rect.CenterX, collectionView.Rect.Y + 5);

                lastCellResults = RunningApp.Query("19");

                return(lastCellResults);
            }, 10, 1);

            Assert.IsTrue(lastCellResults?.Any() ?? false);
        }
Exemplo n.º 16
0
        public void CollectionViewVerticalOffset()
        {
            var colView = RunningApp.WaitForElement("CollectionView7993")[0];

            RunningApp.WaitForElement(x => x.Marked("VerticalOffset: 0"));

            AppResult[] lastCellResults = null;

            RunningApp.QueryUntilPresent(() =>
            {
                RunningApp.DragCoordinates(colView.Rect.CenterX, colView.Rect.Y + colView.Rect.Height - 50, colView.Rect.CenterX, colView.Rect.Y + 5);

                lastCellResults = RunningApp.Query("19");

                return(lastCellResults);
            }, 20, 1);

            Assert.IsTrue(lastCellResults?.Any() ?? false);

            RunningApp.Tap(x => x.Marked("NewItemsSource"));
            RunningApp.WaitForElement(x => x.Marked("VerticalOffset: 0"));
        }
Exemplo n.º 17
0
        public void TestIsEnabledTrueContextActions()
        {
            if (RunningApp is iOSApp)
            {
                var disable1 = RunningApp.Query(c => c.Marked("txtCellEnabledContextActions1")) [0];
                Assert.IsTrue(disable1.Enabled);

                var screenBounds = RunningApp.Query(q => q.Raw("* index:0")) [0].Rect;

                if (RunningApp is iOSApp)
                {
                    RunningApp.DragCoordinates(screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);
                }
                else
                {
                    disable1 = RunningApp.Query(c => c.Marked("txtCellEnabledContextActions1")) [0];
                    RunningApp.TouchAndHoldCoordinates(disable1.Rect.CenterX, disable1.Rect.CenterY);
                }

                RunningApp.Screenshot("Showing context menu");
                RunningApp.WaitForElement(c => c.Marked("More"));
            }
        }
Exemplo n.º 18
0
        public void CollectionViewItemsLayoutUpdate()
        {
            RunningApp.WaitForElement("CollectionView5354");
            RunningApp.WaitForElement("Button5354");
            var colView = RunningApp.Query("CollectionView5354").Single();

            for (var i = 0; i < 3; i++)
            {
                RunningApp.WaitForNoElement("NoElement", timeout: TimeSpan.FromSeconds(3));

                AppResult[] lastCellResults = null;

                RunningApp.QueryUntilPresent(() =>
                {
                    RunningApp.DragCoordinates(colView.Rect.CenterX, colView.Rect.Y + colView.Rect.Height - 50, colView.Rect.CenterX, colView.Rect.Y + 5);

                    lastCellResults = RunningApp.Query("Image49");

                    return(lastCellResults);
                }, 100, 1);

                RunningApp.Tap("Button5354");
            }
        }