Ejemplo n.º 1
0
        void AssertSafeAreaText(string text)
        {
            var element =
                RunningApp
                .WaitForFirstElement(_safeAreaAutomationId);

            element.AssertHasText(text);
        }
Ejemplo n.º 2
0
        void CompareTextLocation(Xamarin.UITest.Queries.AppRect initialRect, int i)
        {
            var newRect = RunningApp.WaitForFirstElement($"InitialText{i}").Rect;

            Assert.AreEqual(newRect.X, initialRect.X, $"Error With Test :{i}");
            Assert.AreEqual(newRect.Y, initialRect.Y, $"Error With Test :{i}");
            Assert.AreEqual(newRect.CenterX, initialRect.CenterX, $"Error With Test :{i}");
            Assert.AreEqual(newRect.CenterY, initialRect.CenterY, $"Error With Test :{i}");
        }
Ejemplo n.º 3
0
        public void Bugzilla57317Test()
        {
            RunningApp.WaitForFirstElement("Cell");

            RunningApp.ActivateContextMenu("Cell");

            RunningApp.WaitForFirstElement("Self-Deleting item");
            RunningApp.Tap(c => c.Marked("Self-Deleting item"));
        }
Ejemplo n.º 4
0
        public void ShapesPathReceiveGestureRecognizers()
        {
            var testLabel = RunningApp.WaitForFirstElement("LabelValue");

            Assert.AreEqual(ResetStatus, testLabel.ReadText());
            var pathRect = testLabel.Rect;

            RunningApp.TapCoordinates(pathRect.X + 100, pathRect.Y - 100);
            Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement("LabelValue").ReadText());
        }
Ejemplo n.º 5
0
        public void ShapesPathReceiveGestureRecognizers()
        {
            var testLabel = RunningApp.WaitForFirstElement(StatusLabelId);

            Assert.AreEqual(ResetStatus, testLabel.ReadText());
            var testPath = RunningApp.WaitForFirstElement(PathId);
            var pathRect = testPath.Rect;

            RunningApp.TapCoordinates(pathRect.X + 1, pathRect.Y + 1);
            Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement(StatusLabelId).ReadText());
        }
Ejemplo n.º 6
0
        public void PaddingIsSetOnPageBeforeItsVisible()
        {
            var initialTextPosition = RunningApp.WaitForFirstElement($"InitialText0").Rect;

            RunningApp.Tap("PushPage");
            CompareTextLocation(initialTextPosition, 1);
            RunningApp.Tap("PushPage");
            CompareTextLocation(initialTextPosition, 2);
            RunningApp.Tap("PushPage");
            CompareTextLocation(initialTextPosition, 3);
            RunningApp.Tap("PopPage");
            CompareTextLocation(initialTextPosition, 2);
            RunningApp.Tap("PopPage");
            CompareTextLocation(initialTextPosition, 1);
        }
Ejemplo n.º 7
0
        public void SafeAreaInsetsBreaksAndroidPadding()
        {
            // ensure initial paddings are honored
            AssertSafeAreaText($"{_safeAreaText}{true}");
            var element = RunningApp.WaitForFirstElement(_paddingLabel);

            bool usesSafeAreaInsets = false;

            if (element.ReadText() != "25, 25, 25, 25")
            {
                usesSafeAreaInsets = true;
            }

            Assert.AreNotEqual(element.ReadText(), "0, 0, 0, 0");
            if (!usesSafeAreaInsets)
            {
                Assert.AreEqual(element.ReadText(), "25, 25, 25, 25");
            }

            // disable Safe Area Insets
            RunningApp.Tap(_safeAreaAutomationId);
            AssertSafeAreaText($"{_safeAreaText}{false}");
            element = RunningApp.WaitForFirstElement(_paddingLabel);

            Assert.AreEqual(element.ReadText(), "25, 25, 25, 25");

            // enable Safe Area insets
            RunningApp.Tap(_safeAreaAutomationId);
            AssertSafeAreaText($"{_safeAreaText}{true}");
            element = RunningApp.WaitForFirstElement(_paddingLabel);
            Assert.AreNotEqual(element.ReadText(), "0, 0, 0, 0");

            if (!usesSafeAreaInsets)
            {
                Assert.AreEqual(element.ReadText(), "25, 25, 25, 25");
            }


            // Set Padding and then disable safe area insets
            RunningApp.Tap(_setPagePadding);
            RunningApp.Tap(_safeAreaAutomationId);
            AssertSafeAreaText($"{_safeAreaText}{false}");
            element = RunningApp.WaitForFirstElement(_paddingLabel);
            Assert.AreEqual(element.ReadText(), "25, 25, 25, 25");
        }
Ejemplo n.º 8
0
        public void Bugzilla51825Test()
        {
            RunningApp.WaitForElement(q => q.Marked("Bugzilla51825SearchBar"));
            RunningApp.EnterText("Bugzilla51825SearchBar", "Hello");
            var label = RunningApp.WaitForFirstElement("Bugzilla51825Label");

            Assert.IsNotEmpty(label.ReadText());

            // Windows App Driver and the Search Bar are a bit buggy
            // It randomly doesn't enter the first letter
#if !__WINDOWS__
            Assert.AreEqual("Hello", label.ReadText());
#endif

            RunningApp.Tap("Bugzilla51825Button");

            var labelChange2 = RunningApp.WaitForFirstElement("Bugzilla51825Label");
            Assert.AreEqual("Test", labelChange2.ReadText());
        }
Ejemplo n.º 9
0
        void SetupTest(string controlType, bool fileSource)
        {
            RunningApp.WaitForElement(_nextTestId);
            string activeTest = null;

            while (RunningApp.Query(controlType).Length == 0)
            {
                activeTest = RunningApp.WaitForElement(_activeTestId)[0].ReadText();
                RunningApp.Tap(_nextTestId);
                RunningApp.WaitForNoElement(activeTest);
            }

            string sourceLabel = RunningApp.WaitForFirstElement("SourceLabel").ReadText();

            if (fileSource && sourceLabel != _imageFromFile)
            {
                RunningApp.Tap(_switchUriId);
            }
            else if (!fileSource && sourceLabel != _imageFromUri)
            {
                RunningApp.Tap(_switchUriId);
            }
        }
Ejemplo n.º 10
0
 public void Issue5376Test()
 {
     RunningApp.WaitForFirstElement("Success");
 }