示例#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...");
            }
        }
示例#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...");
            }
        }
示例#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...");
            }
        }
示例#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...");
            }
        }
示例#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();
        }
示例#6
0
 public void DemoExists()
 {
     if (!SikuliAction.Exists(pattern).IsEmpty)
     {
         Console.WriteLine("Yep! It's there...");
     }
     else
     {
         Console.WriteLine("Nope! It's gone...");
     }
 }
示例#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...");
     }
 }
示例#8
0
 public void TestExistsDefault()
 {
     if (SikuliAction.Exists(pattern).IsEmpty)
     {
         Report.Error("Nope! It's gone...");
     }
     else
     {
         Report.Pass("Yep! It's there...");
     }
 }
示例#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...");
     }
 }
示例#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...");
     }
 }
示例#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...");
     }
 }
示例#12
0
 public void TestHoverDefault()
 {
     try
     {
         SikuliAction.Hover(pattern);
         Report.Pass("Yep! It's hovered...");
     }
     catch
     {
         Report.Error("Nope! It's NOT hovered...");
     }
 }
示例#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...");
     }
 }
示例#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...");
     }
 }
示例#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...");
     }
 }
示例#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...");
     }
 }
示例#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();
 }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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");
 }