Example #1
0
 public void CLoseChrome(string desktopPath, string chromeClosePath, string leavePath)
 {
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktopPath, chromeClosePath));
     System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(leavePath),
                                         TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait)));
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktopPath, leavePath));
 }
Example #2
0
 public void KeyboardMethodsTest()
 {
     _clickPoint = ImageWorker.FindSubImageCoordinate(DesktopPath, ExplorerPath);
     KeyboardMethods.TypeText("V");
     KeyboardMethods.PressEnter();
     MouseMethods.MoveToElemment(0, 0);
 }
Example #3
0
 public void FindAndOpenChrome(string desktopPath, string chromePath)
 {
     System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(chromePath),
                                         TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait)));
     subImageCoordinate = ImageWorker.FindSubImageCoordinate(desktopPath, chromePath);
     MouseMethods.LMBClick(subImageCoordinate);
 }
Example #4
0
        public static void TypeText(MagickImage inputPlace, string text)
        {
            using (MagickImage screen = new MagickImage("screenshot:"))
            {
                using (inputPlace)
                {
                    try
                    {
                        if (ImageWorker.IsSubImageExist(screen, inputPlace))
                        {
                            MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(screen, inputPlace));
                            new InputSimulator().Keyboard.TextEntry(text);
                        }

                        else
                        {
                            throw new Exception("Such element not found");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                }
            }
        }
Example #5
0
        public void MoveCheirOnWorkspace(string desktopPath, string cheirPath)
        {
            System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(cheirPath),
                                                TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait)));
            Point point = ImageWorker.FindSubImageCoordinate(desktopPath, cheirPath);

            MouseMethods.DragAndDrop(point, new Point(point.X + 500, point.Y));
        }
Example #6
0
 public void FindSearchFieldAndGoToTheTestSite(string desktopPath, string searchPath)
 {
     System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(searchPath),
                                         TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait)));
     subImageCoordinate = ImageWorker.FindSubImageCoordinate(desktopPath, searchPath);
     MouseMethods.LMBClick(subImageCoordinate.X + 100, subImageCoordinate.Y);
     KeyboardMethods.TypeText(SikuliTestData.TestSite);
     KeyboardMethods.PressEnter();
 }
Example #7
0
 public void MouseMethodsTest()
 {
     Assert.IsTrue(ImageWorker.IsSubImageExist(DesktopPath, ExplorerPath));
     _clickPoint = ImageWorker.FindSubImageCoordinate(DesktopPath, ExplorerPath);
     MouseMethods.MoveToElemment(_clickPoint);
     MouseMethods.RMBClick(_clickPoint);
     MouseMethods.LMBClick(_clickPoint);
     MouseMethods.MoveToElemment(0, 0);
 }
Example #8
0
 public void SiteTestMethod()
 {
     actions.FindAndOpenChrome(desktop, chrome);
     Logger.Instance.Info($"Open site: {SikuliTestData.TestSite}");
     actions.FindSearchFieldAndGoToTheTestSite(desktop, search);
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(mainPageWithDialog),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that main site form with dialog window is open");
     Logger.Instance.Info("Close dialog window");
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktop, closeButton));
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(mainPage),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that main site form without dialog window is open");
     Logger.Instance.Info("Open 'furnish your room' list");
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktop, furnishYourRoomButton));
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(itemsList),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that 'furnish your room' items list is open");
     Logger.Instance.Info("Select 'dinig room' section");
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktop, diningRoom));
     Logger.Instance.Info("Select bar cheir and move it on workspace");
     actions.MoveCheirOnWorkspace(desktop, cheir);
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(cheirOnWorkspace),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))), "Verify that chair is on the workspace");
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(etalonCheir),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that chair is on the workspace is etalon");
     Logger.Instance.Info("Click on chair to verify it data");
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktop, etalonCheir));
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(cheirName),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that chair has right name");
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(cheirProperties),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that chair has right name");
     Logger.Instance.Info("Remove chair from workspace");
     MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(desktop, deleteButton));
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(emptyScene),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))),
                 "Verify that chair was remove");
     Assert.True(System.Threading.SpinWait.SpinUntil(() => ImageWorker.IsSubImageExist(sceneInfo),
                                                     TimeSpan.FromSeconds(int.Parse(SikuliTestData.DefaultWait))), "Verify that scene has default parameters");
     actions.CLoseChrome(desktop, closeChrome, leaveSiteButton);
 }
Example #9
0
        public static void TypeText(string screenPath, string inputPlaceImagePath, string text)
        {
            try
            {
                if (ImageWorker.IsSubImageExist(screenPath, inputPlaceImagePath))
                {
                    MouseMethods.LMBClick(ImageWorker.FindSubImageCoordinate(screenPath, inputPlaceImagePath));
                    new InputSimulator().Keyboard.TextEntry(text);
                }

                else
                {
                    throw new Exception("Such element not found");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #10
0
        public void FindSubImageCoordinatesTest()
        {
            Point subImageCoordinate = ImageWorker.FindSubImageCoordinate(DesktopPath, WinPath);

            Assert.IsFalse(subImageCoordinate.IsEmpty);
        }