Exemplo n.º 1
0
        public void TestFindAllIntoRegion()
        {
            //There are 3 patterns on the test region
            Rectangle    searchRegion = new Rectangle(1, 150, 300, 100);
            List <Point> points       = SikuliAction.FindAll(findAllPattern, searchRegion);

            if (points != null)
            {
                foreach (Point point in points)
                {
                    Report.Info("X:" + point.X + "  Y: " + point.Y);
                }
                if (points.Count == 3)
                {
                    Report.Pass("Yep! They are 3...");
                }
                else
                {
                    Report.Error("Nope! They are NOT 3, they are " + points.Count);
                }
            }
            else
            {
                Report.Error("Nope! There is a problem...");
            }
        }
Exemplo n.º 2
0
        public void TestFindAllWithSimilarity90AndTimeout5()
        {
            //There are 6 patterns on the test image
            List <Point> points = SikuliAction.FindAll(findAllPattern, Similarity90, Timeout5S, Rectangle.Empty);

            if (points != null)
            {
                foreach (Point point in points)
                {
                    Report.Info("X:" + point.X + "  Y: " + point.Y);
                }
                if (points.Count == 6)
                {
                    Report.Pass("Yep! They are 6...");
                }
                else
                {
                    Report.Error("Nope! They are NOT 6, they are " + points.Count);
                }
            }
            else
            {
                Report.Error("Nope! There is a problem...");
            }
        }
Exemplo n.º 3
0
        public void TestFindAllDefault()
        {
            //There are 3 patterns on the test image
            List <Point> points = SikuliAction.FindAll(findAllPattern);

            if (points != null)
            {
                foreach (Point point in points)
                {
                    Report.Info("X:" + point.X + "  Y: " + point.Y);
                }
                if (points.Count == 6)
                {
                    Report.Pass("Yep! They are 6...");
                }
                else
                {
                    Report.Error("Nope! They are NOT 6, they are " + points.Count);
                }
            }
            else
            {
                Report.Error("Nope! There is a problem...");
            }
        }
Exemplo n.º 4
0
        public void DemoFindAll()
        {
            //There are 3 patterns on the test image
            List <Point> points = SikuliAction.FindAll(findAllPattern);

            if (points != null)
            {
                foreach (Point point in points)
                {
                    Console.WriteLine("X:" + point.X + "  Y: " + point.Y);
                }
                if (points.Count == 3)
                {
                    Console.WriteLine("Yep! They are 3...");
                }
                else
                {
                    Console.WriteLine("Nope! They are NOT 3, they are " + points.Count);
                }
            }
            else
            {
                Console.WriteLine("Nope! There is a problem...");
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Program demo = new Program();

            demo.StartMSPaint();

            demo.DemoExists();

            demo.DemoFindAll();

            SikuliAction.Click(demo.pattern);

            SikuliAction.DoubleClick(demo.extraPattern);

            SikuliAction.RightClick(demo.pattern);

            SikuliAction.Hover(demo.extraPattern);

            SikuliAction.DragAndDrop(demo.extraPattern, demo.pattern);

            demo.KillMSPaint();

            demo.StartMSPaint(2);

            SikuliAction.Wait(demo.extraPattern, 3);

            demo.KillMSPaint(2);

            SikuliAction.WaitVanish(demo.extraPattern, 3);

            Console.ReadLine();
        }
Exemplo n.º 6
0
 public void DemoExists()
 {
     if (!SikuliAction.Exists(pattern).IsEmpty)
     {
         Console.WriteLine("Yep! It's there...");
     }
     else
     {
         Console.WriteLine("Nope! It's gone...");
     }
 }
Exemplo n.º 7
0
 public void TestExistsWithSimilarity90AndTimeout5()
 {
     if (SikuliAction.Exists(pattern, Similarity90, Timeout5S).IsEmpty)
     {
         Report.Error("Nope! It's gone...");
     }
     else
     {
         Report.Pass("Yep! It's there...");
     }
 }
Exemplo n.º 8
0
 public void TestExistsDefault()
 {
     if (SikuliAction.Exists(pattern).IsEmpty)
     {
         Report.Error("Nope! It's gone...");
     }
     else
     {
         Report.Pass("Yep! It's there...");
     }
 }
Exemplo n.º 9
0
 public void TestDragAndDropDefault()
 {
     try
     {
         SikuliAction.DragAndDrop(extraPattern, pattern);
         Report.Pass("Yep! It's drag and dropped...");
     }
     catch
     {
         Report.Error("Nope! It's NOT drag and dropped...");
     }
 }
Exemplo n.º 10
0
 public void TestRightClickDefault()
 {
     try
     {
         SikuliAction.RightClick(pattern);
         Report.Pass("Yep! It's right clicked...");
     }
     catch
     {
         Report.Error("Nope! It's NOT right clicked...");
     }
 }
Exemplo n.º 11
0
 public void TestDoubleClickDefault()
 {
     try
     {
         SikuliAction.DoubleClick(extraPattern);
         Report.Pass("Yep! It's double clicked...");
     }
     catch
     {
         Report.Error("Nope! It's NOT double clicked...");
     }
 }
Exemplo n.º 12
0
 public void TestHoverDefault()
 {
     try
     {
         SikuliAction.Hover(pattern);
         Report.Pass("Yep! It's hovered...");
     }
     catch
     {
         Report.Error("Nope! It's NOT hovered...");
     }
 }
Exemplo n.º 13
0
 public void TestWaitDefaultNegative()
 {
     try
     {
         StartMSPaint(3);
         SikuliAction.Wait(extraPattern, 2);
         Report.Error("Nope! It's appeared, but it shouldn't...");
     }
     catch
     {
         Report.Pass("Yep! It's not appeared as expected...");
     }
 }
Exemplo n.º 14
0
 public void TestWaitDefaultPositive()
 {
     try
     {
         StartMSPaint(2);
         SikuliAction.Wait(extraPattern, 3);
         Report.Pass("Yep! It's appeared...");
     }
     catch
     {
         Report.Error("Nope! It's NOT appeared...");
     }
 }
Exemplo n.º 15
0
 public void TestWaitVanishDefaultPositive()
 {
     try
     {
         KillMSPaint(2);
         SikuliAction.WaitVanish(extraPattern, 3);
         Report.Pass("Yep! It's vanished...");
     }
     catch
     {
         Report.Error("Nope! It's NOT vanished...");
     }
 }
Exemplo n.º 16
0
 public void TestWaitVanishDefaultNegative()
 {
     try
     {
         KillMSPaint(3);
         SikuliAction.WaitVanish(extraPattern, 2);
         Report.Error("Nope! It's vanished, but it shouldn't...");
     }
     catch
     {
         Report.Pass("Yep! It's not vanished as expected...");
     }
 }
Exemplo n.º 17
0
 //[Test]
 public void ClickImage()
 {
     Thread.Sleep(5000);
     Console.WriteLine("Trying to click on image using sikuli");
     try
     {
         SikuliAction.Click("C:\\workspace\\pscautomation\\pscwhite\\PSCTest\\PSCTest\\utilities\\lookup\\pscimage\\returncontainer.png");
     }
     catch (Exception)
     {
         Console.WriteLine("Not able to find the element");
     }
     Assert.Pass();
 }
Exemplo n.º 18
0
        public static void DragAndDrop(string FromPath, string ToPath, string failMsg, int RedotimeOut = 0)
        {
            bool returnValue = false;

            DateTime varDateTime;
            DateTime varElapseTime = DateTime.Now.AddSeconds(RedotimeOut);

            do
            {
                varDateTime = DateTime.Now;
                try
                {
                    SikuliAction.DragAndDrop(FromPath, ToPath);
                    returnValue = true;
                    break;
                }
                catch (Exception e) { }
            } while (varDateTime <= varElapseTime);


            BaseTest.Assert.IsTrue(returnValue, failMsg);
        }
Exemplo n.º 19
0
        public static void Hover(string path, string failMsg, int timeOut = 0)
        {
            bool returnValue = false;

            DateTime varDateTime;
            DateTime varElapseTime = DateTime.Now.AddSeconds(timeOut);

            do
            {
                varDateTime = DateTime.Now;
                try
                {
                    SikuliAction.Hover(path);
                    returnValue = true;
                    break;
                }
                catch (Exception e) { }
            } while (varDateTime <= varElapseTime);


            BaseTest.Assert.IsTrue(returnValue, failMsg);
        }
Exemplo n.º 20
0
        public static void Type(string path, string input, string failMsg, int timeOut = 0)
        {
            string exceptionMsg = null;
            bool   returnValue  = false;

            DateTime varDateTime;
            DateTime varElapseTime = DateTime.Now.AddSeconds(timeOut);

            do
            {
                varDateTime = DateTime.Now;
                try
                {
                    SikuliAction.Type(path, input);
                    returnValue = true;
                    break;
                }
                catch (Exception e) { exceptionMsg = e.Message.ToString(); }
            } while (varDateTime <= varElapseTime);


            BaseTest.Assert.IsTrue(returnValue, failMsg + "\n" + exceptionMsg);
        }
Exemplo n.º 21
0
        public static void Click(string path, string failMsg, int WaitTime = 0, int RedotimeOut = 0)
        {
            bool returnValue = false;

            WaitForImage(path, failMsg, WaitTime);
            DateTime varDateTime;
            DateTime varElapseTime = DateTime.Now.AddSeconds(RedotimeOut);

            do
            {
                varDateTime = DateTime.Now;
                try
                {
                    SikuliAction.Click(path);
                    returnValue = true;
                    break;
                }
                catch (Exception e) { }
            } while (varDateTime <= varElapseTime);


            BaseTest.Assert.IsTrue(returnValue, failMsg);
        }
 public void TestMethod1()
 {
     driver.Initialize();
     driver.instance.Navigate().GoToUrl("https://www.google.co.in");
     SikuliAction.Click("E:/img.png");
 }