Exemple #1
0
 public static void Title(string className, string text, bool isBold = true)
 {
     try
     {
         var elements = GetControl.CollectionByClass(className);
         foreach (var elem in elements)
         {
             if (isBold)
             { // && elem.GetCssValue("font-weight").ToLower().Equals("bold")
                 if (elem.Text.Equals(text))
                 {
                     return;
                 }
             }
             else
             {
                 if (elem.Text.Equals(text))
                 {
                     return;
                 }
             }
         }
         Assert.Fail("The text was not found or isn't bold");
     }
     catch (Exception ex)
     {
         Assert.Fail("VerifyTitle threw an exception: " + ex.Message);
     }
 }
Exemple #2
0
        // ************ DATE 10/16/2020 ************
        // In charge of the instantiation of multi Action functions
        // ************ --------------- ************
        #region MULTI ACTION FUNCTIONS


        #region PRESS ACTIONS

        public static void MultiPressByClassName(string className, int duration = 0)
        {
            var multiAction = BuildMultiAction();
            var position    = 0;

            try
            {
                var elements = GetControl.CollectionByClass(className);
                var actions  = BuildActions(elements.Count());

                //Create the press actions for every element found
                foreach (var elem in elements)
                {
                    actions[position].Press(elem).Wait(duration).Release();
                    position++;
                }

                //add every action created before
                for (int i = 0; i < position; i++)
                {
                    multiAction.Add(actions[i]);
                }

                multiAction.Perform();
            }
            catch (Exception ex)
            {
                Assert.Fail("MultiPressByClassName threw an exception: " + ex.Message);
            }
        }
Exemple #3
0
 /// <summary>
 /// Finds a collection of elements and then iterates every element till the text matches (completely or partial) and clicks it.
 /// </summary>
 /// <param name="className">ClassName to find the object</param>
 /// <param name="text">Text to match a specific element</param>
 public static void ByClassName(string className, string text)
 {
     try
     {
         var elements = GetControl.CollectionByClass(className);
         foreach (var elem in elements)
         {
             if (elem.Text.Contains(text))
             {
                 elem.Click();
             }
         }
     }
     catch (Exception ex)
     {
         Assert.Fail("ClickByClassName threw an exception: " + ex.Message);
     }
 }
Exemple #4
0
        public static void Images()
        {
            try
            {
                var images    = GetControl.CollectionByClass("widget.ImageView");
                var firstImg  = images.ElementAt(2);
                var secondImg = images.ElementAt(3);

                if (firstImg.Location.Y != secondImg.Location.Y)
                {
                    Assert.Fail("Images hasn't the same vertical alignment");
                }
                else if (firstImg.Location.X > secondImg.Location.X)
                {
                    Assert.Fail("The images are not in the right order");
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("VerifyImage threw an exception: " + ex.Message);
            }
        }